ruby-libvirt 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/NEWS.rst +229 -0
- data/README.rst +45 -0
- data/Rakefile +114 -93
- data/ext/libvirt/connect.c +1 -0
- data/ext/libvirt/domain.c +25 -26
- data/ext/libvirt/interface.c +2 -0
- data/ext/libvirt/network.c +2 -0
- data/ext/libvirt/nodedevice.c +1 -0
- data/ext/libvirt/nwfilter.c +2 -0
- data/ext/libvirt/secret.c +1 -0
- data/ext/libvirt/storage.c +4 -2
- data/ext/libvirt/stream.c +1 -0
- data/tests/test_conn.rb +140 -125
- data/tests/test_domain.rb +279 -270
- data/tests/test_interface.rb +7 -5
- data/tests/test_network.rb +1 -1
- data/tests/test_nwfilter.rb +31 -21
- data/tests/test_open.rb +202 -190
- data/tests/test_secret.rb +75 -57
- data/tests/test_storage.rb +103 -88
- data/tests/test_utils.rb +16 -6
- metadata +17 -12
- data/NEWS +0 -154
- data/README +0 -219
- data/ext/libvirt/extconf.h +0 -3
- /data/{README.rdoc → doc/main.rdoc} +0 -0
data/ext/libvirt/nodedevice.c
CHANGED
@@ -260,6 +260,7 @@ static VALUE libvirt_nodedevice_lookup_scsi_host_by_wwn(int argc, VALUE *argv,
|
|
260
260
|
void ruby_libvirt_nodedevice_init(void)
|
261
261
|
{
|
262
262
|
c_nodedevice = rb_define_class_under(m_libvirt, "NodeDevice", rb_cObject);
|
263
|
+
rb_undef_alloc_func(c_nodedevice);
|
263
264
|
|
264
265
|
rb_define_attr(c_nodedevice, "connection", 1, 0);
|
265
266
|
|
data/ext/libvirt/nwfilter.c
CHANGED
@@ -123,6 +123,8 @@ static VALUE libvirt_nwfilter_free(VALUE n)
|
|
123
123
|
void ruby_libvirt_nwfilter_init(void)
|
124
124
|
{
|
125
125
|
c_nwfilter = rb_define_class_under(m_libvirt, "NWFilter", rb_cObject);
|
126
|
+
rb_undef_alloc_func(c_nwfilter);
|
127
|
+
|
126
128
|
rb_define_attr(c_nwfilter, "connection", 1, 0);
|
127
129
|
|
128
130
|
/* NWFilter object methods */
|
data/ext/libvirt/secret.c
CHANGED
data/ext/libvirt/storage.c
CHANGED
@@ -442,8 +442,8 @@ static VALUE libvirt_storage_pool_list_all_volumes(int argc, VALUE *argv,
|
|
442
442
|
{
|
443
443
|
ruby_libvirt_generate_call_list_all(virStorageVolPtr, argc, argv,
|
444
444
|
virStoragePoolListAllVolumes,
|
445
|
-
pool_get(p), p,
|
446
|
-
virStorageVolFree);
|
445
|
+
pool_get(p), ruby_libvirt_conn_attr(p),
|
446
|
+
vol_new, virStorageVolFree);
|
447
447
|
}
|
448
448
|
|
449
449
|
/*
|
@@ -752,6 +752,7 @@ void ruby_libvirt_storage_init(void)
|
|
752
752
|
|
753
753
|
c_storage_pool = rb_define_class_under(m_libvirt, "StoragePool",
|
754
754
|
rb_cObject);
|
755
|
+
rb_undef_alloc_func(c_storage_pool);
|
755
756
|
|
756
757
|
rb_define_attr(c_storage_pool, "connection", 1, 0);
|
757
758
|
|
@@ -864,6 +865,7 @@ void ruby_libvirt_storage_init(void)
|
|
864
865
|
|
865
866
|
c_storage_vol = rb_define_class_under(m_libvirt, "StorageVol",
|
866
867
|
rb_cObject);
|
868
|
+
rb_undef_alloc_func(c_storage_vol);
|
867
869
|
|
868
870
|
rb_define_const(c_storage_vol, "XML_INACTIVE",
|
869
871
|
INT2NUM(VIR_STORAGE_XML_INACTIVE));
|
data/ext/libvirt/stream.c
CHANGED
data/tests/test_conn.rb
CHANGED
@@ -9,19 +9,21 @@ require 'test_utils.rb'
|
|
9
9
|
|
10
10
|
set_test_object("connect")
|
11
11
|
|
12
|
-
conn = Libvirt::open(
|
12
|
+
conn = Libvirt::open(URI)
|
13
13
|
|
14
14
|
cleanup_test_domain(conn)
|
15
15
|
cleanup_test_network(conn)
|
16
16
|
|
17
17
|
# test setup
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
if !test_default_uri?
|
19
|
+
begin
|
20
|
+
`rm -f /etc/sysconfig/network-scripts/ifcfg-rb-libvirt-test`
|
21
|
+
`brctl delbr rb-libvirt-test >& /dev/null`
|
22
|
+
rescue
|
23
|
+
end
|
24
|
+
`qemu-img create -f qcow2 #{$GUEST_DISK} 5G`
|
25
|
+
`rm -rf #{$POOL_PATH}; mkdir #{$POOL_PATH} ; echo $?`
|
22
26
|
end
|
23
|
-
`qemu-img create -f qcow2 #{$GUEST_DISK} 5G`
|
24
|
-
`rm -rf #{$POOL_PATH}; mkdir #{$POOL_PATH} ; echo $?`
|
25
27
|
|
26
28
|
cpu_xml = <<EOF
|
27
29
|
<cpu>
|
@@ -31,12 +33,12 @@ cpu_xml = <<EOF
|
|
31
33
|
EOF
|
32
34
|
|
33
35
|
# TESTGROUP: conn.close
|
34
|
-
conn2 = Libvirt::open(
|
36
|
+
conn2 = Libvirt::open(URI)
|
35
37
|
expect_too_many_args(conn2, "close", 1)
|
36
38
|
expect_success(conn2, "no args", "close")
|
37
39
|
|
38
40
|
# TESTGROUP: conn.closed?
|
39
|
-
conn2 = Libvirt::open(
|
41
|
+
conn2 = Libvirt::open(URI)
|
40
42
|
|
41
43
|
expect_too_many_args(conn2, "closed?", 1)
|
42
44
|
expect_success(conn2, "no args", "closed?") {|x| x == false }
|
@@ -46,7 +48,11 @@ expect_success(conn2, "no args", "closed?") {|x| x == true }
|
|
46
48
|
# TESTGROUP: conn.type
|
47
49
|
expect_too_many_args(conn, "type", 1)
|
48
50
|
|
49
|
-
|
51
|
+
if test_default_uri?
|
52
|
+
expect_success(conn, "no args", "type") {|x| x == "TEST"}
|
53
|
+
else
|
54
|
+
expect_success(conn, "no args", "type") {|x| x == "QEMU"}
|
55
|
+
end
|
50
56
|
|
51
57
|
# TESTGROUP: conn.version
|
52
58
|
expect_too_many_args(conn, "version", 1)
|
@@ -66,11 +72,14 @@ expect_success(conn, "no args", "hostname")
|
|
66
72
|
# TESTGROUP: conn.uri
|
67
73
|
expect_too_many_args(conn, "uri", 1)
|
68
74
|
|
69
|
-
expect_success(conn, "no args", "uri") {|x| x ==
|
75
|
+
expect_success(conn, "no args", "uri") {|x| x == URI }
|
70
76
|
|
71
77
|
# TESTGROUP: conn.max_vcpus
|
72
78
|
expect_too_many_args(conn, "max_vcpus", 'kvm', 1)
|
73
|
-
|
79
|
+
|
80
|
+
if !test_default_uri?
|
81
|
+
expect_fail(conn, Libvirt::RetrieveError, "invalid arg", "max_vcpus", "foo")
|
82
|
+
end
|
74
83
|
|
75
84
|
expect_success(conn, "no args", "max_vcpus")
|
76
85
|
expect_success(conn, "nil arg", "max_vcpus")
|
@@ -113,12 +122,14 @@ expect_too_many_args(conn, "capabilities", 1)
|
|
113
122
|
expect_success(conn, "no args", "capabilities")
|
114
123
|
|
115
124
|
# TESTGROUP: conn.compare_cpu
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
expect_invalid_arg_type(conn, "compare_cpu",
|
120
|
-
|
121
|
-
|
125
|
+
if !test_default_uri?
|
126
|
+
expect_too_many_args(conn, "compare_cpu", 1, 2, 3)
|
127
|
+
expect_too_few_args(conn, "compare_cpu")
|
128
|
+
expect_invalid_arg_type(conn, "compare_cpu", 1)
|
129
|
+
expect_invalid_arg_type(conn, "compare_cpu", "hello", 'bar')
|
130
|
+
expect_fail(conn, Libvirt::RetrieveError, "invalid XML", "compare_cpu", "hello")
|
131
|
+
expect_success(conn, "CPU XML", "compare_cpu", cpu_xml)
|
132
|
+
end
|
122
133
|
|
123
134
|
# TESTGROUP: conn.baseline_cpu
|
124
135
|
expect_too_many_args(conn, "baseline_cpu", 1, 2, 3)
|
@@ -205,7 +216,7 @@ expect_too_many_args(conn, "list_domains", 1)
|
|
205
216
|
expect_success(conn, "no args", "list_domains")
|
206
217
|
|
207
218
|
newdom = conn.create_domain_xml($new_dom_xml)
|
208
|
-
|
219
|
+
test_sleep 1
|
209
220
|
|
210
221
|
expect_success(conn, "no args", "list_domains")
|
211
222
|
|
@@ -227,7 +238,7 @@ expect_invalid_arg_type(conn, "create_domain_linux", 1)
|
|
227
238
|
expect_invalid_arg_type(conn, "create_domain_linux", $new_dom_xml, "foo")
|
228
239
|
expect_fail(conn, Libvirt::Error, "invalid xml", "create_domain_linux", "hello")
|
229
240
|
newdom = expect_success(conn, "domain xml", "create_domain_linux", $new_dom_xml) {|x| x.class == Libvirt::Domain}
|
230
|
-
|
241
|
+
test_sleep 1
|
231
242
|
|
232
243
|
expect_fail(conn, Libvirt::Error, "already existing domain", "create_domain_linux", $new_dom_xml)
|
233
244
|
|
@@ -241,7 +252,7 @@ expect_invalid_arg_type(conn, "create_domain_xml", 1)
|
|
241
252
|
expect_invalid_arg_type(conn, "create_domain_xml", $new_dom_xml, "foo")
|
242
253
|
expect_fail(conn, Libvirt::Error, "invalid xml", "create_domain_xml", "hello")
|
243
254
|
newdom = expect_success(conn, "domain xml", "create_domain_xml", $new_dom_xml) {|x| x.class == Libvirt::Domain}
|
244
|
-
|
255
|
+
test_sleep 1
|
245
256
|
|
246
257
|
expect_fail(conn, Libvirt::Error, "already existing domain", "create_domain_xml", $new_dom_xml)
|
247
258
|
|
@@ -249,7 +260,7 @@ newdom.destroy
|
|
249
260
|
|
250
261
|
# TESTGROUP: conn.lookup_domain_by_name
|
251
262
|
newdom = conn.create_domain_xml($new_dom_xml)
|
252
|
-
|
263
|
+
test_sleep 1
|
253
264
|
|
254
265
|
expect_too_many_args(conn, "lookup_domain_by_name", 1, 2)
|
255
266
|
expect_too_few_args(conn, "lookup_domain_by_name")
|
@@ -265,7 +276,7 @@ newdom.undefine
|
|
265
276
|
|
266
277
|
# TESTGROUP: conn.lookup_domain_by_id
|
267
278
|
newdom = conn.create_domain_xml($new_dom_xml)
|
268
|
-
|
279
|
+
test_sleep 1
|
269
280
|
|
270
281
|
expect_too_many_args(conn, "lookup_domain_by_id", 1, 2)
|
271
282
|
expect_too_few_args(conn, "lookup_domain_by_id")
|
@@ -277,7 +288,7 @@ newdom.destroy
|
|
277
288
|
|
278
289
|
# TESTGROUP: conn.lookup_domain_by_uuid
|
279
290
|
newdom = conn.create_domain_xml($new_dom_xml)
|
280
|
-
|
291
|
+
test_sleep 1
|
281
292
|
|
282
293
|
expect_too_many_args(conn, "lookup_domain_by_uuid", 1, 2)
|
283
294
|
expect_too_few_args(conn, "lookup_domain_by_uuid")
|
@@ -301,32 +312,6 @@ expect_fail(conn, Libvirt::DefinitionError, "invalid XML", "define_domain_xml",
|
|
301
312
|
newdom = expect_success(conn, "domain xml arg", "define_domain_xml", $new_dom_xml)
|
302
313
|
newdom.undefine
|
303
314
|
|
304
|
-
# TESTGROUP: conn.domain_xml_from_native
|
305
|
-
expect_too_many_args(conn, "domain_xml_from_native", 1, 2, 3, 4)
|
306
|
-
expect_too_few_args(conn, "domain_xml_from_native")
|
307
|
-
expect_too_few_args(conn, "domain_xml_from_native", 1)
|
308
|
-
expect_invalid_arg_type(conn, "domain_xml_from_native", 1, 2)
|
309
|
-
expect_invalid_arg_type(conn, "domain_xml_from_native", nil, 2)
|
310
|
-
expect_invalid_arg_type(conn, "domain_xml_from_native", "qemu-argv", 2)
|
311
|
-
expect_invalid_arg_type(conn, "domain_xml_from_native", "qemu-argv", nil)
|
312
|
-
expect_invalid_arg_type(conn, "domain_xml_from_native", "qemu-argv", "foo", "bar")
|
313
|
-
expect_fail(conn, Libvirt::Error, "unsupported first arg", "domain_xml_from_native", "foo", "bar")
|
314
|
-
|
315
|
-
expect_success(conn, "qemu-argv and qemu_cmd_line", "domain_xml_from_native", "qemu-argv", $qemu_cmd_line)
|
316
|
-
|
317
|
-
# TESTGROUP: conn.domain_xml_to_native
|
318
|
-
expect_too_many_args(conn, "domain_xml_to_native", 1, 2, 3, 4)
|
319
|
-
expect_too_few_args(conn, "domain_xml_to_native")
|
320
|
-
expect_too_few_args(conn, "domain_xml_to_native", 1)
|
321
|
-
expect_invalid_arg_type(conn, "domain_xml_to_native", 1, 2)
|
322
|
-
expect_invalid_arg_type(conn, "domain_xml_to_native", nil, 2)
|
323
|
-
expect_invalid_arg_type(conn, "domain_xml_to_native", "qemu-argv", 2)
|
324
|
-
expect_invalid_arg_type(conn, "domain_xml_to_native", "qemu-argv", nil)
|
325
|
-
expect_invalid_arg_type(conn, "domain_xml_to_native", "qemu-argv", "foo", "bar")
|
326
|
-
expect_fail(conn, Libvirt::Error, "unsupported first arg", "domain_xml_to_native", "foo", "bar")
|
327
|
-
|
328
|
-
expect_success(conn, "qemu-argv and domain XML", "domain_xml_to_native", "qemu-argv", $new_dom_xml)
|
329
|
-
|
330
315
|
# TESTGROUP: conn.num_of_interfaces
|
331
316
|
expect_too_many_args(conn, "num_of_interfaces", 1)
|
332
317
|
expect_success(conn, "no args", "num_of_interfaces")
|
@@ -483,89 +468,109 @@ expect_fail(conn, Libvirt::Error, "invalid XML", "create_nodedevice_xml", "hello
|
|
483
468
|
#expect_success(conn, "nodedevice XML", "create_nodedevice_xml", "<nodedevice/>")
|
484
469
|
|
485
470
|
# TESTGROUP: conn.num_of_nwfilters
|
486
|
-
|
487
|
-
|
471
|
+
if !test_default_uri?
|
472
|
+
expect_too_many_args(conn, "num_of_nwfilters", 1)
|
473
|
+
expect_success(conn, "no args", "num_of_nwfilters")
|
474
|
+
end
|
488
475
|
|
489
476
|
# TESTGROUP: conn.list_nwfilters
|
490
|
-
|
491
|
-
|
477
|
+
if !test_default_uri?
|
478
|
+
expect_too_many_args(conn, "list_nwfilters", 1)
|
479
|
+
expect_success(conn, "no args", "list_nwfilters")
|
480
|
+
end
|
492
481
|
|
493
482
|
# TESTGROUP: conn.lookup_nwfilter_by_name
|
494
|
-
|
483
|
+
if !test_default_uri?
|
484
|
+
newnw = conn.define_nwfilter_xml($new_nwfilter_xml)
|
495
485
|
|
496
|
-
expect_too_many_args(conn, "lookup_nwfilter_by_name", 1, 2)
|
497
|
-
expect_too_few_args(conn, "lookup_nwfilter_by_name")
|
498
|
-
expect_invalid_arg_type(conn, "lookup_nwfilter_by_name", 1)
|
486
|
+
expect_too_many_args(conn, "lookup_nwfilter_by_name", 1, 2)
|
487
|
+
expect_too_few_args(conn, "lookup_nwfilter_by_name")
|
488
|
+
expect_invalid_arg_type(conn, "lookup_nwfilter_by_name", 1)
|
499
489
|
|
500
|
-
expect_success(conn, "name arg", "lookup_nwfilter_by_name", "rb-libvirt-test")
|
490
|
+
expect_success(conn, "name arg", "lookup_nwfilter_by_name", "rb-libvirt-test")
|
501
491
|
|
502
|
-
newnw.undefine
|
492
|
+
newnw.undefine
|
493
|
+
end
|
503
494
|
|
504
495
|
# TESTGROUP: conn.lookup_nwfilter_by_uuid
|
505
|
-
|
496
|
+
if !test_default_uri?
|
497
|
+
newnw = conn.define_nwfilter_xml($new_nwfilter_xml)
|
506
498
|
|
507
|
-
expect_too_many_args(conn, "lookup_nwfilter_by_uuid", 1, 2)
|
508
|
-
expect_too_few_args(conn, "lookup_nwfilter_by_uuid")
|
509
|
-
expect_invalid_arg_type(conn, "lookup_nwfilter_by_uuid", 1)
|
499
|
+
expect_too_many_args(conn, "lookup_nwfilter_by_uuid", 1, 2)
|
500
|
+
expect_too_few_args(conn, "lookup_nwfilter_by_uuid")
|
501
|
+
expect_invalid_arg_type(conn, "lookup_nwfilter_by_uuid", 1)
|
510
502
|
|
511
|
-
expect_success(conn, "uuid arg", "lookup_nwfilter_by_uuid", $NWFILTER_UUID) {|x| x.uuid == $NWFILTER_UUID}
|
503
|
+
expect_success(conn, "uuid arg", "lookup_nwfilter_by_uuid", $NWFILTER_UUID) {|x| x.uuid == $NWFILTER_UUID}
|
512
504
|
|
513
|
-
newnw.undefine
|
505
|
+
newnw.undefine
|
506
|
+
end
|
514
507
|
|
515
508
|
# TESTGROUP: conn.define_nwfilter_xml
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
expect_invalid_arg_type(conn, "define_nwfilter_xml",
|
520
|
-
|
509
|
+
if !test_default_uri?
|
510
|
+
expect_too_many_args(conn, "define_nwfilter_xml", 1, 2)
|
511
|
+
expect_too_few_args(conn, "define_nwfilter_xml")
|
512
|
+
expect_invalid_arg_type(conn, "define_nwfilter_xml", 1)
|
513
|
+
expect_invalid_arg_type(conn, "define_nwfilter_xml", nil)
|
514
|
+
expect_fail(conn, Libvirt::DefinitionError, "invalid XML", "define_nwfilter_xml", "hello")
|
521
515
|
|
522
|
-
newnw = expect_success(conn, "nwfilter XML", "define_nwfilter_xml", $new_nwfilter_xml)
|
516
|
+
newnw = expect_success(conn, "nwfilter XML", "define_nwfilter_xml", $new_nwfilter_xml)
|
523
517
|
|
524
|
-
newnw.undefine
|
518
|
+
newnw.undefine
|
519
|
+
end
|
525
520
|
|
526
521
|
# TESTGROUP: conn.num_of_secrets
|
527
|
-
|
528
|
-
|
522
|
+
if !test_default_uri?
|
523
|
+
expect_too_many_args(conn, "num_of_secrets", 1)
|
524
|
+
expect_success(conn, "no args", "num_of_secrets")
|
525
|
+
end
|
529
526
|
|
530
527
|
# TESTGROUP: conn.list_secrets
|
531
|
-
|
532
|
-
|
528
|
+
if !test_default_uri?
|
529
|
+
expect_too_many_args(conn, "list_secrets", 1)
|
530
|
+
expect_success(conn, "no args", "list_secrets")
|
531
|
+
end
|
533
532
|
|
534
533
|
# TESTGROUP: conn.lookup_secret_by_uuid
|
535
|
-
|
534
|
+
if !test_default_uri?
|
535
|
+
newsecret = conn.define_secret_xml($new_secret_xml)
|
536
536
|
|
537
|
-
expect_too_many_args(conn, "lookup_secret_by_uuid", 1, 2)
|
538
|
-
expect_too_few_args(conn, "lookup_secret_by_uuid")
|
539
|
-
expect_invalid_arg_type(conn, "lookup_secret_by_uuid", 1)
|
537
|
+
expect_too_many_args(conn, "lookup_secret_by_uuid", 1, 2)
|
538
|
+
expect_too_few_args(conn, "lookup_secret_by_uuid")
|
539
|
+
expect_invalid_arg_type(conn, "lookup_secret_by_uuid", 1)
|
540
540
|
|
541
|
-
expect_success(conn, "uuid arg", "lookup_secret_by_uuid", $SECRET_UUID) {|x| x.uuid == $SECRET_UUID}
|
541
|
+
expect_success(conn, "uuid arg", "lookup_secret_by_uuid", $SECRET_UUID) {|x| x.uuid == $SECRET_UUID}
|
542
542
|
|
543
|
-
newsecret.undefine
|
543
|
+
newsecret.undefine
|
544
|
+
end
|
544
545
|
|
545
546
|
# TESTGROUP: conn.lookup_secret_by_usage
|
546
|
-
|
547
|
+
if !test_default_uri?
|
548
|
+
newsecret = conn.define_secret_xml($new_secret_xml)
|
547
549
|
|
548
|
-
expect_too_many_args(conn, "lookup_secret_by_usage", 1, 2, 3)
|
549
|
-
expect_too_few_args(conn, "lookup_secret_by_usage")
|
550
|
-
expect_invalid_arg_type(conn, "lookup_secret_by_usage", 'foo', 1)
|
551
|
-
expect_invalid_arg_type(conn, "lookup_secret_by_usage", 1, 2)
|
552
|
-
expect_fail(conn, Libvirt::RetrieveError, "invalid secret", "lookup_secret_by_usage", Libvirt::Secret::USAGE_TYPE_VOLUME, "foo")
|
550
|
+
expect_too_many_args(conn, "lookup_secret_by_usage", 1, 2, 3)
|
551
|
+
expect_too_few_args(conn, "lookup_secret_by_usage")
|
552
|
+
expect_invalid_arg_type(conn, "lookup_secret_by_usage", 'foo', 1)
|
553
|
+
expect_invalid_arg_type(conn, "lookup_secret_by_usage", 1, 2)
|
554
|
+
expect_fail(conn, Libvirt::RetrieveError, "invalid secret", "lookup_secret_by_usage", Libvirt::Secret::USAGE_TYPE_VOLUME, "foo")
|
553
555
|
|
554
|
-
expect_success(conn, "usage type and key", "lookup_secret_by_usage", Libvirt::Secret::USAGE_TYPE_VOLUME, "/var/lib/libvirt/images/mail.img")
|
556
|
+
expect_success(conn, "usage type and key", "lookup_secret_by_usage", Libvirt::Secret::USAGE_TYPE_VOLUME, "/var/lib/libvirt/images/mail.img")
|
555
557
|
|
556
|
-
newsecret.undefine
|
558
|
+
newsecret.undefine
|
559
|
+
end
|
557
560
|
|
558
561
|
# TESTGROUP: conn.define_secret_xml
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
expect_invalid_arg_type(conn, "define_secret_xml",
|
563
|
-
expect_invalid_arg_type(conn, "define_secret_xml",
|
564
|
-
|
562
|
+
if !test_default_uri?
|
563
|
+
expect_too_many_args(conn, "define_secret_xml", 1, 2, 3)
|
564
|
+
expect_too_few_args(conn, "define_secret_xml")
|
565
|
+
expect_invalid_arg_type(conn, "define_secret_xml", 1)
|
566
|
+
expect_invalid_arg_type(conn, "define_secret_xml", nil)
|
567
|
+
expect_invalid_arg_type(conn, "define_secret_xml", "hello", 'foo')
|
568
|
+
expect_fail(conn, Libvirt::DefinitionError, "invalid XML", "define_secret_xml", "hello")
|
565
569
|
|
566
|
-
expect_success(conn, "secret XML", "define_secret_xml", $new_secret_xml)
|
570
|
+
expect_success(conn, "secret XML", "define_secret_xml", $new_secret_xml)
|
567
571
|
|
568
|
-
newsecret.undefine
|
572
|
+
newsecret.undefine
|
573
|
+
end
|
569
574
|
|
570
575
|
# TESTGROUP: conn.list_storage_pools
|
571
576
|
expect_too_many_args(conn, "list_storage_pools", 1)
|
@@ -692,26 +697,30 @@ expect_invalid_arg_type(conn, "node_cpu_stats", 1, 'bar')
|
|
692
697
|
expect_success(conn, "node cpu stats", "node_cpu_stats")
|
693
698
|
|
694
699
|
# TESTGROUP: conn.node_memory_stats
|
695
|
-
|
696
|
-
|
697
|
-
expect_invalid_arg_type(conn, "node_memory_stats",
|
700
|
+
if !test_default_uri?
|
701
|
+
expect_too_many_args(conn, "node_memory_stats", 1, 2, 3)
|
702
|
+
expect_invalid_arg_type(conn, "node_memory_stats", 'foo')
|
703
|
+
expect_invalid_arg_type(conn, "node_memory_stats", 1, 'bar')
|
698
704
|
|
699
|
-
expect_success(conn, "node memory status", "node_memory_stats")
|
705
|
+
expect_success(conn, "node memory status", "node_memory_stats")
|
706
|
+
end
|
700
707
|
|
701
708
|
# TESTGROUP: conn.save_image_xml_desc
|
702
|
-
|
703
|
-
newdom.
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
expect_invalid_arg_type(conn, "save_image_xml_desc",
|
711
|
-
expect_invalid_arg_type(conn, "save_image_xml_desc",
|
712
|
-
|
713
|
-
|
714
|
-
|
709
|
+
if !test_default_uri?
|
710
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
711
|
+
newdom.create
|
712
|
+
test_sleep 1
|
713
|
+
newdom.save($GUEST_SAVE)
|
714
|
+
|
715
|
+
expect_too_many_args(conn, "save_image_xml_desc", 1, 2, 3)
|
716
|
+
expect_too_few_args(conn, "save_image_xml_desc")
|
717
|
+
expect_invalid_arg_type(conn, "save_image_xml_desc", nil)
|
718
|
+
expect_invalid_arg_type(conn, "save_image_xml_desc", 1)
|
719
|
+
expect_invalid_arg_type(conn, "save_image_xml_desc", 'foo', 'bar')
|
720
|
+
|
721
|
+
expect_success(conn, "save image path", "save_image_xml_desc", $GUEST_SAVE)
|
722
|
+
`rm -f #{$GUEST_SAVE}`
|
723
|
+
end
|
715
724
|
|
716
725
|
# TESTGROUP: conn.define_save_image_xml
|
717
726
|
expect_too_many_args(conn, "define_save_image_xml", 1, 2, 3, 4)
|
@@ -729,10 +738,12 @@ expect_too_many_args(conn, "alive?", 1)
|
|
729
738
|
expect_success(conn, "alive connection", "alive?") {|x| x == true}
|
730
739
|
|
731
740
|
# TESTGROUP: conn.list_all_nwfilters
|
732
|
-
|
733
|
-
|
741
|
+
if !test_default_uri?
|
742
|
+
expect_too_many_args(conn, "list_all_nwfilters", 1, 2)
|
743
|
+
expect_invalid_arg_type(conn, "list_all_nwfilters", "foo")
|
734
744
|
|
735
|
-
expect_success(conn, "no args", "list_all_nwfilters")
|
745
|
+
expect_success(conn, "no args", "list_all_nwfilters")
|
746
|
+
end
|
736
747
|
|
737
748
|
# TESTGROUP: conn.list_all_storage_pools
|
738
749
|
expect_too_many_args(conn, "list_all_storage_pools", 1, 2)
|
@@ -747,10 +758,12 @@ expect_invalid_arg_type(conn, "list_all_nodedevices", "foo")
|
|
747
758
|
expect_success(conn, "no args", "list_all_nodedevices")
|
748
759
|
|
749
760
|
# TESTGROUP: conn.list_all_secrets
|
750
|
-
|
751
|
-
|
761
|
+
if !test_default_uri?
|
762
|
+
expect_too_many_args(conn, "list_all_secrets", 1, 2)
|
763
|
+
expect_invalid_arg_type(conn, "list_all_secrets", "foo")
|
752
764
|
|
753
|
-
expect_success(conn, "no args", "list_all_secrets")
|
765
|
+
expect_success(conn, "no args", "list_all_secrets")
|
766
|
+
end
|
754
767
|
|
755
768
|
# TESTGROUP: conn.list_all_interfaces
|
756
769
|
expect_too_many_args(conn, "list_all_interfaces", 1, 2)
|
@@ -789,10 +802,12 @@ expect_invalid_arg_type(conn, "node_suspend_for_duration", 1, 'foo')
|
|
789
802
|
expect_invalid_arg_type(conn, "node_suspend_for_duration", 1, 2, 'foo')
|
790
803
|
|
791
804
|
# TESTGROUP: conn.node_memory_parameters
|
792
|
-
|
793
|
-
|
805
|
+
if !test_default_uri?
|
806
|
+
expect_too_many_args(conn, "node_memory_parameters", 1, 2)
|
807
|
+
expect_invalid_arg_type(conn, "node_memory_parameters", 'foo')
|
794
808
|
|
795
|
-
expect_success(conn, "no args", "node_memory_parameters")
|
809
|
+
expect_success(conn, "no args", "node_memory_parameters")
|
810
|
+
end
|
796
811
|
|
797
812
|
# TESTGROUP: conn.node_memory_paramters=
|
798
813
|
expect_too_many_args(conn, "node_memory_parameters=", 1, 2)
|