ruby-libvirt 0.5.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/COPYING +1 -1
- data/NEWS +38 -2
- data/Rakefile +3 -4
- data/ext/libvirt/_libvirt.c +8 -8
- data/ext/libvirt/common.c +27 -13
- data/ext/libvirt/common.h +12 -2
- data/ext/libvirt/connect.c +336 -159
- data/ext/libvirt/domain.c +571 -185
- data/ext/libvirt/extconf.h +393 -0
- data/ext/libvirt/extconf.rb +53 -44
- data/ext/libvirt/interface.c +15 -15
- data/ext/libvirt/network.c +120 -19
- data/ext/libvirt/nodedevice.c +19 -19
- data/ext/libvirt/nwfilter.c +10 -10
- data/ext/libvirt/secret.c +18 -18
- data/ext/libvirt/storage.c +90 -62
- data/ext/libvirt/stream.c +15 -15
- data/tests/test_conn.rb +13 -15
- data/tests/test_domain.rb +18 -13
- data/tests/test_interface.rb +4 -4
- data/tests/test_network.rb +1 -1
- data/tests/test_nwfilter.rb +1 -1
- data/tests/test_storage.rb +5 -5
- data/tests/test_stream.rb +1 -1
- data/tests/test_utils.rb +29 -10
- metadata +14 -14
data/tests/test_conn.rb
CHANGED
@@ -16,8 +16,8 @@ cleanup_test_network(conn)
|
|
16
16
|
|
17
17
|
# test setup
|
18
18
|
begin
|
19
|
-
`rm -f /etc/sysconfig/network-scripts/ifcfg-
|
20
|
-
`brctl delbr
|
19
|
+
`rm -f /etc/sysconfig/network-scripts/ifcfg-rb-libvirt-test`
|
20
|
+
`brctl delbr rb-libvirt-test >& /dev/null`
|
21
21
|
rescue
|
22
22
|
end
|
23
23
|
`qemu-img create -f qcow2 #{$GUEST_DISK} 5G`
|
@@ -129,7 +129,7 @@ expect_fail(conn, ArgumentError, "empty array", "baseline_cpu", [])
|
|
129
129
|
expect_success(conn, "CPU XML", "baseline_cpu", [cpu_xml])
|
130
130
|
|
131
131
|
# TESTGROUP: conn.domain_event_register_any
|
132
|
-
dom_event_callback_proc = lambda {|
|
132
|
+
dom_event_callback_proc = lambda {|connect, dom, event, detail, opaque|
|
133
133
|
}
|
134
134
|
|
135
135
|
# def dom_event_callback_symbol(conn, dom, event, detail, opaque)
|
@@ -256,11 +256,11 @@ expect_too_few_args(conn, "lookup_domain_by_name")
|
|
256
256
|
expect_invalid_arg_type(conn, "lookup_domain_by_name", 1)
|
257
257
|
expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_domain_by_name", "foobarbazsucker")
|
258
258
|
|
259
|
-
expect_success(conn, "name arg for running domain", "lookup_domain_by_name", "
|
259
|
+
expect_success(conn, "name arg for running domain", "lookup_domain_by_name", "rb-libvirt-test") {|x| x.name == "rb-libvirt-test"}
|
260
260
|
newdom.destroy
|
261
261
|
|
262
262
|
newdom = conn.define_domain_xml($new_dom_xml)
|
263
|
-
expect_success(conn, "name arg for defined domain", "lookup_domain_by_name", "
|
263
|
+
expect_success(conn, "name arg for defined domain", "lookup_domain_by_name", "rb-libvirt-test") {|x| x.name == "rb-libvirt-test"}
|
264
264
|
newdom.undefine
|
265
265
|
|
266
266
|
# TESTGROUP: conn.lookup_domain_by_id
|
@@ -292,7 +292,7 @@ expect_success(conn, "UUID arg for defined domain", "lookup_domain_by_uuid", new
|
|
292
292
|
newdom.undefine
|
293
293
|
|
294
294
|
# TESTGROUP: conn.define_domain_xml
|
295
|
-
expect_too_many_args(conn, "define_domain_xml", 1, 2)
|
295
|
+
expect_too_many_args(conn, "define_domain_xml", 1, 2, 3)
|
296
296
|
expect_too_few_args(conn, "define_domain_xml")
|
297
297
|
expect_invalid_arg_type(conn, "define_domain_xml", 1)
|
298
298
|
expect_invalid_arg_type(conn, "define_domain_xml", nil)
|
@@ -351,11 +351,9 @@ expect_too_few_args(conn, "lookup_interface_by_name")
|
|
351
351
|
expect_invalid_arg_type(conn, "lookup_interface_by_name", 1)
|
352
352
|
expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_interface_by_name", "foobarbazsucker")
|
353
353
|
|
354
|
-
expect_success(conn, "name arg", "lookup_interface_by_name", "
|
354
|
+
expect_success(conn, "name arg", "lookup_interface_by_name", "rb-libvirt-test")
|
355
355
|
|
356
|
-
|
357
|
-
|
358
|
-
expect_success(conn, "name arg", "lookup_interface_by_name", "ruby-libvirt-tester")
|
356
|
+
expect_success(conn, "name arg", "lookup_interface_by_name", "rb-libvirt-test")
|
359
357
|
|
360
358
|
newiface.undefine
|
361
359
|
|
@@ -408,11 +406,11 @@ expect_too_few_args(conn, "lookup_network_by_name")
|
|
408
406
|
expect_invalid_arg_type(conn, "lookup_network_by_name", 1)
|
409
407
|
expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_network_by_name", "foobarbazsucker")
|
410
408
|
|
411
|
-
expect_success(conn, "name arg", "lookup_network_by_name", "
|
409
|
+
expect_success(conn, "name arg", "lookup_network_by_name", "rb-libvirt-test")
|
412
410
|
newnet.destroy
|
413
411
|
|
414
412
|
newnet = conn.define_network_xml($new_net_xml)
|
415
|
-
expect_success(conn, "name arg", "lookup_network_by_name", "
|
413
|
+
expect_success(conn, "name arg", "lookup_network_by_name", "rb-libvirt-test")
|
416
414
|
newnet.undefine
|
417
415
|
|
418
416
|
# TESTGROUP: conn.lookup_network_by_uuid
|
@@ -499,7 +497,7 @@ expect_too_many_args(conn, "lookup_nwfilter_by_name", 1, 2)
|
|
499
497
|
expect_too_few_args(conn, "lookup_nwfilter_by_name")
|
500
498
|
expect_invalid_arg_type(conn, "lookup_nwfilter_by_name", 1)
|
501
499
|
|
502
|
-
expect_success(conn, "name arg", "lookup_nwfilter_by_name", "
|
500
|
+
expect_success(conn, "name arg", "lookup_nwfilter_by_name", "rb-libvirt-test")
|
503
501
|
|
504
502
|
newnw.undefine
|
505
503
|
|
@@ -593,12 +591,12 @@ expect_too_few_args(conn, "lookup_storage_pool_by_name")
|
|
593
591
|
expect_invalid_arg_type(conn, "lookup_storage_pool_by_name", 1)
|
594
592
|
expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_storage_pool_by_name", "foobarbazsucker")
|
595
593
|
|
596
|
-
expect_success(conn, "name arg", "lookup_storage_pool_by_name", "
|
594
|
+
expect_success(conn, "name arg", "lookup_storage_pool_by_name", "rb-libvirt-test")
|
597
595
|
|
598
596
|
newpool.destroy
|
599
597
|
|
600
598
|
newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
|
601
|
-
expect_success(conn, "name arg", "lookup_storage_pool_by_name", "
|
599
|
+
expect_success(conn, "name arg", "lookup_storage_pool_by_name", "rb-libvirt-test")
|
602
600
|
newpool.undefine
|
603
601
|
|
604
602
|
# TESTGROUP: conn.lookup_storage_pool_by_uuid
|
data/tests/test_domain.rb
CHANGED
@@ -19,6 +19,8 @@ cleanup_test_domain(conn)
|
|
19
19
|
|
20
20
|
# setup for later tests
|
21
21
|
`qemu-img create -f qcow2 #{$GUEST_DISK} 5G`
|
22
|
+
`qemu-img create -f raw #{$GUEST_RAW_DISK} 5G`
|
23
|
+
|
22
24
|
|
23
25
|
new_hostdev_xml = <<EOF
|
24
26
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
@@ -147,7 +149,7 @@ newdom.destroy
|
|
147
149
|
|
148
150
|
# TESTGROUP: dom.send_key
|
149
151
|
newdom = conn.create_domain_xml($new_dom_xml)
|
150
|
-
sleep
|
152
|
+
sleep 1
|
151
153
|
|
152
154
|
expect_too_many_args(newdom, "send_key", 1, 2, 3, 4)
|
153
155
|
expect_too_few_args(newdom, "send_key")
|
@@ -220,7 +222,7 @@ newdom.undefine
|
|
220
222
|
|
221
223
|
newdom = conn.create_domain_xml($new_dom_xml)
|
222
224
|
sleep 1
|
223
|
-
expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_set_max_downtime", 10)
|
225
|
+
#expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_set_max_downtime", 10)
|
224
226
|
|
225
227
|
#newdom.migrate_to_uri("qemu://remote/system")
|
226
228
|
#expect_success(newdom, "10 second downtime", "migrate_set_max_downtime", 10)
|
@@ -318,7 +320,7 @@ newdom.destroy
|
|
318
320
|
newdom = conn.create_domain_xml($new_dom_xml)
|
319
321
|
sleep 1
|
320
322
|
|
321
|
-
|
323
|
+
expect_fail(newdom, Libvirt::Error, "already running", "resume")
|
322
324
|
|
323
325
|
newdom.suspend
|
324
326
|
expect_too_many_args(newdom, "resume", 1)
|
@@ -511,15 +513,15 @@ expect_invalid_arg_type(newdom, "block_peek", "foo", 0, "bar")
|
|
511
513
|
expect_invalid_arg_type(newdom, "block_peek", "foo", 0, 512, "baz")
|
512
514
|
expect_fail(newdom, Libvirt::RetrieveError, "invalid path", "block_peek", "foo", 0, 512)
|
513
515
|
|
514
|
-
blockpeek = newdom.block_peek($
|
516
|
+
# blockpeek = newdom.block_peek($GUEST_RAW_DISK, 0, 512)
|
515
517
|
|
516
|
-
# 0x51 0x46 0x49 0xfb are the first 4 bytes of a qcow2 image
|
517
|
-
if blockpeek[0].unpack('C')[0] != 0x51 or blockpeek[1].unpack('C')[0] != 0x46 or
|
518
|
-
|
519
|
-
|
520
|
-
else
|
521
|
-
|
522
|
-
end
|
518
|
+
# # 0x51 0x46 0x49 0xfb are the first 4 bytes of a qcow2 image
|
519
|
+
# if blockpeek[0].unpack('C')[0] != 0x51 or blockpeek[1].unpack('C')[0] != 0x46 or
|
520
|
+
# blockpeek[2].unpack('C')[0] != 0x49 or blockpeek[3].unpack('C')[0] != 0xfb
|
521
|
+
# puts_fail "domain.block_peek read did not return valid data"
|
522
|
+
# else
|
523
|
+
# puts_ok "domain.block_peek read valid data"
|
524
|
+
# end
|
523
525
|
|
524
526
|
newdom.destroy
|
525
527
|
|
@@ -603,7 +605,8 @@ sleep 1
|
|
603
605
|
|
604
606
|
expect_too_many_args(newdom, "name", 1)
|
605
607
|
|
606
|
-
expect_success(newdom, "no args", "name") {|x| x == "
|
608
|
+
expect_success(newdom, "no args", "name") {|x| x == "rb-libvirt-test"}
|
609
|
+
expect_success(newdom, "is UTF-8", "name") {|x| x.encoding.name == "UTF-8"}
|
607
610
|
|
608
611
|
newdom.destroy
|
609
612
|
|
@@ -907,6 +910,7 @@ expect_too_many_args(newdom, "lookup_snapshot_by_name", 1, 2, 3)
|
|
907
910
|
expect_too_few_args(newdom, "lookup_snapshot_by_name")
|
908
911
|
expect_invalid_arg_type(newdom, "lookup_snapshot_by_name", 1)
|
909
912
|
expect_invalid_arg_type(newdom, "lookup_snapshot_by_name", 'foo', 'bar')
|
913
|
+
expect_utf8_exception_msg(newdom, Libvirt::RetrieveError, "lookup_snapshot_by_name", "__non_existing_snapshot")
|
910
914
|
|
911
915
|
expect_success(newdom, "name arg", "lookup_snapshot_by_name", "foo")
|
912
916
|
|
@@ -1187,7 +1191,7 @@ newdom.undefine
|
|
1187
1191
|
|
1188
1192
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1189
1193
|
sleep 1
|
1190
|
-
expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_max_downtime=", 10)
|
1194
|
+
#expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_max_downtime=", 10)
|
1191
1195
|
|
1192
1196
|
# FIXME: get this working
|
1193
1197
|
#newdom.migrate_to_uri("qemu://remote/system")
|
@@ -1406,6 +1410,7 @@ sleep 1
|
|
1406
1410
|
# TESTGROUP: snapshot.parent
|
1407
1411
|
newdom = conn.define_domain_xml($new_dom_xml)
|
1408
1412
|
snap = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1413
|
+
sleep 1
|
1409
1414
|
snap2 = newdom.snapshot_create_xml("<domainsnapshot/>")
|
1410
1415
|
|
1411
1416
|
expect_too_many_args(snap2, "parent", 1, 2)
|
data/tests/test_interface.rb
CHANGED
@@ -13,8 +13,8 @@ conn = Libvirt::open("qemu:///system")
|
|
13
13
|
|
14
14
|
# test setup
|
15
15
|
begin
|
16
|
-
`rm -f /etc/sysconfig/network-scripts/ifcfg-
|
17
|
-
`brctl delbr
|
16
|
+
`rm -f /etc/sysconfig/network-scripts/ifcfg-rb-libvirt-test`
|
17
|
+
`brctl delbr rb-libvirt-test >& /dev/null`
|
18
18
|
rescue
|
19
19
|
end
|
20
20
|
|
@@ -44,7 +44,7 @@ newiface = conn.define_interface_xml($new_interface_xml)
|
|
44
44
|
expect_too_many_args(newiface, "destroy", 1, 2)
|
45
45
|
expect_invalid_arg_type(newiface, "destroy", 'foo')
|
46
46
|
|
47
|
-
expect_success(newiface, "no args", "destroy")
|
47
|
+
#expect_success(newiface, "no args", "destroy")
|
48
48
|
|
49
49
|
newiface.undefine
|
50
50
|
|
@@ -66,7 +66,7 @@ newiface = conn.define_interface_xml($new_interface_xml)
|
|
66
66
|
|
67
67
|
expect_too_many_args(newiface, "name", 1)
|
68
68
|
|
69
|
-
expect_success(newiface, "no args", "name") {|x| x == "
|
69
|
+
expect_success(newiface, "no args", "name") {|x| x == "rb-libvirt-test"}
|
70
70
|
|
71
71
|
newiface.undefine
|
72
72
|
|
data/tests/test_network.rb
CHANGED
@@ -57,7 +57,7 @@ newnet = conn.create_network_xml($new_net_xml)
|
|
57
57
|
|
58
58
|
expect_too_many_args(newnet, "name", 1)
|
59
59
|
|
60
|
-
expect_success(newnet, "no args", "name") {|x| x == "
|
60
|
+
expect_success(newnet, "no args", "name") {|x| x == "rb-libvirt-test"}
|
61
61
|
|
62
62
|
newnet.destroy
|
63
63
|
|
data/tests/test_nwfilter.rb
CHANGED
@@ -23,7 +23,7 @@ newnw = conn.define_nwfilter_xml($new_nwfilter_xml)
|
|
23
23
|
|
24
24
|
expect_too_many_args(newnw, "name", 1)
|
25
25
|
|
26
|
-
expect_success(newnw, "no args", "name") {|x| x == "
|
26
|
+
expect_success(newnw, "no args", "name") {|x| x == "rb-libvirt-test"}
|
27
27
|
|
28
28
|
newnw.undefine
|
29
29
|
|
data/tests/test_storage.rb
CHANGED
@@ -12,7 +12,7 @@ set_test_object("storage_pool")
|
|
12
12
|
conn = Libvirt::open("qemu:///system")
|
13
13
|
|
14
14
|
begin
|
15
|
-
oldpool = conn.lookup_storage_pool_by_name("
|
15
|
+
oldpool = conn.lookup_storage_pool_by_name("rb-libvirt-test")
|
16
16
|
oldpool.destroy
|
17
17
|
oldpool.undefine
|
18
18
|
rescue
|
@@ -28,7 +28,7 @@ new_storage_vol_xml = <<EOF
|
|
28
28
|
<allocation>0</allocation>
|
29
29
|
<capacity unit="G">1</capacity>
|
30
30
|
<target>
|
31
|
-
<path>/tmp/
|
31
|
+
<path>/tmp/rb-libvirt-test/test.img</path>
|
32
32
|
</target>
|
33
33
|
</volume>
|
34
34
|
EOF
|
@@ -39,7 +39,7 @@ new_storage_vol_xml_2 = <<EOF
|
|
39
39
|
<allocation>0</allocation>
|
40
40
|
<capacity unit="G">5</capacity>
|
41
41
|
<target>
|
42
|
-
<path>/tmp/
|
42
|
+
<path>/tmp/rb-libvirt-test/test2.img</path>
|
43
43
|
</target>
|
44
44
|
</volume>
|
45
45
|
EOF
|
@@ -100,7 +100,7 @@ expect_invalid_arg_type(newpool, "delete", 'foo')
|
|
100
100
|
|
101
101
|
expect_success(newpool, "no args", "delete")
|
102
102
|
|
103
|
-
`mkdir -p /tmp/
|
103
|
+
`mkdir -p /tmp/rb-libvirt-test`
|
104
104
|
|
105
105
|
newpool.undefine
|
106
106
|
`mkdir -p #{$POOL_PATH}`
|
@@ -120,7 +120,7 @@ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
|
|
120
120
|
|
121
121
|
expect_too_many_args(newpool, "name", 1)
|
122
122
|
|
123
|
-
expect_success(newpool, "no args", "name") {|x| x == "
|
123
|
+
expect_success(newpool, "no args", "name") {|x| x == "rb-libvirt-test"}
|
124
124
|
|
125
125
|
newpool.destroy
|
126
126
|
|
data/tests/test_stream.rb
CHANGED
data/tests/test_utils.rb
CHANGED
@@ -4,16 +4,17 @@ $SKIPPED = 0
|
|
4
4
|
|
5
5
|
URI = ENV['RUBY_LIBVIRT_TEST_URI'] || "qemu:///system"
|
6
6
|
|
7
|
-
$GUEST_BASE = '/var/lib/libvirt/images/
|
7
|
+
$GUEST_BASE = '/var/lib/libvirt/images/rb-libvirt-test'
|
8
8
|
$GUEST_DISK = $GUEST_BASE + '.qcow2'
|
9
9
|
$GUEST_SAVE = $GUEST_BASE + '.save'
|
10
10
|
$GUEST_UUID = "93a5c045-6457-2c09-e56f-927cdf34e17a"
|
11
|
+
$GUEST_RAW_DISK = $GUEST_BASE + '.raw'
|
11
12
|
|
12
13
|
# XML data for later tests
|
13
14
|
$new_dom_xml = <<EOF
|
14
15
|
<domain type='kvm'>
|
15
16
|
<description>Ruby Libvirt Tester</description>
|
16
|
-
<name>
|
17
|
+
<name>rb-libvirt-test</name>
|
17
18
|
<uuid>#{$GUEST_UUID}</uuid>
|
18
19
|
<memory>1048576</memory>
|
19
20
|
<currentMemory>1048576</currentMemory>
|
@@ -59,11 +60,11 @@ $new_dom_xml = <<EOF
|
|
59
60
|
EOF
|
60
61
|
|
61
62
|
# qemu command-line that roughly corresponds to the above XML
|
62
|
-
$qemu_cmd_line = "/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name
|
63
|
+
$qemu_cmd_line = "/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rb-libvirt-test -uuid #{$GUEST_UUID} -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/rb-libvirt-test.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot c -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5"
|
63
64
|
|
64
65
|
$NEW_INTERFACE_MAC = 'aa:bb:cc:dd:ee:ff'
|
65
66
|
$new_interface_xml = <<EOF
|
66
|
-
<interface type="ethernet" name="
|
67
|
+
<interface type="ethernet" name="rb-libvirt-test">
|
67
68
|
<start mode="onboot"/>
|
68
69
|
<mac address="#{$NEW_INTERFACE_MAC}"/>
|
69
70
|
<protocol family='ipv4'>
|
@@ -75,7 +76,7 @@ EOF
|
|
75
76
|
$NETWORK_UUID = "04068860-d9a2-47c5-bc9d-9e047ae901da"
|
76
77
|
$new_net_xml = <<EOF
|
77
78
|
<network>
|
78
|
-
<name>
|
79
|
+
<name>rb-libvirt-test</name>
|
79
80
|
<uuid>#{$NETWORK_UUID}</uuid>
|
80
81
|
<forward mode='nat'/>
|
81
82
|
<bridge name='rubybr0' stp='on' delay='0' />
|
@@ -93,7 +94,7 @@ EOF
|
|
93
94
|
|
94
95
|
$NWFILTER_UUID = "bd339530-134c-6d07-441a-17fb90dad807"
|
95
96
|
$new_nwfilter_xml = <<EOF
|
96
|
-
<filter name='
|
97
|
+
<filter name='rb-libvirt-test' chain='ipv4'>
|
97
98
|
<uuid>#{$NWFILTER_UUID}</uuid>
|
98
99
|
<rule action='accept' direction='out' priority='100'>
|
99
100
|
<ip srcipaddr='0.0.0.0' dstipaddr='255.255.255.255' protocol='tcp' srcportstart='63000' dstportstart='62000'/>
|
@@ -116,10 +117,10 @@ $new_secret_xml = <<EOF
|
|
116
117
|
EOF
|
117
118
|
|
118
119
|
$POOL_UUID = "33a5c045-645a-2c00-e56b-927cdf34e17a"
|
119
|
-
$POOL_PATH = "/var/lib/libvirt/images/
|
120
|
+
$POOL_PATH = "/var/lib/libvirt/images/rb-libvirt-test"
|
120
121
|
$new_storage_pool_xml = <<EOF
|
121
122
|
<pool type="dir">
|
122
|
-
<name>
|
123
|
+
<name>rb-libvirt-test</name>
|
123
124
|
<uuid>#{$POOL_UUID}</uuid>
|
124
125
|
<target>
|
125
126
|
<path>#{$POOL_PATH}</path>
|
@@ -165,6 +166,24 @@ def expect_fail(object, errtype, errmsg, func, *args)
|
|
165
166
|
end
|
166
167
|
end
|
167
168
|
|
169
|
+
def expect_utf8_exception_msg(object, errtype, func, *args)
|
170
|
+
begin
|
171
|
+
object.__send__(func, *args)
|
172
|
+
rescue NoMethodError
|
173
|
+
puts_skipped "#{$test_object}.#{func} does not exist"
|
174
|
+
rescue errtype => e
|
175
|
+
if e.message.encoding.name == 'UTF-8'
|
176
|
+
puts_ok "#{$test_object}.#{func} threw #{errtype.to_s} with UTF-8 encoding"
|
177
|
+
else
|
178
|
+
puts_fail "#{$test_object}.#{func} threw #{errtype.to_s} with #{e.message.encoding.name} encoding"
|
179
|
+
end
|
180
|
+
rescue => e
|
181
|
+
puts_fail "#{$test_object}.#{func} expected to throw #{errtype.to_s}, but instead threw #{e.class.to_s}: #{e.to_s}"
|
182
|
+
else
|
183
|
+
puts_fail "#{$test_object}.#{func} expected to throw #{errtype.to_s}, but threw nothing"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
168
187
|
def expect_too_many_args(object, func, *args)
|
169
188
|
expect_fail(object, ArgumentError, "too many args", func, *args)
|
170
189
|
end
|
@@ -210,7 +229,7 @@ end
|
|
210
229
|
def cleanup_test_domain(conn)
|
211
230
|
# cleanup from previous runs
|
212
231
|
begin
|
213
|
-
olddom = conn.lookup_domain_by_name("
|
232
|
+
olddom = conn.lookup_domain_by_name("rb-libvirt-test")
|
214
233
|
rescue
|
215
234
|
# in case we didn't find it, don't do anything
|
216
235
|
end
|
@@ -234,7 +253,7 @@ end
|
|
234
253
|
def cleanup_test_network(conn)
|
235
254
|
# initial cleanup for previous run
|
236
255
|
begin
|
237
|
-
oldnet = conn.lookup_network_by_name("
|
256
|
+
oldnet = conn.lookup_network_by_name("rb-libvirt-test")
|
238
257
|
rescue
|
239
258
|
# in case we didn't find it, don't do anything
|
240
259
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-libvirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Lutterkort, Chris Lalancette
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby bindings for libvirt.
|
14
14
|
email: libvir-list@redhat.com
|
@@ -17,12 +17,11 @@ extensions:
|
|
17
17
|
- ext/libvirt/extconf.rb
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- Rakefile
|
21
20
|
- COPYING
|
22
|
-
- README
|
23
21
|
- NEWS
|
22
|
+
- README
|
24
23
|
- README.rdoc
|
25
|
-
-
|
24
|
+
- Rakefile
|
26
25
|
- ext/libvirt/_libvirt.c
|
27
26
|
- ext/libvirt/common.c
|
28
27
|
- ext/libvirt/common.h
|
@@ -30,6 +29,8 @@ files:
|
|
30
29
|
- ext/libvirt/connect.h
|
31
30
|
- ext/libvirt/domain.c
|
32
31
|
- ext/libvirt/domain.h
|
32
|
+
- ext/libvirt/extconf.h
|
33
|
+
- ext/libvirt/extconf.rb
|
33
34
|
- ext/libvirt/interface.c
|
34
35
|
- ext/libvirt/interface.h
|
35
36
|
- ext/libvirt/network.c
|
@@ -44,7 +45,7 @@ files:
|
|
44
45
|
- ext/libvirt/storage.h
|
45
46
|
- ext/libvirt/stream.c
|
46
47
|
- ext/libvirt/stream.h
|
47
|
-
-
|
48
|
+
- lib/libvirt.rb
|
48
49
|
- tests/test_conn.rb
|
49
50
|
- tests/test_domain.rb
|
50
51
|
- tests/test_interface.rb
|
@@ -58,26 +59,25 @@ files:
|
|
58
59
|
- tests/test_utils.rb
|
59
60
|
homepage: http://libvirt.org/ruby/
|
60
61
|
licenses:
|
61
|
-
-
|
62
|
+
- LGPL-2.1-or-later
|
62
63
|
metadata: {}
|
63
|
-
post_install_message:
|
64
|
+
post_install_message:
|
64
65
|
rdoc_options: []
|
65
66
|
require_paths:
|
66
67
|
- lib
|
67
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
69
|
requirements:
|
69
|
-
- -
|
70
|
+
- - ">="
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: 1.8.1
|
72
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
74
|
requirements:
|
74
|
-
- -
|
75
|
+
- - ">="
|
75
76
|
- !ruby/object:Gem::Version
|
76
77
|
version: '0'
|
77
78
|
requirements: []
|
78
|
-
|
79
|
-
|
80
|
-
signing_key:
|
79
|
+
rubygems_version: 3.2.22
|
80
|
+
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Ruby bindings for LIBVIRT
|
83
83
|
test_files: []
|