ruby-libvirt 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS +15 -2
- data/Rakefile +2 -3
- data/ext/libvirt/common.c +18 -9
- data/ext/libvirt/common.h +10 -0
- data/ext/libvirt/connect.c +207 -56
- data/ext/libvirt/domain.c +345 -37
- data/ext/libvirt/extconf.h +380 -0
- data/ext/libvirt/extconf.rb +32 -0
- data/ext/libvirt/interface.c +3 -3
- data/ext/libvirt/network.c +98 -5
- data/ext/libvirt/nodedevice.c +4 -4
- data/ext/libvirt/nwfilter.c +3 -3
- data/ext/libvirt/secret.c +5 -5
- data/ext/libvirt/storage.c +15 -12
- data/tests/test_conn.rb +11 -13
- data/tests/test_domain.rb +3 -3
- 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_utils.rb +10 -10
- metadata +10 -9
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_utils.rb
CHANGED
@@ -4,7 +4,7 @@ $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"
|
@@ -13,7 +13,7 @@ $GUEST_UUID = "93a5c045-6457-2c09-e56f-927cdf34e17a"
|
|
13
13
|
$new_dom_xml = <<EOF
|
14
14
|
<domain type='kvm'>
|
15
15
|
<description>Ruby Libvirt Tester</description>
|
16
|
-
<name>
|
16
|
+
<name>rb-libvirt-test</name>
|
17
17
|
<uuid>#{$GUEST_UUID}</uuid>
|
18
18
|
<memory>1048576</memory>
|
19
19
|
<currentMemory>1048576</currentMemory>
|
@@ -59,11 +59,11 @@ $new_dom_xml = <<EOF
|
|
59
59
|
EOF
|
60
60
|
|
61
61
|
# 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
|
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 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
63
|
|
64
64
|
$NEW_INTERFACE_MAC = 'aa:bb:cc:dd:ee:ff'
|
65
65
|
$new_interface_xml = <<EOF
|
66
|
-
<interface type="ethernet" name="
|
66
|
+
<interface type="ethernet" name="rb-libvirt-test">
|
67
67
|
<start mode="onboot"/>
|
68
68
|
<mac address="#{$NEW_INTERFACE_MAC}"/>
|
69
69
|
<protocol family='ipv4'>
|
@@ -75,7 +75,7 @@ EOF
|
|
75
75
|
$NETWORK_UUID = "04068860-d9a2-47c5-bc9d-9e047ae901da"
|
76
76
|
$new_net_xml = <<EOF
|
77
77
|
<network>
|
78
|
-
<name>
|
78
|
+
<name>rb-libvirt-test</name>
|
79
79
|
<uuid>#{$NETWORK_UUID}</uuid>
|
80
80
|
<forward mode='nat'/>
|
81
81
|
<bridge name='rubybr0' stp='on' delay='0' />
|
@@ -93,7 +93,7 @@ EOF
|
|
93
93
|
|
94
94
|
$NWFILTER_UUID = "bd339530-134c-6d07-441a-17fb90dad807"
|
95
95
|
$new_nwfilter_xml = <<EOF
|
96
|
-
<filter name='
|
96
|
+
<filter name='rb-libvirt-test' chain='ipv4'>
|
97
97
|
<uuid>#{$NWFILTER_UUID}</uuid>
|
98
98
|
<rule action='accept' direction='out' priority='100'>
|
99
99
|
<ip srcipaddr='0.0.0.0' dstipaddr='255.255.255.255' protocol='tcp' srcportstart='63000' dstportstart='62000'/>
|
@@ -116,10 +116,10 @@ $new_secret_xml = <<EOF
|
|
116
116
|
EOF
|
117
117
|
|
118
118
|
$POOL_UUID = "33a5c045-645a-2c00-e56b-927cdf34e17a"
|
119
|
-
$POOL_PATH = "/var/lib/libvirt/images/
|
119
|
+
$POOL_PATH = "/var/lib/libvirt/images/rb-libvirt-test"
|
120
120
|
$new_storage_pool_xml = <<EOF
|
121
121
|
<pool type="dir">
|
122
|
-
<name>
|
122
|
+
<name>rb-libvirt-test</name>
|
123
123
|
<uuid>#{$POOL_UUID}</uuid>
|
124
124
|
<target>
|
125
125
|
<path>#{$POOL_PATH}</path>
|
@@ -210,7 +210,7 @@ end
|
|
210
210
|
def cleanup_test_domain(conn)
|
211
211
|
# cleanup from previous runs
|
212
212
|
begin
|
213
|
-
olddom = conn.lookup_domain_by_name("
|
213
|
+
olddom = conn.lookup_domain_by_name("rb-libvirt-test")
|
214
214
|
rescue
|
215
215
|
# in case we didn't find it, don't do anything
|
216
216
|
end
|
@@ -234,7 +234,7 @@ end
|
|
234
234
|
def cleanup_test_network(conn)
|
235
235
|
# initial cleanup for previous run
|
236
236
|
begin
|
237
|
-
oldnet = conn.lookup_network_by_name("
|
237
|
+
oldnet = conn.lookup_network_by_name("rb-libvirt-test")
|
238
238
|
rescue
|
239
239
|
# in case we didn't find it, don't do anything
|
240
240
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Lutterkort, Chris Lalancette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-20 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
|
@@ -66,17 +67,17 @@ 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
|
rubyforge_project: None
|
79
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.4.8
|
80
81
|
signing_key:
|
81
82
|
specification_version: 4
|
82
83
|
summary: Ruby bindings for LIBVIRT
|