ruby-libvirt 0.8.2 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.rst +235 -0
- data/README.rst +45 -0
- data/Rakefile +114 -93
- data/ext/libvirt/common.c +11 -0
- data/ext/libvirt/common.h +2 -0
- data/ext/libvirt/connect.c +3 -0
- data/ext/libvirt/domain.c +7 -0
- data/ext/libvirt/extconf.rb +0 -4
- data/ext/libvirt/interface.c +4 -0
- data/ext/libvirt/network.c +4 -0
- data/ext/libvirt/nodedevice.c +3 -0
- data/ext/libvirt/nwfilter.c +4 -0
- data/ext/libvirt/secret.c +3 -0
- data/ext/libvirt/storage.c +6 -0
- data/ext/libvirt/stream.c +3 -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 -158
- data/README +0 -219
- data/ext/libvirt/extconf.h +0 -3
- /data/{README.rdoc → doc/main.rdoc} +0 -0
data/tests/test_domain.rb
CHANGED
@@ -13,13 +13,15 @@ require 'test_utils.rb'
|
|
13
13
|
|
14
14
|
set_test_object("domain")
|
15
15
|
|
16
|
-
conn = Libvirt::open(
|
16
|
+
conn = Libvirt::open(URI)
|
17
17
|
|
18
18
|
cleanup_test_domain(conn)
|
19
19
|
|
20
20
|
# setup for later tests
|
21
|
-
|
22
|
-
`qemu-img create -f
|
21
|
+
if !test_default_uri?
|
22
|
+
`qemu-img create -f qcow2 #{$GUEST_DISK} 5G`
|
23
|
+
`qemu-img create -f raw #{$GUEST_RAW_DISK} 5G`
|
24
|
+
end
|
23
25
|
|
24
26
|
|
25
27
|
new_hostdev_xml = <<EOF
|
@@ -33,21 +35,23 @@ EOF
|
|
33
35
|
# start tests
|
34
36
|
|
35
37
|
# TESTGROUP: dom.migrate_max_speed
|
36
|
-
|
37
|
-
|
38
|
+
if !test_default_uri?
|
39
|
+
newdom = conn.create_domain_xml($new_dom_xml)
|
40
|
+
test_sleep 1
|
38
41
|
|
39
|
-
expect_too_many_args(newdom, "migrate_max_speed", 1, 2)
|
40
|
-
expect_invalid_arg_type(newdom, "migrate_max_speed", 'foo')
|
41
|
-
expect_invalid_arg_type(newdom, "migrate_max_speed", [])
|
42
|
-
expect_invalid_arg_type(newdom, "migrate_max_speed", {})
|
42
|
+
expect_too_many_args(newdom, "migrate_max_speed", 1, 2)
|
43
|
+
expect_invalid_arg_type(newdom, "migrate_max_speed", 'foo')
|
44
|
+
expect_invalid_arg_type(newdom, "migrate_max_speed", [])
|
45
|
+
expect_invalid_arg_type(newdom, "migrate_max_speed", {})
|
43
46
|
|
44
|
-
expect_success(newdom, "no args", "migrate_max_speed")
|
47
|
+
expect_success(newdom, "no args", "migrate_max_speed")
|
45
48
|
|
46
|
-
newdom.destroy
|
49
|
+
newdom.destroy
|
50
|
+
end
|
47
51
|
|
48
52
|
# TESTGROUP: dom.reset
|
49
53
|
newdom = conn.create_domain_xml($new_dom_xml)
|
50
|
-
|
54
|
+
test_sleep 1
|
51
55
|
|
52
56
|
expect_too_many_args(newdom, "reset", 1, 2)
|
53
57
|
expect_invalid_arg_type(newdom, "reset", 'foo')
|
@@ -60,7 +64,7 @@ newdom.destroy
|
|
60
64
|
|
61
65
|
# TESTGROUP: dom.hostname
|
62
66
|
newdom = conn.create_domain_xml($new_dom_xml)
|
63
|
-
|
67
|
+
test_sleep 1
|
64
68
|
|
65
69
|
expect_too_many_args(newdom, "hostname", 1, 2)
|
66
70
|
expect_invalid_arg_type(newdom, "hostname", 'foo')
|
@@ -74,7 +78,7 @@ newdom.destroy
|
|
74
78
|
|
75
79
|
# TESTGROUP: dom.metadata
|
76
80
|
newdom = conn.create_domain_xml($new_dom_xml)
|
77
|
-
|
81
|
+
test_sleep 1
|
78
82
|
|
79
83
|
expect_too_many_args(newdom, "metadata", 1, 2, 3, 4)
|
80
84
|
expect_too_few_args(newdom, "metadata")
|
@@ -91,7 +95,7 @@ newdom.destroy
|
|
91
95
|
|
92
96
|
# TESTGROUP: dom.metadata=
|
93
97
|
newdom = conn.create_domain_xml($new_dom_xml)
|
94
|
-
|
98
|
+
test_sleep 1
|
95
99
|
|
96
100
|
expect_too_many_args(newdom, "metadata=", 1, 2, 3, 4, 5, 6)
|
97
101
|
expect_too_few_args(newdom, "metadata=")
|
@@ -117,7 +121,7 @@ newdom.destroy
|
|
117
121
|
|
118
122
|
# TESTGROUP: dom.updated?
|
119
123
|
newdom = conn.create_domain_xml($new_dom_xml)
|
120
|
-
|
124
|
+
test_sleep 1
|
121
125
|
|
122
126
|
expect_too_many_args(newdom, "updated?", 1)
|
123
127
|
|
@@ -127,7 +131,7 @@ newdom.destroy
|
|
127
131
|
|
128
132
|
# TESTGROUP: dom.inject_nmi
|
129
133
|
newdom = conn.create_domain_xml($new_dom_xml)
|
130
|
-
|
134
|
+
test_sleep 1
|
131
135
|
|
132
136
|
expect_too_many_args(newdom, "inject_nmi", 1, 2)
|
133
137
|
expect_invalid_arg_type(newdom, "inject_nmi", 'foo')
|
@@ -138,7 +142,7 @@ newdom.destroy
|
|
138
142
|
|
139
143
|
# TESTGROUP: dom.control_info
|
140
144
|
newdom = conn.create_domain_xml($new_dom_xml)
|
141
|
-
|
145
|
+
test_sleep 1
|
142
146
|
|
143
147
|
expect_too_many_args(newdom, "control_info", 1, 2)
|
144
148
|
expect_invalid_arg_type(newdom, "control_info", 'foo')
|
@@ -149,7 +153,7 @@ newdom.destroy
|
|
149
153
|
|
150
154
|
# TESTGROUP: dom.send_key
|
151
155
|
newdom = conn.create_domain_xml($new_dom_xml)
|
152
|
-
|
156
|
+
test_sleep 1
|
153
157
|
|
154
158
|
expect_too_many_args(newdom, "send_key", 1, 2, 3, 4)
|
155
159
|
expect_too_few_args(newdom, "send_key")
|
@@ -173,9 +177,9 @@ newdom.destroy
|
|
173
177
|
|
174
178
|
# TESTGROUP: dom.migrate
|
175
179
|
newdom = conn.create_domain_xml($new_dom_xml)
|
176
|
-
|
180
|
+
test_sleep 1
|
177
181
|
|
178
|
-
dconn = Libvirt::open(
|
182
|
+
dconn = Libvirt::open(URI)
|
179
183
|
|
180
184
|
expect_too_many_args(newdom, "migrate", 1, 2, 3, 4, 5, 6)
|
181
185
|
expect_too_few_args(newdom, "migrate")
|
@@ -194,14 +198,14 @@ newdom.destroy
|
|
194
198
|
|
195
199
|
# TESTGROUP: dom.migrate_to_uri
|
196
200
|
newdom = conn.create_domain_xml($new_dom_xml)
|
197
|
-
|
201
|
+
test_sleep 1
|
198
202
|
|
199
203
|
expect_too_many_args(newdom, "migrate_to_uri", 1, 2, 3, 4, 5)
|
200
204
|
expect_too_few_args(newdom, "migrate_to_uri")
|
201
205
|
expect_invalid_arg_type(newdom, "migrate_to_uri", 1)
|
202
|
-
expect_invalid_arg_type(newdom, "migrate_to_uri",
|
203
|
-
expect_invalid_arg_type(newdom, "migrate_to_uri",
|
204
|
-
expect_invalid_arg_type(newdom, "migrate_to_uri",
|
206
|
+
expect_invalid_arg_type(newdom, "migrate_to_uri", URI, 'foo')
|
207
|
+
expect_invalid_arg_type(newdom, "migrate_to_uri", URI, 0, 1)
|
208
|
+
expect_invalid_arg_type(newdom, "migrate_to_uri", URI, 0, 'foo', 'bar')
|
205
209
|
|
206
210
|
#expect_success(newdom, "URI arg", "migrate_to_uri", "qemu://remote/system")
|
207
211
|
|
@@ -221,7 +225,7 @@ expect_fail(newdom, Libvirt::Error, "on off domain", "migrate_set_max_downtime",
|
|
221
225
|
newdom.undefine
|
222
226
|
|
223
227
|
newdom = conn.create_domain_xml($new_dom_xml)
|
224
|
-
|
228
|
+
test_sleep 1
|
225
229
|
#expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_set_max_downtime", 10)
|
226
230
|
|
227
231
|
#newdom.migrate_to_uri("qemu://remote/system")
|
@@ -231,9 +235,9 @@ newdom.destroy
|
|
231
235
|
|
232
236
|
# TESTGROUP: dom.migrate2
|
233
237
|
newdom = conn.create_domain_xml($new_dom_xml)
|
234
|
-
|
238
|
+
test_sleep 1
|
235
239
|
|
236
|
-
dconn = Libvirt::open(
|
240
|
+
dconn = Libvirt::open(URI)
|
237
241
|
|
238
242
|
expect_too_many_args(newdom, "migrate2", 1, 2, 3, 4, 5, 6, 7)
|
239
243
|
expect_too_few_args(newdom, "migrate2")
|
@@ -249,15 +253,15 @@ newdom.destroy
|
|
249
253
|
|
250
254
|
# TESTGROUP: dom.migrate_to_uri2
|
251
255
|
newdom = conn.create_domain_xml($new_dom_xml)
|
252
|
-
|
256
|
+
test_sleep 1
|
253
257
|
|
254
258
|
expect_too_many_args(newdom, "migrate_to_uri2", 1, 2, 3, 4, 5, 6, 7)
|
255
259
|
expect_invalid_arg_type(newdom, "migrate_to_uri2", 1)
|
256
|
-
expect_invalid_arg_type(newdom, "migrate_to_uri2",
|
257
|
-
expect_invalid_arg_type(newdom, "migrate_to_uri2",
|
258
|
-
expect_invalid_arg_type(newdom, "migrate_to_uri2",
|
259
|
-
expect_invalid_arg_type(newdom, "migrate_to_uri2",
|
260
|
-
expect_invalid_arg_type(newdom, "migrate_to_uri2",
|
260
|
+
expect_invalid_arg_type(newdom, "migrate_to_uri2", URI, 1)
|
261
|
+
expect_invalid_arg_type(newdom, "migrate_to_uri2", URI, 'foo', 1)
|
262
|
+
expect_invalid_arg_type(newdom, "migrate_to_uri2", URI, 'foo', 'bar', 'baz')
|
263
|
+
expect_invalid_arg_type(newdom, "migrate_to_uri2", URI, 'foo', 'bar', 0, 1)
|
264
|
+
expect_invalid_arg_type(newdom, "migrate_to_uri2", URI, 'foo', 'bar', 0, 'foo', 'baz')
|
261
265
|
|
262
266
|
#expect_success(newdom, "URI arg", "migrate_to_uri2", "qemu://remote/system")
|
263
267
|
|
@@ -267,7 +271,7 @@ newdom.destroy
|
|
267
271
|
|
268
272
|
# TESTGROUP: dom.migrate_set_max_speed
|
269
273
|
newdom = conn.create_domain_xml($new_dom_xml)
|
270
|
-
|
274
|
+
test_sleep 1
|
271
275
|
|
272
276
|
expect_too_many_args(newdom, "migrate_set_max_speed", 1, 2, 3)
|
273
277
|
expect_too_few_args(newdom, "migrate_set_max_speed")
|
@@ -279,38 +283,40 @@ expect_invalid_arg_type(newdom, "migrate_set_max_speed", 5, 'foo')
|
|
279
283
|
newdom.destroy
|
280
284
|
|
281
285
|
# TESTGROUP: dom.shutdown
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
286
|
+
if !test_default_uri?
|
287
|
+
newdom = conn.create_domain_xml($new_dom_xml)
|
288
|
+
test_sleep 1
|
289
|
+
|
290
|
+
expect_too_many_args(newdom, "shutdown", 1, 2)
|
291
|
+
expect_success(newdom, "no args", "shutdown")
|
292
|
+
sleep 1
|
293
|
+
newdom.destroy
|
294
|
+
end
|
289
295
|
|
290
296
|
# TESTGROUP: dom.reboot
|
291
297
|
newdom = conn.create_domain_xml($new_dom_xml)
|
292
|
-
|
298
|
+
test_sleep 1
|
293
299
|
expect_too_many_args(newdom, "reboot", 1, 2)
|
294
300
|
expect_invalid_arg_type(newdom, "reboot", "hello")
|
295
301
|
|
296
302
|
expect_success(newdom, "no args", "reboot")
|
297
|
-
|
303
|
+
test_sleep 1
|
298
304
|
|
299
305
|
expect_success(newdom, "flags arg", "reboot", 0)
|
300
|
-
|
306
|
+
test_sleep 1
|
301
307
|
|
302
308
|
newdom.destroy
|
303
309
|
|
304
310
|
# TESTGROUP: dom.destroy
|
305
311
|
newdom = conn.create_domain_xml($new_dom_xml)
|
306
|
-
|
312
|
+
test_sleep 1
|
307
313
|
|
308
314
|
expect_too_many_args(newdom, "destroy", 1, 2)
|
309
315
|
expect_success(newdom, "no args", "destroy")
|
310
316
|
|
311
317
|
# TESTGROUP: dom.suspend
|
312
318
|
newdom = conn.create_domain_xml($new_dom_xml)
|
313
|
-
|
319
|
+
test_sleep 1
|
314
320
|
|
315
321
|
expect_too_many_args(newdom, "suspend", 1)
|
316
322
|
expect_success(newdom, "no args", "suspend")
|
@@ -318,7 +324,7 @@ newdom.destroy
|
|
318
324
|
|
319
325
|
# TESTGROUP: dom.resume
|
320
326
|
newdom = conn.create_domain_xml($new_dom_xml)
|
321
|
-
|
327
|
+
test_sleep 1
|
322
328
|
|
323
329
|
expect_fail(newdom, Libvirt::Error, "already running", "resume")
|
324
330
|
|
@@ -328,33 +334,37 @@ expect_success(newdom, "no args suspended domain", "resume")
|
|
328
334
|
newdom.destroy
|
329
335
|
|
330
336
|
# TESTGROUP: dom.save
|
331
|
-
|
332
|
-
|
337
|
+
if !test_default_uri?
|
338
|
+
newdom = conn.create_domain_xml($new_dom_xml)
|
339
|
+
test_sleep 1
|
333
340
|
|
334
|
-
expect_too_many_args(newdom, "save", 1, 2, 3, 4)
|
335
|
-
expect_too_few_args(newdom, "save")
|
336
|
-
expect_invalid_arg_type(newdom, "save", 1)
|
337
|
-
expect_invalid_arg_type(newdom, "save", nil)
|
338
|
-
expect_fail(newdom, Libvirt::Error, "non-existent path", "save", "/this/path/does/not/exist")
|
341
|
+
expect_too_many_args(newdom, "save", 1, 2, 3, 4)
|
342
|
+
expect_too_few_args(newdom, "save")
|
343
|
+
expect_invalid_arg_type(newdom, "save", 1)
|
344
|
+
expect_invalid_arg_type(newdom, "save", nil)
|
345
|
+
expect_fail(newdom, Libvirt::Error, "non-existent path", "save", "/this/path/does/not/exist")
|
339
346
|
|
340
|
-
expect_success(newdom, "path arg", "save", $GUEST_SAVE)
|
347
|
+
expect_success(newdom, "path arg", "save", $GUEST_SAVE)
|
341
348
|
|
342
|
-
`rm -f #{$GUEST_SAVE}`
|
349
|
+
`rm -f #{$GUEST_SAVE}`
|
350
|
+
end
|
343
351
|
|
344
352
|
# TESTGROUP: dom.managed_save
|
345
|
-
|
346
|
-
newdom.
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
newdom
|
353
|
+
if !test_default_uri?
|
354
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
355
|
+
newdom.create
|
356
|
+
test_sleep 1
|
357
|
+
|
358
|
+
expect_too_many_args(newdom, "managed_save", 1, 2)
|
359
|
+
expect_invalid_arg_type(newdom, "managed_save", "hello")
|
360
|
+
expect_success(newdom, "no args", "managed_save")
|
361
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_MANAGED_SAVE)
|
362
|
+
end
|
353
363
|
|
354
364
|
# TESTGROUP: dom.has_managed_save?
|
355
365
|
newdom = conn.define_domain_xml($new_dom_xml)
|
356
366
|
newdom.create
|
357
|
-
|
367
|
+
test_sleep 1
|
358
368
|
|
359
369
|
expect_too_many_args(newdom, "has_managed_save?", 1, 2)
|
360
370
|
expect_invalid_arg_type(newdom, "has_managed_save?", "hello")
|
@@ -378,7 +388,7 @@ newdom.undefine(Libvirt::Domain::UNDEFINE_MANAGED_SAVE)
|
|
378
388
|
# TESTGROUP: dom.managed_save_remove
|
379
389
|
newdom = conn.define_domain_xml($new_dom_xml)
|
380
390
|
newdom.create
|
381
|
-
|
391
|
+
test_sleep 1
|
382
392
|
newdom.managed_save
|
383
393
|
|
384
394
|
expect_too_many_args(newdom, "managed_save_remove", 1, 2)
|
@@ -397,53 +407,57 @@ end
|
|
397
407
|
newdom.undefine
|
398
408
|
|
399
409
|
# TESTGROUP: dom.core_dump
|
400
|
-
|
401
|
-
newdom.
|
402
|
-
|
410
|
+
if !test_default_uri?
|
411
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
412
|
+
newdom.create
|
413
|
+
test_sleep 1
|
403
414
|
|
404
|
-
expect_too_many_args(newdom, "core_dump", 1, 2, 3)
|
405
|
-
expect_too_few_args(newdom, "core_dump")
|
406
|
-
expect_invalid_arg_type(newdom, "core_dump", 1, 2)
|
407
|
-
expect_invalid_arg_type(newdom, "core_dump", "/path", "foo")
|
408
|
-
expect_fail(newdom, Libvirt::Error, "invalid path", "core_dump", "/this/path/does/not/exist")
|
415
|
+
expect_too_many_args(newdom, "core_dump", 1, 2, 3)
|
416
|
+
expect_too_few_args(newdom, "core_dump")
|
417
|
+
expect_invalid_arg_type(newdom, "core_dump", 1, 2)
|
418
|
+
expect_invalid_arg_type(newdom, "core_dump", "/path", "foo")
|
419
|
+
expect_fail(newdom, Libvirt::Error, "invalid path", "core_dump", "/this/path/does/not/exist")
|
409
420
|
|
410
|
-
expect_success(newdom, "live with path arg", "core_dump", "/var/lib/libvirt/images/ruby-libvirt-test.core")
|
421
|
+
expect_success(newdom, "live with path arg", "core_dump", "/var/lib/libvirt/images/ruby-libvirt-test.core")
|
411
422
|
|
412
|
-
`rm -f /var/lib/libvirt/images/ruby-libvirt-test.core`
|
423
|
+
`rm -f /var/lib/libvirt/images/ruby-libvirt-test.core`
|
413
424
|
|
414
|
-
expect_success(newdom, "crash with path arg", "core_dump", "/var/lib/libvirt/images/ruby-libvirt-test.core", Libvirt::Domain::DUMP_CRASH)
|
425
|
+
expect_success(newdom, "crash with path arg", "core_dump", "/var/lib/libvirt/images/ruby-libvirt-test.core", Libvirt::Domain::DUMP_CRASH)
|
415
426
|
|
416
|
-
expect_fail(newdom, Libvirt::Error, "of shut-off domain", "core_dump", "/var/lib/libvirt/images/ruby-libvirt-test.core", Libvirt::Domain::DUMP_CRASH)
|
427
|
+
expect_fail(newdom, Libvirt::Error, "of shut-off domain", "core_dump", "/var/lib/libvirt/images/ruby-libvirt-test.core", Libvirt::Domain::DUMP_CRASH)
|
417
428
|
|
418
|
-
`rm -f /var/lib/libvirt/images/ruby-libvirt-test.core`
|
429
|
+
`rm -f /var/lib/libvirt/images/ruby-libvirt-test.core`
|
419
430
|
|
420
|
-
newdom.undefine
|
431
|
+
newdom.undefine
|
432
|
+
end
|
421
433
|
|
422
434
|
# TESTGROUP: Libvirt::Domain::restore
|
423
|
-
|
424
|
-
newdom.
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
expect_invalid_arg_type(Libvirt::Domain, "restore",
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
newdom.
|
435
|
+
if !test_default_uri?
|
436
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
437
|
+
newdom.create
|
438
|
+
test_sleep 1
|
439
|
+
newdom.save($GUEST_SAVE)
|
440
|
+
|
441
|
+
expect_too_many_args(Libvirt::Domain, "restore", 1, 2, 3)
|
442
|
+
expect_too_few_args(Libvirt::Domain, "restore")
|
443
|
+
expect_invalid_arg_type(Libvirt::Domain, "restore", 1, 2)
|
444
|
+
expect_invalid_arg_type(Libvirt::Domain, "restore", conn, 2)
|
445
|
+
expect_fail(Libvirt::Domain, Libvirt::Error, "invalid path", "restore", conn, "/this/path/does/not/exist")
|
446
|
+
`touch /tmp/foo`
|
447
|
+
expect_fail(Libvirt::Domain, Libvirt::Error, "invalid save file", "restore", conn, "/tmp/foo")
|
448
|
+
`rm -f /tmp/foo`
|
449
|
+
|
450
|
+
expect_success(Libvirt::Domain, "2 args", "restore", conn, $GUEST_SAVE)
|
451
|
+
|
452
|
+
`rm -f #{$GUEST_SAVE}`
|
453
|
+
|
454
|
+
newdom.destroy
|
455
|
+
newdom.undefine
|
456
|
+
end
|
443
457
|
|
444
458
|
# TESTGROUP: dom.info
|
445
459
|
newdom = conn.create_domain_xml($new_dom_xml)
|
446
|
-
|
460
|
+
test_sleep 1
|
447
461
|
|
448
462
|
expect_too_many_args(newdom, "info", 1)
|
449
463
|
|
@@ -453,7 +467,7 @@ newdom.destroy
|
|
453
467
|
|
454
468
|
# TESTGROUP: dom.security_label
|
455
469
|
newdom = conn.create_domain_xml($new_dom_xml)
|
456
|
-
|
470
|
+
test_sleep 1
|
457
471
|
|
458
472
|
expect_too_many_args(newdom, "security_label", 1)
|
459
473
|
|
@@ -463,7 +477,7 @@ newdom.destroy
|
|
463
477
|
|
464
478
|
# TESTGROUP: dom.block_stats
|
465
479
|
newdom = conn.create_domain_xml($new_dom_xml)
|
466
|
-
|
480
|
+
test_sleep 1
|
467
481
|
|
468
482
|
expect_too_many_args(newdom, "block_stats", 1, 2)
|
469
483
|
expect_too_few_args(newdom, "block_stats")
|
@@ -476,7 +490,7 @@ newdom.destroy
|
|
476
490
|
|
477
491
|
# TESTGROUP: dom.memory_stats
|
478
492
|
newdom = conn.create_domain_xml($new_dom_xml)
|
479
|
-
|
493
|
+
test_sleep 1
|
480
494
|
|
481
495
|
expect_too_many_args(newdom, "memory_stats", 1, 2)
|
482
496
|
expect_invalid_arg_type(newdom, "memory_stats", "foo")
|
@@ -487,7 +501,7 @@ newdom.destroy
|
|
487
501
|
|
488
502
|
# TESTGROUP: dom.blockinfo
|
489
503
|
newdom = conn.create_domain_xml($new_dom_xml)
|
490
|
-
|
504
|
+
test_sleep 1
|
491
505
|
|
492
506
|
expect_too_many_args(newdom, "blockinfo", 1, 2, 3)
|
493
507
|
expect_too_few_args(newdom, "blockinfo")
|
@@ -501,7 +515,7 @@ newdom.destroy
|
|
501
515
|
|
502
516
|
# TESTGROUP: dom.block_peek
|
503
517
|
newdom = conn.create_domain_xml($new_dom_xml)
|
504
|
-
|
518
|
+
test_sleep 1
|
505
519
|
|
506
520
|
expect_too_many_args(newdom, "block_peek", 1, 2, 3, 4, 5)
|
507
521
|
expect_too_few_args(newdom, "block_peek")
|
@@ -527,7 +541,7 @@ newdom.destroy
|
|
527
541
|
|
528
542
|
# TESTGROUP: dom.memory_peek
|
529
543
|
newdom = conn.create_domain_xml($new_dom_xml)
|
530
|
-
|
544
|
+
test_sleep 1
|
531
545
|
|
532
546
|
expect_too_many_args(newdom, "memory_peek", 1, 2, 3, 4)
|
533
547
|
expect_too_few_args(newdom, "memory_peek")
|
@@ -548,7 +562,7 @@ newdom = conn.define_domain_xml($new_dom_xml)
|
|
548
562
|
expect_success(newdom, "get_vcpus on shutoff domain", "get_vcpus") {|x| x.length == 2}
|
549
563
|
|
550
564
|
newdom.create
|
551
|
-
|
565
|
+
test_sleep 1
|
552
566
|
|
553
567
|
expect_success(newdom, "no args", "get_vcpus") {|x| x.length == 2}
|
554
568
|
|
@@ -563,7 +577,7 @@ newdom = conn.define_domain_xml($new_dom_xml)
|
|
563
577
|
expect_success(newdom, "no args", "active?") {|x| x == false}
|
564
578
|
|
565
579
|
newdom.create
|
566
|
-
|
580
|
+
test_sleep 1
|
567
581
|
|
568
582
|
expect_success(newdom, "no args", "active?") {|x| x == true}
|
569
583
|
|
@@ -572,7 +586,7 @@ newdom.undefine
|
|
572
586
|
|
573
587
|
# TESTGROUP: dom.persistent?
|
574
588
|
newdom = conn.create_domain_xml($new_dom_xml)
|
575
|
-
|
589
|
+
test_sleep 1
|
576
590
|
|
577
591
|
expect_too_many_args(newdom, "persistent?", 1)
|
578
592
|
|
@@ -588,7 +602,7 @@ newdom.undefine
|
|
588
602
|
|
589
603
|
# TESTGROUP: dom.ifinfo
|
590
604
|
newdom = conn.create_domain_xml($new_dom_xml)
|
591
|
-
|
605
|
+
test_sleep 1
|
592
606
|
|
593
607
|
expect_too_many_args(newdom, "ifinfo", 1, 2)
|
594
608
|
expect_too_few_args(newdom, "ifinfo")
|
@@ -601,7 +615,7 @@ newdom.destroy
|
|
601
615
|
|
602
616
|
# TESTGROUP: dom.name
|
603
617
|
newdom = conn.create_domain_xml($new_dom_xml)
|
604
|
-
|
618
|
+
test_sleep 1
|
605
619
|
|
606
620
|
expect_too_many_args(newdom, "name", 1)
|
607
621
|
|
@@ -612,7 +626,7 @@ newdom.destroy
|
|
612
626
|
|
613
627
|
# TESTGROUP: dom.id
|
614
628
|
newdom = conn.create_domain_xml($new_dom_xml)
|
615
|
-
|
629
|
+
test_sleep 1
|
616
630
|
|
617
631
|
expect_too_many_args(newdom, "id", 1)
|
618
632
|
|
@@ -622,7 +636,7 @@ newdom.destroy
|
|
622
636
|
|
623
637
|
# TESTGROUP: dom.uuid
|
624
638
|
newdom = conn.create_domain_xml($new_dom_xml)
|
625
|
-
|
639
|
+
test_sleep 1
|
626
640
|
|
627
641
|
expect_too_many_args(newdom, "uuid", 1)
|
628
642
|
|
@@ -632,17 +646,21 @@ newdom.destroy
|
|
632
646
|
|
633
647
|
# TESTGROUP: dom.os_type
|
634
648
|
newdom = conn.create_domain_xml($new_dom_xml)
|
635
|
-
|
649
|
+
test_sleep 1
|
636
650
|
|
637
651
|
expect_too_many_args(newdom, "os_type", 1)
|
638
652
|
|
639
|
-
|
653
|
+
if test_default_uri?
|
654
|
+
expect_success(newdom, "no args", "os_type") {|x| x == "linux"}
|
655
|
+
else
|
656
|
+
expect_success(newdom, "no args", "os_type") {|x| x == "hvm"}
|
657
|
+
end
|
640
658
|
|
641
659
|
newdom.destroy
|
642
660
|
|
643
661
|
# TESTGROUP: dom.max_memory
|
644
662
|
newdom = conn.create_domain_xml($new_dom_xml)
|
645
|
-
|
663
|
+
test_sleep 1
|
646
664
|
|
647
665
|
expect_too_many_args(newdom, "max_memory", 1)
|
648
666
|
|
@@ -674,7 +692,7 @@ expect_fail(newdom, Libvirt::Error, "shutoff domain", "memory=", [2, Libvirt::Do
|
|
674
692
|
newdom.undefine
|
675
693
|
|
676
694
|
newdom = conn.create_domain_xml($new_dom_xml)
|
677
|
-
|
695
|
+
test_sleep 1
|
678
696
|
|
679
697
|
expect_success(newdom, "number arg", "memory=", 200000)
|
680
698
|
|
@@ -682,7 +700,7 @@ newdom.destroy
|
|
682
700
|
|
683
701
|
# TESTGROUP: dom.max_vcpus
|
684
702
|
newdom = conn.create_domain_xml($new_dom_xml)
|
685
|
-
|
703
|
+
test_sleep 1
|
686
704
|
|
687
705
|
expect_too_many_args(newdom, "max_vcpus", 1)
|
688
706
|
|
@@ -703,7 +721,7 @@ expect_fail(newdom, Libvirt::Error, "shutoff domain", "vcpus=", [2, Libvirt::Dom
|
|
703
721
|
newdom.undefine
|
704
722
|
|
705
723
|
newdom = conn.create_domain_xml($new_dom_xml)
|
706
|
-
|
724
|
+
test_sleep 1
|
707
725
|
|
708
726
|
expect_success(newdom, "number arg", "vcpus=", 2)
|
709
727
|
|
@@ -711,7 +729,7 @@ newdom.destroy
|
|
711
729
|
|
712
730
|
# TESTGROUP: dom.pin_vcpu
|
713
731
|
newdom = conn.create_domain_xml($new_dom_xml)
|
714
|
-
|
732
|
+
test_sleep 1
|
715
733
|
|
716
734
|
expect_too_many_args(newdom, "pin_vcpu", 1, 2, 3, 4)
|
717
735
|
expect_too_few_args(newdom, "pin_vcpu")
|
@@ -724,7 +742,7 @@ newdom.destroy
|
|
724
742
|
|
725
743
|
# TESTGROUP: dom.xml_desc
|
726
744
|
newdom = conn.create_domain_xml($new_dom_xml)
|
727
|
-
|
745
|
+
test_sleep 1
|
728
746
|
|
729
747
|
expect_too_many_args(newdom, "xml_desc", 1, 2)
|
730
748
|
expect_invalid_arg_type(newdom, "xml_desc", "foo")
|
@@ -803,7 +821,7 @@ expect_fail(newdom, Libvirt::Error, "shut off domain", "attach_device", new_host
|
|
803
821
|
newdom.undefine
|
804
822
|
|
805
823
|
newdom = conn.create_domain_xml($new_dom_xml)
|
806
|
-
|
824
|
+
test_sleep 1
|
807
825
|
|
808
826
|
#expect_success(newdom, "hostdev XML", "attach_device", new_hostdev_xml)
|
809
827
|
|
@@ -822,7 +840,7 @@ expect_fail(newdom, Libvirt::Error, "shut off domain", "detach_device", new_host
|
|
822
840
|
newdom.undefine
|
823
841
|
|
824
842
|
newdom = conn.create_domain_xml($new_dom_xml)
|
825
|
-
|
843
|
+
test_sleep 1
|
826
844
|
|
827
845
|
#expect_success(newdom, "hostdev XML", "detach_device", new_hostdev_xml)
|
828
846
|
|
@@ -841,7 +859,7 @@ expect_fail(newdom, Libvirt::Error, "shut off domain", "update_device", new_host
|
|
841
859
|
newdom.undefine
|
842
860
|
|
843
861
|
newdom = conn.create_domain_xml($new_dom_xml)
|
844
|
-
|
862
|
+
test_sleep 1
|
845
863
|
|
846
864
|
#expect_success(newdom, "hostdev XML", "update_device", new_hostdev_xml)
|
847
865
|
|
@@ -940,7 +958,7 @@ expect_invalid_arg_type(newdom, "revert_to_snapshot", nil)
|
|
940
958
|
expect_invalid_arg_type(newdom, "revert_to_snapshot", 'foo')
|
941
959
|
|
942
960
|
snap = newdom.snapshot_create_xml("<domainsnapshot><name>foo</name></domainsnapshot>")
|
943
|
-
|
961
|
+
test_sleep 1
|
944
962
|
|
945
963
|
expect_invalid_arg_type(newdom, "revert_to_snapshot", snap, 'foo')
|
946
964
|
|
@@ -962,20 +980,22 @@ expect_success(newdom, "no args", "current_snapshot")
|
|
962
980
|
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
963
981
|
|
964
982
|
# TESTGROUP: dom.job_info
|
965
|
-
|
983
|
+
if !test_default_uri?
|
984
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
966
985
|
|
967
|
-
expect_too_many_args(newdom, "job_info", 1)
|
986
|
+
expect_too_many_args(newdom, "job_info", 1)
|
968
987
|
|
969
|
-
expect_fail(newdom, Libvirt::RetrieveError, "shutoff domain", "job_info")
|
988
|
+
expect_fail(newdom, Libvirt::RetrieveError, "shutoff domain", "job_info")
|
970
989
|
|
971
|
-
newdom.undefine
|
990
|
+
newdom.undefine
|
972
991
|
|
973
|
-
newdom = conn.create_domain_xml($new_dom_xml)
|
974
|
-
|
992
|
+
newdom = conn.create_domain_xml($new_dom_xml)
|
993
|
+
test_sleep 1
|
975
994
|
|
976
|
-
expect_success(newdom, "no args", "job_info")
|
995
|
+
expect_success(newdom, "no args", "job_info")
|
977
996
|
|
978
|
-
newdom.destroy
|
997
|
+
newdom.destroy
|
998
|
+
end
|
979
999
|
|
980
1000
|
# TESTGROUP: dom.abort_job
|
981
1001
|
newdom = conn.define_domain_xml($new_dom_xml)
|
@@ -987,7 +1007,7 @@ expect_fail(newdom, Libvirt::Error, "not running domain", "abort_job")
|
|
987
1007
|
newdom.undefine
|
988
1008
|
|
989
1009
|
newdom = conn.create_domain_xml($new_dom_xml)
|
990
|
-
|
1010
|
+
test_sleep 1
|
991
1011
|
|
992
1012
|
expect_fail(newdom, Libvirt::Error, "no active job", "abort_job")
|
993
1013
|
|
@@ -1021,57 +1041,26 @@ expect_too_many_args(newdom, "scheduler_parameters=", 1, 2)
|
|
1021
1041
|
expect_too_few_args(newdom, "scheduler_parameters=")
|
1022
1042
|
expect_invalid_arg_type(newdom, "scheduler_parameters=", 0)
|
1023
1043
|
|
1024
|
-
|
1044
|
+
if !test_default_uri?
|
1045
|
+
expect_success(newdom, "cpu shares arg", "scheduler_parameters=", {"cpu_shares" => 512})
|
1046
|
+
end
|
1025
1047
|
|
1026
1048
|
newdom.undefine
|
1027
1049
|
|
1028
1050
|
# TESTGROUP: dom.qemu_monitor_command
|
1029
|
-
|
1030
|
-
|
1031
|
-
<name>fc4</name>
|
1032
|
-
<uuid>EF86180145B911CB88E3AFBFE5370493</uuid>
|
1033
|
-
<os>
|
1034
|
-
<type>xen</type>
|
1035
|
-
<kernel>/boot/vmlinuz-2.6.15-1.43_FC5guest</kernel>
|
1036
|
-
<initrd>/boot/initrd-2.6.15-1.43_FC5guest.img</initrd>
|
1037
|
-
<root>/dev/sda1</root>
|
1038
|
-
<cmdline> ro selinux=0 3</cmdline>
|
1039
|
-
</os>
|
1040
|
-
<memory>261072</memory>
|
1041
|
-
<currentMemory>131072</currentMemory>
|
1042
|
-
<vcpu>1</vcpu>
|
1043
|
-
<devices>
|
1044
|
-
<disk type='file'>
|
1045
|
-
<source file='/u/fc4.img'/>
|
1046
|
-
<target dev='sda1'/>
|
1047
|
-
</disk>
|
1048
|
-
<interface type='bridge'>
|
1049
|
-
<source bridge='xenbr0'/>
|
1050
|
-
<mac address='aa:00:00:00:00:11'/>
|
1051
|
-
<script path='/etc/xen/scripts/vif-bridge'/>
|
1052
|
-
</interface>
|
1053
|
-
<console tty='/dev/pts/5'/>
|
1054
|
-
</devices>
|
1055
|
-
</domain>
|
1056
|
-
EOF
|
1051
|
+
if !test_default_uri?
|
1052
|
+
newdom = conn.create_domain_xml($new_dom_xml)
|
1057
1053
|
|
1058
|
-
newdom
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
expect_invalid_arg_type(newdom, "qemu_monitor_command", "foo", "bar")
|
1064
|
-
# FIXME: the test driver doesn't support virDomainDestroyFlags() presently
|
1065
|
-
#testconn = Libvirt::open("test:///default")
|
1066
|
-
#fakedom = testconn.create_domain_xml(new_test_xml)
|
1067
|
-
#expect_invalid_arg_type(fakedom, "qemu_monitor_command", "foo")
|
1068
|
-
#fakedom.destroy
|
1069
|
-
#testconn.close
|
1070
|
-
expect_fail(newdom, Libvirt::RetrieveError, "invalid command", "qemu_monitor_command", "foo")
|
1054
|
+
expect_too_many_args(newdom, "qemu_monitor_command", 1, 2, 3)
|
1055
|
+
expect_too_few_args(newdom, "qemu_monitor_command")
|
1056
|
+
expect_invalid_arg_type(newdom, "qemu_monitor_command", 1)
|
1057
|
+
expect_invalid_arg_type(newdom, "qemu_monitor_command", "foo", "bar")
|
1058
|
+
expect_fail(newdom, Libvirt::RetrieveError, "invalid command", "qemu_monitor_command", "foo")
|
1071
1059
|
|
1072
|
-
expect_success(newdom, "monitor command", "qemu_monitor_command", '{"execute":"query-cpus"}')
|
1060
|
+
expect_success(newdom, "monitor command", "qemu_monitor_command", '{"execute":"query-cpus"}')
|
1073
1061
|
|
1074
|
-
newdom.destroy
|
1062
|
+
newdom.destroy
|
1063
|
+
end
|
1075
1064
|
|
1076
1065
|
# TESTGROUP: dom.num_vcpus
|
1077
1066
|
newdom = conn.define_domain_xml($new_dom_xml)
|
@@ -1086,7 +1075,7 @@ expect_success(newdom, "config flag", "num_vcpus", Libvirt::Domain::VCPU_CONFIG)
|
|
1086
1075
|
newdom.undefine
|
1087
1076
|
|
1088
1077
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1089
|
-
|
1078
|
+
test_sleep 1
|
1090
1079
|
|
1091
1080
|
expect_fail(newdom, Libvirt::RetrieveError, "config flag on transient domain", "num_vcpus", Libvirt::Domain::VCPU_CONFIG)
|
1092
1081
|
expect_success(newdom, "live flag on transient domain", "num_vcpus", Libvirt::Domain::VCPU_LIVE)
|
@@ -1190,7 +1179,7 @@ expect_fail(newdom, Libvirt::Error, "on off domain, two args", "migrate_max_down
|
|
1190
1179
|
newdom.undefine
|
1191
1180
|
|
1192
1181
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1193
|
-
|
1182
|
+
test_sleep 1
|
1194
1183
|
#expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_max_downtime=", 10)
|
1195
1184
|
|
1196
1185
|
# FIXME: get this working
|
@@ -1201,7 +1190,7 @@ newdom.destroy
|
|
1201
1190
|
|
1202
1191
|
# TESTGROUP: dom.migrate_max_speed=
|
1203
1192
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1204
|
-
|
1193
|
+
test_sleep 1
|
1205
1194
|
|
1206
1195
|
expect_too_many_args(newdom, "migrate_max_speed=", 1, 2)
|
1207
1196
|
expect_too_many_args(newdom, "migrate_max_speed=", [1, 2, 3])
|
@@ -1218,7 +1207,7 @@ newdom.destroy
|
|
1218
1207
|
|
1219
1208
|
# TESTGROUP: dom.state
|
1220
1209
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1221
|
-
|
1210
|
+
test_sleep 1
|
1222
1211
|
|
1223
1212
|
expect_too_many_args(newdom, "state", 1, 2)
|
1224
1213
|
expect_invalid_arg_type(newdom, "state", 'foo')
|
@@ -1229,7 +1218,7 @@ newdom.destroy
|
|
1229
1218
|
|
1230
1219
|
# TESTGROUP: dom.screenshot
|
1231
1220
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1232
|
-
|
1221
|
+
test_sleep 1
|
1233
1222
|
|
1234
1223
|
stream = conn.stream
|
1235
1224
|
|
@@ -1259,7 +1248,7 @@ expect_fail(newdom, Libvirt::Error, "shutoff domain", "vcpus_flags=", [2, Libvir
|
|
1259
1248
|
newdom.undefine
|
1260
1249
|
|
1261
1250
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1262
|
-
|
1251
|
+
test_sleep 1
|
1263
1252
|
|
1264
1253
|
expect_success(newdom, "number arg", "vcpus_flags=", 2)
|
1265
1254
|
|
@@ -1275,11 +1264,11 @@ expect_invalid_arg_type(newdom, "list_all_snapshots", 'foo')
|
|
1275
1264
|
expect_success(newdom, "no args", "list_all_snapshots")
|
1276
1265
|
|
1277
1266
|
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1278
|
-
|
1267
|
+
test_sleep 1
|
1279
1268
|
|
1280
1269
|
# TESTGROUP: domain.open_graphics
|
1281
1270
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1282
|
-
|
1271
|
+
test_sleep 1
|
1283
1272
|
|
1284
1273
|
expect_too_many_args(newdom, "open_graphics", 1, 2, 3, 4)
|
1285
1274
|
expect_too_few_args(newdom, "open_graphics")
|
@@ -1308,135 +1297,155 @@ expect_invalid_arg_type(snap, "xml_desc", 'foo')
|
|
1308
1297
|
expect_success(newdom, "no args", "xml_desc")
|
1309
1298
|
|
1310
1299
|
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1311
|
-
|
1300
|
+
test_sleep 1
|
1312
1301
|
|
1313
1302
|
# TESTGROUP: snapshot.delete
|
1314
|
-
|
1315
|
-
|
1303
|
+
if !test_default_uri?
|
1304
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1305
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1316
1306
|
|
1317
|
-
expect_too_many_args(snap, "delete", 1, 2)
|
1318
|
-
expect_invalid_arg_type(snap, "delete", 'foo')
|
1307
|
+
expect_too_many_args(snap, "delete", 1, 2)
|
1308
|
+
expect_invalid_arg_type(snap, "delete", 'foo')
|
1319
1309
|
|
1320
|
-
expect_success(snap, "no args", "delete")
|
1310
|
+
expect_success(snap, "no args", "delete")
|
1321
1311
|
|
1322
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1323
|
-
|
1312
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1313
|
+
test_sleep 1
|
1314
|
+
end
|
1324
1315
|
|
1325
1316
|
# TESTGROUP: snapshot.name
|
1326
|
-
|
1327
|
-
|
1317
|
+
if !test_default_uri?
|
1318
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1319
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1328
1320
|
|
1329
|
-
expect_too_many_args(snap, "name", 1)
|
1321
|
+
expect_too_many_args(snap, "name", 1)
|
1330
1322
|
|
1331
|
-
expect_success(snap, "no args", "name")
|
1323
|
+
expect_success(snap, "no args", "name")
|
1332
1324
|
|
1333
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1334
|
-
|
1325
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1326
|
+
test_sleep 1
|
1327
|
+
end
|
1335
1328
|
|
1336
1329
|
# TESTGROUP: snapshot.num_children
|
1337
|
-
|
1338
|
-
|
1330
|
+
if !test_default_uri?
|
1331
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1332
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1339
1333
|
|
1340
|
-
expect_too_many_args(snap, "num_children", 1, 2)
|
1334
|
+
expect_too_many_args(snap, "num_children", 1, 2)
|
1341
1335
|
|
1342
|
-
expect_success(snap, "no args, no children", "num_children") {|x| x == 0}
|
1336
|
+
expect_success(snap, "no args, no children", "num_children") {|x| x == 0}
|
1343
1337
|
|
1344
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1345
|
-
|
1338
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1339
|
+
test_sleep 1
|
1340
|
+
end
|
1346
1341
|
|
1347
1342
|
# TESTGROUP: snapshot.list_children_names
|
1348
|
-
|
1349
|
-
|
1343
|
+
if !test_default_uri?
|
1344
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1345
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1350
1346
|
|
1351
|
-
expect_too_many_args(snap, "list_children_names", 1, 2)
|
1347
|
+
expect_too_many_args(snap, "list_children_names", 1, 2)
|
1352
1348
|
|
1353
|
-
expect_success(snap, "no args, no children", "num_children") {|x| x == 0}
|
1349
|
+
expect_success(snap, "no args, no children", "num_children") {|x| x == 0}
|
1354
1350
|
|
1355
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1356
|
-
|
1351
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1352
|
+
test_sleep 1
|
1353
|
+
end
|
1357
1354
|
|
1358
1355
|
# TESTGROUP: snapshot.free
|
1359
|
-
|
1360
|
-
|
1356
|
+
if !test_default_uri?
|
1357
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1358
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1361
1359
|
|
1362
|
-
expect_too_many_args(snap, "free", 1)
|
1360
|
+
expect_too_many_args(snap, "free", 1)
|
1363
1361
|
|
1364
|
-
expect_success(snap, "no args", "free")
|
1362
|
+
expect_success(snap, "no args", "free")
|
1365
1363
|
|
1366
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1367
|
-
|
1364
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1365
|
+
test_sleep 1
|
1366
|
+
end
|
1368
1367
|
|
1369
1368
|
# TESTGROUP: snapshot.has_metadata?
|
1370
|
-
|
1371
|
-
|
1369
|
+
if !test_default_uri?
|
1370
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1371
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1372
1372
|
|
1373
|
-
expect_too_many_args(snap, "has_metadata?", 1, 2)
|
1374
|
-
expect_invalid_arg_type(snap, "has_metadata?", "foo")
|
1373
|
+
expect_too_many_args(snap, "has_metadata?", 1, 2)
|
1374
|
+
expect_invalid_arg_type(snap, "has_metadata?", "foo")
|
1375
1375
|
|
1376
|
-
expect_success(snap, "no args", "has_metadata?") {|x| x == true}
|
1376
|
+
expect_success(snap, "no args", "has_metadata?") {|x| x == true}
|
1377
1377
|
|
1378
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1379
|
-
|
1378
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1379
|
+
test_sleep 1
|
1380
|
+
end
|
1380
1381
|
|
1381
1382
|
# TESTGROUP: snapshot.list_children_names
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1383
|
+
if !test_default_uri?
|
1384
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1385
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot><name>snap</name></domainsnapshot>")
|
1386
|
+
snap2 = newdom.snapshot_create_xml("<domainsnapshot><name>snap2</name></domainsnapshot>")
|
1385
1387
|
|
1386
|
-
expect_too_many_args(snap, "list_children_names", 1, 2)
|
1387
|
-
expect_invalid_arg_type(snap, "list_children_names", "foo")
|
1388
|
-
expect_invalid_arg_type(snap, "list_children_names", [])
|
1389
|
-
expect_invalid_arg_type(snap, "list_children_names", {})
|
1388
|
+
expect_too_many_args(snap, "list_children_names", 1, 2)
|
1389
|
+
expect_invalid_arg_type(snap, "list_children_names", "foo")
|
1390
|
+
expect_invalid_arg_type(snap, "list_children_names", [])
|
1391
|
+
expect_invalid_arg_type(snap, "list_children_names", {})
|
1390
1392
|
|
1391
|
-
expect_success(snap, "no args", "list_children_names")
|
1393
|
+
expect_success(snap, "no args", "list_children_names")
|
1392
1394
|
|
1393
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1394
|
-
|
1395
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1396
|
+
test_sleep 1
|
1397
|
+
end
|
1395
1398
|
|
1396
1399
|
# TESTGROUP: snapshot.list_all_children
|
1397
|
-
|
1398
|
-
|
1400
|
+
if !test_default_uri?
|
1401
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1402
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1399
1403
|
|
1400
|
-
expect_too_many_args(snap, "list_all_children", 1, 2)
|
1401
|
-
expect_invalid_arg_type(snap, "list_all_children", "foo")
|
1402
|
-
expect_invalid_arg_type(snap, "list_all_children", [])
|
1403
|
-
expect_invalid_arg_type(snap, "list_all_children", {})
|
1404
|
+
expect_too_many_args(snap, "list_all_children", 1, 2)
|
1405
|
+
expect_invalid_arg_type(snap, "list_all_children", "foo")
|
1406
|
+
expect_invalid_arg_type(snap, "list_all_children", [])
|
1407
|
+
expect_invalid_arg_type(snap, "list_all_children", {})
|
1404
1408
|
|
1405
|
-
expect_success(snap, "no args", "list_all_children")
|
1409
|
+
expect_success(snap, "no args", "list_all_children")
|
1406
1410
|
|
1407
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1408
|
-
|
1411
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1412
|
+
test_sleep 1
|
1413
|
+
end
|
1409
1414
|
|
1410
1415
|
# TESTGROUP: snapshot.parent
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
expect_invalid_arg_type(snap2, "parent",
|
1419
|
-
expect_invalid_arg_type(snap2, "parent",
|
1420
|
-
|
1421
|
-
|
1422
|
-
expect_success(
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1416
|
+
if !test_default_uri?
|
1417
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1418
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1419
|
+
test_sleep 1
|
1420
|
+
snap2 = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1421
|
+
|
1422
|
+
expect_too_many_args(snap2, "parent", 1, 2)
|
1423
|
+
expect_invalid_arg_type(snap2, "parent", "foo")
|
1424
|
+
expect_invalid_arg_type(snap2, "parent", [])
|
1425
|
+
expect_invalid_arg_type(snap2, "parent", {})
|
1426
|
+
|
1427
|
+
expect_success(snap2, "no args", "parent")
|
1428
|
+
expect_success(snap, "no args", "parent")
|
1429
|
+
|
1430
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1431
|
+
test_sleep 1
|
1432
|
+
end
|
1426
1433
|
|
1427
1434
|
# TESTGROUP: snapshot.current?
|
1428
|
-
|
1429
|
-
|
1435
|
+
if !test_default_uri?
|
1436
|
+
newdom = conn.define_domain_xml($new_dom_xml)
|
1437
|
+
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1430
1438
|
|
1431
|
-
expect_too_many_args(snap, "current?", 1, 2)
|
1432
|
-
expect_invalid_arg_type(snap, "current?", "foo")
|
1433
|
-
expect_invalid_arg_type(snap, "current?", [])
|
1434
|
-
expect_invalid_arg_type(snap, "current?", {})
|
1439
|
+
expect_too_many_args(snap, "current?", 1, 2)
|
1440
|
+
expect_invalid_arg_type(snap, "current?", "foo")
|
1441
|
+
expect_invalid_arg_type(snap, "current?", [])
|
1442
|
+
expect_invalid_arg_type(snap, "current?", {})
|
1435
1443
|
|
1436
|
-
expect_success(snap, "no args", "current?")
|
1444
|
+
expect_success(snap, "no args", "current?")
|
1437
1445
|
|
1438
|
-
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1439
|
-
|
1446
|
+
newdom.undefine(Libvirt::Domain::UNDEFINE_SNAPSHOTS_METADATA)
|
1447
|
+
test_sleep 1
|
1448
|
+
end
|
1440
1449
|
|
1441
1450
|
# END TESTS
|
1442
1451
|
|