ruby-libvirt 0.1.0 → 0.2.0
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.
- data/README.rdoc +16 -2
- data/Rakefile +8 -6
- data/ext/libvirt/_libvirt.c +85 -1872
- data/ext/libvirt/common.c +75 -0
- data/ext/libvirt/common.h +155 -0
- data/ext/libvirt/connect.c +392 -0
- data/ext/libvirt/connect.h +12 -0
- data/ext/libvirt/domain.c +1606 -0
- data/ext/libvirt/domain.h +8 -0
- data/ext/libvirt/extconf.rb +30 -1
- data/ext/libvirt/interface.c +259 -0
- data/ext/libvirt/interface.h +6 -0
- data/ext/libvirt/network.c +338 -0
- data/ext/libvirt/network.h +6 -0
- data/ext/libvirt/nodedevice.c +333 -0
- data/ext/libvirt/nodedevice.h +6 -0
- data/ext/libvirt/nwfilter.c +206 -0
- data/ext/libvirt/nwfilter.h +6 -0
- data/ext/libvirt/secret.c +288 -0
- data/ext/libvirt/secret.h +6 -0
- data/ext/libvirt/storage.c +825 -0
- data/ext/libvirt/storage.h +6 -0
- data/tests/tc_connect.rb +1 -1
- data/tests/test_conn.rb +53 -0
- data/tests/test_domain.rb +165 -0
- data/tests/test_interface.rb +35 -0
- data/tests/test_network.rb +40 -0
- data/tests/test_nodedevice.rb +23 -0
- data/tests/test_nwfilter.rb +28 -0
- data/tests/test_open.rb +23 -0
- data/tests/test_secret.rb +33 -0
- data/tests/test_storage.rb +49 -0
- metadata +58 -14
- data/ext/libvirt/extconf.h +0 -6
data/tests/tc_connect.rb
CHANGED
@@ -87,7 +87,7 @@ class TestConnect < Test::Unit::TestCase
|
|
87
87
|
assert_equal(32, c.max_vcpus("bogus"))
|
88
88
|
assert(c.capabilities.size > 0)
|
89
89
|
assert_equal(2, c.num_of_domains)
|
90
|
-
assert_equal([1, 2], c.list_domains)
|
90
|
+
assert_equal([1, 2], c.list_domains.sort)
|
91
91
|
assert_equal(0, c.num_of_defined_domains)
|
92
92
|
assert_equal([], c.list_defined_domains)
|
93
93
|
assert_equal(1, c.num_of_networks)
|
data/tests/test_conn.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the conn methods the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
puts "Connection:"
|
9
|
+
puts " Closed?: #{conn.closed?}"
|
10
|
+
puts " Type: #{conn.type}"
|
11
|
+
puts " Version: #{conn.version}"
|
12
|
+
puts " Libversion: #{conn.libversion}"
|
13
|
+
puts " Hostname: #{conn.hostname}"
|
14
|
+
puts " URI: #{conn.uri}"
|
15
|
+
puts " Max VCPUs: #{conn.max_vcpus}"
|
16
|
+
puts " Max VCPUs (kvm): #{conn.max_vcpus("kvm")}"
|
17
|
+
puts " Max VCPUs (qemu): #{conn.max_vcpus("qemu")}"
|
18
|
+
puts " Node Free Memory: #{conn.node_free_memory}kb"
|
19
|
+
puts " Node Cells Free Memory:"
|
20
|
+
cell_free_mem = conn.node_cells_free_memory
|
21
|
+
cell_free_mem.each_index do |cell|
|
22
|
+
puts " Cell: #{cell}, Free Memory: #{cell_free_mem[cell]}kb"
|
23
|
+
end
|
24
|
+
puts " Node Cells Free Memory (0-):"
|
25
|
+
cell_free_mem = conn.node_cells_free_memory(0)
|
26
|
+
cell_free_mem.each_index do |cell|
|
27
|
+
puts " Cell: #{cell}, Free Memory: #{cell_free_mem[cell]}kb"
|
28
|
+
end
|
29
|
+
puts " Node Cells Free Memory (0-1):"
|
30
|
+
cell_free_mem = conn.node_cells_free_memory(0, 1)
|
31
|
+
cell_free_mem.each_index do |cell|
|
32
|
+
puts " Cell: #{cell}, Free Memory: #{cell_free_mem[cell]}kb"
|
33
|
+
end
|
34
|
+
secmodel = conn.node_get_security_model
|
35
|
+
puts " Node Security Model:"
|
36
|
+
puts " Model: #{secmodel.model}"
|
37
|
+
puts " DOI: #{secmodel.doi}"
|
38
|
+
puts " Encrypted?: #{conn.encrypted?}"
|
39
|
+
puts " Secure?: #{conn.secure?}"
|
40
|
+
info = conn.node_get_info
|
41
|
+
puts " Node Info:"
|
42
|
+
puts " Model: #{info.model}"
|
43
|
+
puts " Memory: #{info.memory}"
|
44
|
+
puts " CPUs: #{info.cpus}"
|
45
|
+
puts " MHz: #{info.mhz}"
|
46
|
+
puts " Nodes: #{info.nodes}"
|
47
|
+
puts " Sockets: #{info.sockets}"
|
48
|
+
puts " Cores: #{info.cores}"
|
49
|
+
puts " Threads: #{info.threads}"
|
50
|
+
puts " Capabilities:"
|
51
|
+
puts conn.capabilities
|
52
|
+
conn.close
|
53
|
+
puts "After close, conn closed? = #{conn.closed?}"
|
@@ -0,0 +1,165 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the domain methods the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
puts "Number of Domains: #{conn.num_of_domains}"
|
9
|
+
puts "Number of Defined Domains: #{conn.num_of_defined_domains}"
|
10
|
+
puts "Domain Create:"
|
11
|
+
new_dom_xml = <<EOF
|
12
|
+
<domain type='kvm'>
|
13
|
+
<name>ruby-libvirt-tester</name>
|
14
|
+
<uuid>93a5c045-6457-2c09-e56f-927cdf34e17a</uuid>
|
15
|
+
<memory>1048576</memory>
|
16
|
+
<currentMemory>1048576</currentMemory>
|
17
|
+
<vcpu>1</vcpu>
|
18
|
+
<os>
|
19
|
+
<type arch='x86_64'>hvm</type>
|
20
|
+
<boot dev='hd'/>
|
21
|
+
</os>
|
22
|
+
<features>
|
23
|
+
<acpi/>
|
24
|
+
<apic/>
|
25
|
+
<pae/>
|
26
|
+
</features>
|
27
|
+
<clock offset='utc'/>
|
28
|
+
<on_poweroff>destroy</on_poweroff>
|
29
|
+
<on_reboot>restart</on_reboot>
|
30
|
+
<on_crash>restart</on_crash>
|
31
|
+
<devices>
|
32
|
+
<emulator>/usr/libexec/qemu-kvm</emulator>
|
33
|
+
<disk type='file' device='disk'>
|
34
|
+
<driver name='qemu' type='raw'/>
|
35
|
+
<source file='/var/lib/libvirt/images/ruby-libvirt-test.dsk'/>
|
36
|
+
<target dev='vda' bus='virtio'/>
|
37
|
+
</disk>
|
38
|
+
<interface type='bridge'>
|
39
|
+
<mac address='52:54:00:60:3c:95'/>
|
40
|
+
<source bridge='br0'/>
|
41
|
+
<model type='virtio'/>
|
42
|
+
<target dev='rl556'/>
|
43
|
+
</interface>
|
44
|
+
<serial type='pty'>
|
45
|
+
<target port='0'/>
|
46
|
+
</serial>
|
47
|
+
<console type='pty'>
|
48
|
+
<target port='0'/>
|
49
|
+
</console>
|
50
|
+
<input type='mouse' bus='ps2'/>
|
51
|
+
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
|
52
|
+
<video>
|
53
|
+
<model type='cirrus' vram='9216' heads='1'/>
|
54
|
+
</video>
|
55
|
+
</devices>
|
56
|
+
</domain>
|
57
|
+
EOF
|
58
|
+
|
59
|
+
newdom = conn.define_domain_xml(new_dom_xml)
|
60
|
+
newdom.undefine
|
61
|
+
|
62
|
+
`dd if=/dev/zero of=/var/lib/libvirt/images/ruby-libvirt-test.dsk bs=1 count=1 seek=5G`
|
63
|
+
|
64
|
+
newdom = conn.create_domain_linux(new_dom_xml)
|
65
|
+
info = newdom.info
|
66
|
+
if info.state != Libvirt::Domain::RUNNING
|
67
|
+
raise "Failed to start new domain"
|
68
|
+
end
|
69
|
+
sleep 2
|
70
|
+
newdom.destroy
|
71
|
+
|
72
|
+
newdom = conn.define_domain_xml(new_dom_xml)
|
73
|
+
info = newdom.info
|
74
|
+
newdom.create
|
75
|
+
sleep 2
|
76
|
+
newdom.suspend
|
77
|
+
sleep 2
|
78
|
+
newdom.resume
|
79
|
+
sleep 2
|
80
|
+
#newdom.save('/var/lib/libvirt/images/ruby-libvirt-test.save')
|
81
|
+
#sleep 2
|
82
|
+
#newdom.restore
|
83
|
+
ifinfo = newdom.ifinfo('rl556')
|
84
|
+
puts "New Domain Interface Information rl556:"
|
85
|
+
puts " rx_bytes: #{ifinfo.rx_bytes}"
|
86
|
+
puts " rx_packets: #{ifinfo.rx_packets}"
|
87
|
+
puts " rx_errs: #{ifinfo.rx_errs}"
|
88
|
+
puts " rx_drop: #{ifinfo.rx_drop}"
|
89
|
+
puts " tx_bytes: #{ifinfo.tx_bytes}"
|
90
|
+
puts " tx_packets: #{ifinfo.tx_packets}"
|
91
|
+
puts " tx_errs: #{ifinfo.tx_errs}"
|
92
|
+
puts " tx_drop: #{ifinfo.tx_drop}"
|
93
|
+
seclabel = newdom.security_label
|
94
|
+
puts "New Domain Security Label:"
|
95
|
+
puts " Label: #{seclabel.label}"
|
96
|
+
puts " Enforcing: #{seclabel.enforcing}"
|
97
|
+
blockstat = newdom.block_stats('vda')
|
98
|
+
puts "New Domain Block Stats vda:"
|
99
|
+
puts " rd_req: #{blockstat.rd_req}"
|
100
|
+
puts " rd_bytes: #{blockstat.rd_bytes}"
|
101
|
+
puts " wr_req: #{blockstat.wr_req}"
|
102
|
+
puts " wr_bytes: #{blockstat.wr_bytes}"
|
103
|
+
puts " errs: #{blockstat.errs}"
|
104
|
+
memstat = newdom.memory_stats
|
105
|
+
memstat = newdom.memory_stats(0)
|
106
|
+
puts "New Domain Memory Stats:"
|
107
|
+
memstat.each do |stat|
|
108
|
+
puts " #{stat.tag}: #{stat.val}"
|
109
|
+
end
|
110
|
+
blockinfo = newdom.blockinfo('/var/lib/libvirt/images/ruby-libvirt-test.dsk')
|
111
|
+
blockinfo = newdom.blockinfo('/var/lib/libvirt/images/ruby-libvirt-test.dsk', 0)
|
112
|
+
puts "New Domain Block Info vda:"
|
113
|
+
puts " Capacity: #{blockinfo.capacity}"
|
114
|
+
puts " Allocation: #{blockinfo.allocation}"
|
115
|
+
puts " Physical: #{blockinfo.physical}"
|
116
|
+
blockpeek = newdom.block_peek('/var/lib/libvirt/images/ruby-libvirt-test.dsk',
|
117
|
+
0, 512)
|
118
|
+
blockpeek = newdom.block_peek('/var/lib/libvirt/images/ruby-libvirt-test.dsk',
|
119
|
+
0, 512, 0)
|
120
|
+
# 2010-06-30: memory_peek is broken on RHEL-6 libvirt; fixed in upstream
|
121
|
+
#mempeek = newdom.memory_peek(0, 512, Libvirt::Domain::MEMORY_VIRTUAL)
|
122
|
+
|
123
|
+
|
124
|
+
defined = conn.list_defined_domains
|
125
|
+
running = conn.list_domains
|
126
|
+
|
127
|
+
(defined+running).each do |dom|
|
128
|
+
if defined.include? dom
|
129
|
+
domain = conn.lookup_domain_by_name(dom)
|
130
|
+
elsif running.include? dom
|
131
|
+
domain = conn.lookup_domain_by_id(dom)
|
132
|
+
end
|
133
|
+
dom2 = conn.lookup_domain_by_uuid(domain.uuid)
|
134
|
+
puts "Domain #{domain.name}:"
|
135
|
+
puts " UUID: #{domain.uuid}"
|
136
|
+
puts " ID: #{domain.id}"
|
137
|
+
puts " OS Type: #{domain.os_type}"
|
138
|
+
puts " Max Memory: #{domain.max_memory}"
|
139
|
+
puts " Max VCPUs: #{domain.max_vcpus}"
|
140
|
+
puts " Persistent?: #{domain.persistent?}"
|
141
|
+
puts " Active?: #{domain.active?}"
|
142
|
+
info = domain.info
|
143
|
+
puts " Info:"
|
144
|
+
puts " State: #{info.state}"
|
145
|
+
puts " Max Memory: #{info.max_mem}"
|
146
|
+
puts " Memory: #{info.memory}"
|
147
|
+
puts " Number VCPUs: #{info.nr_virt_cpu}"
|
148
|
+
puts " CPU Time: #{info.cpu_time}"
|
149
|
+
puts " Snapshots:"
|
150
|
+
puts " Number: #{domain.num_of_snapshots}"
|
151
|
+
puts " Has Current?: #{domain.has_current_snapshot?}"
|
152
|
+
domain.list_snapshots.each do |snapname|
|
153
|
+
snap = domain.lookup_snapshot_by_name(snapname)
|
154
|
+
puts " Snapshot #{snapname}"
|
155
|
+
puts snap.xml_desc
|
156
|
+
end
|
157
|
+
domain.xml_desc
|
158
|
+
puts " XML:"
|
159
|
+
puts domain.xml_desc(0)
|
160
|
+
end
|
161
|
+
|
162
|
+
newdom.destroy
|
163
|
+
newdom.undefine
|
164
|
+
|
165
|
+
conn.close
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the interface methods the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
puts "Number of Interfaces: #{conn.num_of_interfaces}"
|
9
|
+
puts "Number of Defined Interfaces: #{conn.num_of_defined_interfaces}"
|
10
|
+
|
11
|
+
new_interface_xml = <<EOF
|
12
|
+
<interface type='bridge' name='testbr7'>
|
13
|
+
<bridge>
|
14
|
+
<interface type='ethernet' name='dummy'>
|
15
|
+
</interface>
|
16
|
+
</bridge>
|
17
|
+
</interface>
|
18
|
+
EOF
|
19
|
+
|
20
|
+
# FIXME: doesn't work at the moment
|
21
|
+
#new_interface = conn.define_interface_xml(new_interface_xml)
|
22
|
+
#new_interface.undefine
|
23
|
+
|
24
|
+
defined = conn.list_defined_interfaces
|
25
|
+
running = conn.list_interfaces
|
26
|
+
|
27
|
+
(defined+running).each do |intname|
|
28
|
+
interface = conn.lookup_interface_by_name(intname)
|
29
|
+
int2 = conn.lookup_interface_by_mac(interface.mac)
|
30
|
+
puts "Interface #{interface.name}:"
|
31
|
+
puts " MAC: #{interface.mac}"
|
32
|
+
puts " XML:"
|
33
|
+
puts interface.xml_desc
|
34
|
+
end
|
35
|
+
conn.close
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the network methods the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
puts "Number of Networks: #{conn.num_of_networks}"
|
9
|
+
puts "Number of Defined Networks: #{conn.num_of_defined_networks}"
|
10
|
+
|
11
|
+
new_network_xml = <<EOF
|
12
|
+
<network>
|
13
|
+
<name>testnetwork</name>
|
14
|
+
<uuid>e0eed9fa-cb64-433f-066c-257a29b1c13a</uuid>
|
15
|
+
</network>
|
16
|
+
EOF
|
17
|
+
|
18
|
+
newnetwork = conn.define_network_xml(new_network_xml)
|
19
|
+
newnetwork.create
|
20
|
+
newnetwork.destroy
|
21
|
+
newnetwork.undefine
|
22
|
+
|
23
|
+
defined = conn.list_defined_networks
|
24
|
+
running = conn.list_networks
|
25
|
+
|
26
|
+
(defined+running).each do |netname|
|
27
|
+
network = conn.lookup_network_by_name(netname)
|
28
|
+
net2 = conn.lookup_network_by_uuid(network.uuid)
|
29
|
+
|
30
|
+
puts "Network #{network.name}:"
|
31
|
+
puts " UUID: #{network.uuid}"
|
32
|
+
puts " Autostart?: #{network.autostart?}"
|
33
|
+
puts " Active?: #{network.active?}"
|
34
|
+
puts " Persistent?: #{network.persistent?}"
|
35
|
+
puts " Bridge Name: #{network.bridge_name}"
|
36
|
+
puts " XML:"
|
37
|
+
puts network.xml_desc
|
38
|
+
end
|
39
|
+
|
40
|
+
conn.close
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the nodedevice methods the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
puts "Number of NodeDevices: #{conn.num_of_nodedevices}"
|
9
|
+
|
10
|
+
conn.list_nodedevices.each do |nodename|
|
11
|
+
nodedevice = conn.lookup_nodedevice_by_name(nodename)
|
12
|
+
puts "NodeDevice #{nodedevice.name}:"
|
13
|
+
puts " Parent: #{nodedevice.parent}"
|
14
|
+
puts " Number Caps: #{nodedevice.num_of_caps}"
|
15
|
+
puts " Caps:"
|
16
|
+
nodedevice.list_caps.each do |cap|
|
17
|
+
puts " #{cap}"
|
18
|
+
end
|
19
|
+
puts " XML:"
|
20
|
+
puts nodedevice.xml_desc
|
21
|
+
end
|
22
|
+
|
23
|
+
conn.close
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the nwfilter methods the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
puts "Number of NWFilters: #{conn.num_of_nwfilters}"
|
9
|
+
|
10
|
+
new_nwfilter_xml = <<EOF
|
11
|
+
<filter name='no-spamming'>
|
12
|
+
<uuid>d217f2d7-5a04-0e01-8b90-ec274a436b74</uuid>
|
13
|
+
</filter>
|
14
|
+
EOF
|
15
|
+
|
16
|
+
newnwfilter = conn.define_nwfilter_xml(new_nwfilter_xml)
|
17
|
+
newnwfilter.undefine
|
18
|
+
|
19
|
+
conn.list_nwfilters.each do |nwfname|
|
20
|
+
nwfilter = conn.lookup_nwfilter_by_name(nwfname)
|
21
|
+
nwf2 = conn.lookup_nwfilter_by_uuid(nwfilter.uuid)
|
22
|
+
puts "NWFilter #{nwfilter.name}:"
|
23
|
+
puts " UUID: #{nwfilter.uuid}"
|
24
|
+
puts " XML:"
|
25
|
+
puts nwfilter.xml_desc
|
26
|
+
end
|
27
|
+
|
28
|
+
conn.close
|
data/tests/test_open.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the open calls that the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
conn.close
|
9
|
+
|
10
|
+
conn = Libvirt::open("qemu:///system")
|
11
|
+
conn.close
|
12
|
+
|
13
|
+
conn = Libvirt::open(nil)
|
14
|
+
conn.close
|
15
|
+
|
16
|
+
conn = Libvirt::open_read_only
|
17
|
+
conn.close
|
18
|
+
|
19
|
+
conn = Libvirt::open_read_only("qemu:///system")
|
20
|
+
conn.close
|
21
|
+
|
22
|
+
conn = Libvirt::open_read_only(nil)
|
23
|
+
conn.close
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the secret methods the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
puts "Number of Secrets: #{conn.num_of_secrets}"
|
9
|
+
|
10
|
+
new_secret_xml = <<EOF
|
11
|
+
<secret ephemeral='no' private='no'>
|
12
|
+
<description>test secret</description>
|
13
|
+
</secret>
|
14
|
+
EOF
|
15
|
+
|
16
|
+
newsecret = conn.define_secret_xml(new_secret_xml)
|
17
|
+
newsecret.set_value("hello")
|
18
|
+
puts newsecret.get_value
|
19
|
+
newsecret.set_value("bob", 0)
|
20
|
+
puts newsecret.get_value
|
21
|
+
|
22
|
+
conn.list_secrets.each do |secuuid|
|
23
|
+
secret = conn.lookup_secret_by_uuid(secuuid)
|
24
|
+
puts "Secret #{secret.uuid}:"
|
25
|
+
puts " UsageType: #{secret.usagetype}"
|
26
|
+
puts " UsageId: #{secret.usageid}"
|
27
|
+
puts " XML:"
|
28
|
+
puts secret.xml_desc
|
29
|
+
end
|
30
|
+
|
31
|
+
newsecret.undefine
|
32
|
+
|
33
|
+
conn.close
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Test the storage methods the bindings support
|
4
|
+
|
5
|
+
require 'libvirt'
|
6
|
+
|
7
|
+
conn = Libvirt::open
|
8
|
+
puts "Number of Storage Pools: #{conn.num_of_storage_pools}"
|
9
|
+
puts "Number of Defined Storage Pools: #{conn.num_of_defined_storage_pools}"
|
10
|
+
|
11
|
+
defined = conn.list_defined_storage_pools
|
12
|
+
running = conn.list_storage_pools
|
13
|
+
|
14
|
+
(defined+running).each do |storagename|
|
15
|
+
storagepool = conn.lookup_storage_pool_by_name(storagename)
|
16
|
+
store2 = conn.lookup_storage_pool_by_uuid(storagepool.uuid)
|
17
|
+
storagepool.refresh
|
18
|
+
puts "StoragePool #{storagepool.name}:"
|
19
|
+
puts " UUID: #{storagepool.uuid}"
|
20
|
+
puts " Autostart?: #{storagepool.autostart?}"
|
21
|
+
puts " Active?: #{storagepool.active?}"
|
22
|
+
puts " Persistent?: #{storagepool.persistent?}"
|
23
|
+
info = storagepool.info
|
24
|
+
puts " Info:"
|
25
|
+
puts " State: #{info.state}"
|
26
|
+
puts " Capacity: #{info.capacity}"
|
27
|
+
puts " Allocation: #{info.allocation}"
|
28
|
+
puts " Available: #{info.available}"
|
29
|
+
puts " XML:"
|
30
|
+
puts storagepool.xml_desc
|
31
|
+
puts " Number of Volumes: #{storagepool.num_of_volumes}"
|
32
|
+
puts " Volumes:"
|
33
|
+
storagepool.list_volumes.each do |volname|
|
34
|
+
storagevolume = storagepool.lookup_volume_by_name(volname)
|
35
|
+
vol2 = storagepool.lookup_volume_by_key(storagevolume.key)
|
36
|
+
vol3 = storagepool.lookup_volume_by_path(storagevolume.path)
|
37
|
+
puts " Volume #{storagevolume.name}:"
|
38
|
+
puts " Pool: #{storagevolume.pool.name}"
|
39
|
+
puts " Key: #{storagevolume.key}"
|
40
|
+
puts " Path: #{storagevolume.path}"
|
41
|
+
info = storagevolume.info
|
42
|
+
puts " Info:"
|
43
|
+
puts " Type: #{info.type}"
|
44
|
+
puts " Capacity: #{info.capacity}"
|
45
|
+
puts " Allocation: #{info.allocation}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
conn.close
|