ruby-libvirt 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/tests/test_open.rb CHANGED
@@ -80,15 +80,12 @@ begin
80
80
  res
81
81
  end
82
82
 
83
- puts "OK: open_auth uri, creds, userdata, auth block succeeded"
84
- $SUCCESS = $SUCCESS + 1
83
+ puts_ok "open_auth uri, creds, userdata, auth block succeeded"
85
84
  conn.close
86
85
  rescue NoMethodError
87
- puts "SKIPPED: open_auth does not exist"
88
- $SKIPPED = $SKIPPED + 1
86
+ puts_skipped "open_auth does not exist"
89
87
  rescue => e
90
- puts "FAIL: open_auth uri, creds, userdata, auth block expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
91
- $FAIL = $FAIL + 1
88
+ puts_fail "open_auth uri, creds, userdata, auth block expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
92
89
  end
93
90
 
94
91
  # equivalent to "expect_success"
@@ -112,54 +109,14 @@ begin
112
109
  res
113
110
  end
114
111
 
115
- puts "OK: open_auth uri, creds, userdata, R/O flag, auth block succeeded"
116
- $SUCCESS = $SUCCESS + 1
112
+ puts_ok "open_auth uri, creds, userdata, R/O flag, auth block succeeded"
117
113
  conn.close
118
114
  rescue NoMethodError
119
- puts "SKIPPED: open_auth does not exist"
120
- $SKIPPED = $SKIPPED + 1
115
+ puts_skipped "open_auth does not exist"
121
116
  rescue => e
122
- puts "FAIL: open_auth uri, creds, userdata, R/O flag, auth block expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
123
- $FAIL = $FAIL + 1
117
+ puts_fail "open_auth uri, creds, userdata, R/O flag, auth block expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
124
118
  end
125
119
 
126
- # TESTGROUP: Libvirt::event_register_impl
127
- expect_too_many_args(Libvirt, "event_register_impl", 1, 2, 3, 4, 5, 6, 7)
128
- expect_invalid_arg_type(Libvirt, "event_register_impl", 1)
129
-
130
- # symbol callbacks
131
- def virEventAddHandleImpl(fd, events, opaque)
132
- end
133
- def virEventUpdateHandleImpl(watch, event)
134
- end
135
- def virEventRemoveHandleImpl(handleID)
136
- end
137
- def virEventAddTimerImpl(interval, opaque)
138
- end
139
- def virEventUpdateTimerImpl(timer, timeout)
140
- end
141
- def virEventRemoveTimerImpl(timerID)
142
- end
143
-
144
- # proc callbacks
145
- virEventAddHandleProc = lambda {|fd, events, opaque|
146
- }
147
- virEventUpdateHandleProc = lambda {|watch, event|
148
- }
149
- virEventRemoveHandleProc = lambda {|handleID|
150
- }
151
- virEventAddTimerProc = lambda {|interval, opaque|
152
- }
153
- virEventUpdateTimerProc = lambda {|timer, timeout|
154
- }
155
- virEventRemoveTimerProc = lambda {|timerID|
156
- }
157
-
158
- expect_success(Libvirt, "all Symbol callbacks", "event_register_impl", :virEventAddHandleImpl, :virEventUpdateHandleImpl, :virEventRemoveHandleImpl, :virEventAddTimerImpl, :virEventUpdateTimerImpl, :virEventRemoveTimerImpl)
159
- expect_success(Libvirt, "unregister all callbacks", "event_register_impl", nil, nil, nil, nil, nil, nil)
160
- expect_success(Libvirt, "all Proc callbacks", "event_register_impl", virEventAddHandleProc, virEventUpdateHandleProc, virEventRemoveHandleProc, virEventAddTimerProc, virEventUpdateTimerProc, virEventRemoveTimerProc)
161
- expect_success(Libvirt, "unregister all callbacks", "event_register_impl")
162
-
163
120
  # TESTGROUP: Libvirt::event_invoke_handle_callback
164
121
  conn = Libvirt::open("qemu:///system")
165
122
 
@@ -200,4 +157,41 @@ expect_invalid_arg_type(Libvirt, "event_invoke_timeout_callback", 1, { "libvirt_
200
157
  expect_invalid_arg_type(Libvirt, "event_invoke_timeout_callback", 1, { "libvirt_cb" => conn, "opaque" => "hello" })
201
158
  conn.close
202
159
 
160
+ # TESTGROUP: Libvirt::event_register_impl
161
+ expect_too_many_args(Libvirt, "event_register_impl", 1, 2, 3, 4, 5, 6, 7)
162
+ expect_invalid_arg_type(Libvirt, "event_register_impl", 1)
163
+
164
+ # symbol callbacks
165
+ def virEventAddHandleImpl(fd, events, opaque)
166
+ end
167
+ def virEventUpdateHandleImpl(watch, event)
168
+ end
169
+ def virEventRemoveHandleImpl(handleID)
170
+ end
171
+ def virEventAddTimerImpl(interval, opaque)
172
+ end
173
+ def virEventUpdateTimerImpl(timer, timeout)
174
+ end
175
+ def virEventRemoveTimerImpl(timerID)
176
+ end
177
+
178
+ # proc callbacks
179
+ virEventAddHandleProc = lambda {|fd, events, opaque|
180
+ }
181
+ virEventUpdateHandleProc = lambda {|watch, event|
182
+ }
183
+ virEventRemoveHandleProc = lambda {|handleID|
184
+ }
185
+ virEventAddTimerProc = lambda {|interval, opaque|
186
+ }
187
+ virEventUpdateTimerProc = lambda {|timer, timeout|
188
+ }
189
+ virEventRemoveTimerProc = lambda {|timerID|
190
+ }
191
+
192
+ expect_success(Libvirt, "all Symbol callbacks", "event_register_impl", :virEventAddHandleImpl, :virEventUpdateHandleImpl, :virEventRemoveHandleImpl, :virEventAddTimerImpl, :virEventUpdateTimerImpl, :virEventRemoveTimerImpl)
193
+ expect_success(Libvirt, "unregister all callbacks", "event_register_impl", nil, nil, nil, nil, nil, nil)
194
+ expect_success(Libvirt, "all Proc callbacks", "event_register_impl", virEventAddHandleProc, virEventUpdateHandleProc, virEventRemoveHandleProc, virEventAddTimerProc, virEventUpdateTimerProc, virEventRemoveTimerProc)
195
+ expect_success(Libvirt, "unregister all callbacks", "event_register_impl")
196
+
203
197
  finish_tests
data/tests/test_secret.rb CHANGED
@@ -7,75 +7,19 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
- UUID = "bd339530-134c-6d07-4410-17fb90dad805"
11
-
12
10
  conn = Libvirt::open("qemu:///system")
13
11
 
14
- new_secret_xml = <<EOF
15
- <secret ephemeral='no' private='no'>
16
- <description>test secret</description>
17
- <uuid>#{UUID}</uuid>
18
- <usage type='volume'>
19
- <volume>/var/lib/libvirt/images/mail.img</volume>
20
- </usage>
21
- </secret>
22
- EOF
23
-
24
- # TESTGROUP: conn.num_of_secrets
25
- expect_too_many_args(conn, "num_of_secrets", 1)
26
- expect_success(conn, "no args", "num_of_secrets")
27
-
28
- # TESTGROUP: conn.list_secrets
29
- expect_too_many_args(conn, "list_secrets", 1)
30
- expect_success(conn, "no args", "list_secrets")
31
-
32
- # TESTGROUP: conn.lookup_secret_by_uuid
33
- newsecret = conn.define_secret_xml(new_secret_xml)
34
-
35
- expect_too_many_args(conn, "lookup_secret_by_uuid", 1, 2)
36
- expect_too_few_args(conn, "lookup_secret_by_uuid")
37
- expect_invalid_arg_type(conn, "lookup_secret_by_uuid", 1)
38
-
39
- expect_success(conn, "uuid arg", "lookup_secret_by_uuid", UUID) {|x| x.uuid == UUID}
40
-
41
- newsecret.undefine
42
-
43
- # TESTGROUP: conn.lookup_secret_by_usage
44
- newsecret = conn.define_secret_xml(new_secret_xml)
45
-
46
- expect_too_many_args(conn, "lookup_secret_by_usage", 1, 2, 3)
47
- expect_too_few_args(conn, "lookup_secret_by_usage")
48
- expect_invalid_arg_type(conn, "lookup_secret_by_usage", 'foo', 1)
49
- expect_invalid_arg_type(conn, "lookup_secret_by_usage", 1, 2)
50
- expect_fail(conn, Libvirt::RetrieveError, "invalid secret", "lookup_secret_by_usage", Libvirt::Secret::USAGE_TYPE_VOLUME, "foo")
51
-
52
- expect_success(conn, "usage type and key", "lookup_secret_by_usage", Libvirt::Secret::USAGE_TYPE_VOLUME, "/var/lib/libvirt/images/mail.img")
53
-
54
- newsecret.undefine
55
-
56
- # TESTGROUP: conn.define_secret_xml
57
- expect_too_many_args(conn, "define_secret_xml", 1, 2, 3)
58
- expect_too_few_args(conn, "define_secret_xml")
59
- expect_invalid_arg_type(conn, "define_secret_xml", 1)
60
- expect_invalid_arg_type(conn, "define_secret_xml", nil)
61
- expect_invalid_arg_type(conn, "define_secret_xml", "hello", 'foo')
62
- expect_fail(conn, Libvirt::DefinitionError, "invalid XML", "define_secret_xml", "hello")
63
-
64
- expect_success(conn, "secret XML", "define_secret_xml", new_secret_xml)
65
-
66
- newsecret.undefine
67
-
68
12
  # TESTGROUP: secret.uuid
69
- newsecret = conn.define_secret_xml(new_secret_xml)
13
+ newsecret = conn.define_secret_xml($new_secret_xml)
70
14
 
71
15
  expect_too_many_args(newsecret, "uuid", 1)
72
16
 
73
- expect_success(newsecret, "no args", "uuid") {|x| x == UUID}
17
+ expect_success(newsecret, "no args", "uuid") {|x| x == $SECRET_UUID}
74
18
 
75
19
  newsecret.undefine
76
20
 
77
21
  # TESTGROUP: secret.usagetype
78
- newsecret = conn.define_secret_xml(new_secret_xml)
22
+ newsecret = conn.define_secret_xml($new_secret_xml)
79
23
 
80
24
  expect_too_many_args(newsecret, "usagetype", 1)
81
25
 
@@ -84,7 +28,7 @@ expect_success(newsecret, "no args", "usagetype") {|x| x == Libvirt::Secret::USA
84
28
  newsecret.undefine
85
29
 
86
30
  # TESTGROUP: secret.usageid
87
- newsecret = conn.define_secret_xml(new_secret_xml)
31
+ newsecret = conn.define_secret_xml($new_secret_xml)
88
32
 
89
33
  expect_too_many_args(newsecret, "usageid", 1)
90
34
 
@@ -93,7 +37,7 @@ expect_success(newsecret, "no args", "usageid")
93
37
  newsecret.undefine
94
38
 
95
39
  # TESTGROUP: secret.xml_desc
96
- newsecret = conn.define_secret_xml(new_secret_xml)
40
+ newsecret = conn.define_secret_xml($new_secret_xml)
97
41
 
98
42
  expect_too_many_args(newsecret, "xml_desc", 1, 2)
99
43
  expect_invalid_arg_type(newsecret, "xml_desc", "foo")
@@ -103,7 +47,7 @@ expect_success(newsecret, "no args", "xml_desc")
103
47
  newsecret.undefine
104
48
 
105
49
  # TESTGROUP: secret.set_value
106
- newsecret = conn.define_secret_xml(new_secret_xml)
50
+ newsecret = conn.define_secret_xml($new_secret_xml)
107
51
 
108
52
  expect_too_many_args(newsecret, "set_value", 1, 2, 3)
109
53
  expect_too_few_args(newsecret, "set_value")
@@ -115,7 +59,7 @@ expect_success(newsecret, "value arg", "set_value", "foo")
115
59
  newsecret.undefine
116
60
 
117
61
  # TESTGROUP: secret.get_value
118
- newsecret = conn.define_secret_xml(new_secret_xml)
62
+ newsecret = conn.define_secret_xml($new_secret_xml)
119
63
  newsecret.set_value("foo")
120
64
 
121
65
  expect_too_many_args(newsecret, "get_value", 1, 2)
@@ -126,14 +70,14 @@ expect_success(newsecret, "no args", "get_value") {|x| x == 'foo'}
126
70
  newsecret.undefine
127
71
 
128
72
  # TESTGROUP: secret.undefine
129
- newsecret = conn.define_secret_xml(new_secret_xml)
73
+ newsecret = conn.define_secret_xml($new_secret_xml)
130
74
 
131
75
  expect_too_many_args(newsecret, "undefine", 1)
132
76
 
133
77
  expect_success(newsecret, "no args", "undefine")
134
78
 
135
79
  # TESTGROUP: secret.free
136
- newsecret = conn.define_secret_xml(new_secret_xml)
80
+ newsecret = conn.define_secret_xml($new_secret_xml)
137
81
  newsecret.undefine
138
82
 
139
83
  expect_too_many_args(newsecret, "free", 1)
@@ -7,8 +7,6 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
- UUID = "33a5c045-645a-2c00-e56b-927cdf34e17a"
11
-
12
10
  conn = Libvirt::open("qemu:///system")
13
11
 
14
12
  begin
@@ -20,17 +18,7 @@ rescue
20
18
  end
21
19
 
22
20
  # test setup
23
- `rm -rf /tmp/ruby-libvirt-tester; mkdir /tmp/ruby-libvirt-tester`
24
-
25
- new_storage_pool_xml = <<EOF
26
- <pool type="dir">
27
- <name>ruby-libvirt-tester</name>
28
- <uuid>#{UUID}</uuid>
29
- <target>
30
- <path>/tmp/ruby-libvirt-tester</path>
31
- </target>
32
- </pool>
33
- EOF
21
+ `rm -rf #{$POOL_PATH}; mkdir #{$POOL_PATH} ; echo $?`
34
22
 
35
23
  new_storage_vol_xml = <<EOF
36
24
  <volume>
@@ -54,58 +42,8 @@ new_storage_vol_xml_2 = <<EOF
54
42
  </volume>
55
43
  EOF
56
44
 
57
- # TESTGROUP: conn.list_storage_pools
58
- expect_too_many_args(conn, "list_storage_pools", 1)
59
- expect_success(conn, "no args", "list_storage_pools")
60
-
61
- # TESTGROUP: conn.num_of_storage_pools
62
- expect_too_many_args(conn, "num_of_storage_pools", 1)
63
- expect_success(conn, "no args", "num_of_storage_pools")
64
-
65
- # TESTGROUP: conn.list_defined_storage_pools
66
- expect_too_many_args(conn, "list_defined_storage_pools", 1)
67
- expect_success(conn, "no args", "list_defined_storage_pools")
68
-
69
- # TESTGROUP: conn.num_of_defined_storage_pools
70
- expect_too_many_args(conn, "num_of_defined_storage_pools", 1)
71
- expect_success(conn, "no args", "num_of_defined_storage_pools")
72
-
73
- # TESTGROUP: conn.lookup_storage_pool_by_name
74
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
75
-
76
- expect_too_many_args(conn, "lookup_storage_pool_by_name", 1, 2)
77
- expect_too_few_args(conn, "lookup_storage_pool_by_name")
78
- expect_invalid_arg_type(conn, "lookup_storage_pool_by_name", 1)
79
- expect_fail(conn, Libvirt::RetrieveError, "non-existent name arg", "lookup_storage_pool_by_name", "foobarbazsucker")
80
-
81
- expect_success(conn, "name arg", "lookup_storage_pool_by_name", "ruby-libvirt-tester")
82
-
83
- newpool.destroy
84
-
85
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
86
- expect_success(conn, "name arg", "lookup_storage_pool_by_name", "ruby-libvirt-tester")
87
- newpool.undefine
88
-
89
- # TESTGROUP: conn.lookup_storage_pool_by_uuid
90
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
91
-
92
- expect_too_many_args(conn, "lookup_storage_pool_by_uuid", 1, 2)
93
- expect_too_few_args(conn, "lookup_storage_pool_by_uuid")
94
- expect_invalid_arg_type(conn, "lookup_storage_pool_by_uuid", 1)
95
- expect_fail(conn, Libvirt::RetrieveError, "non-existent uuid arg", "lookup_storage_pool_by_uuid", "foobarbazsucker")
96
-
97
- expect_success(conn, "uuid arg", "lookup_storage_pool_by_uuid", UUID)
98
-
99
- newpool.destroy
100
-
101
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
102
-
103
- expect_success(conn, "uuid arg", "lookup_storage_pool_by_uuid", UUID)
104
-
105
- newpool.undefine
106
-
107
45
  # TESTGROUP: vol.pool
108
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
46
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
109
47
 
110
48
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
111
49
 
@@ -117,45 +55,8 @@ newvol.delete
117
55
 
118
56
  newpool.destroy
119
57
 
120
- # TESTGROUP: conn.create_storage_pool_xml
121
- expect_too_many_args(conn, "create_storage_pool_xml", new_storage_pool_xml, 0, 1)
122
- expect_too_few_args(conn, "create_storage_pool_xml")
123
- expect_invalid_arg_type(conn, "create_storage_pool_xml", nil)
124
- expect_invalid_arg_type(conn, "create_storage_pool_xml", 1)
125
- expect_invalid_arg_type(conn, "create_storage_pool_xml", new_storage_pool_xml, "foo")
126
- expect_fail(conn, Libvirt::Error, "invalid xml", "create_storage_pool_xml", "hello")
127
-
128
- expect_success(conn, "storage pool XML", "create_storage_pool_xml", new_storage_pool_xml)
129
-
130
- expect_fail(conn, Libvirt::Error, "already existing domain", "create_storage_pool_xml", new_storage_pool_xml)
131
-
132
- newpool.destroy
133
-
134
- # TESTGROUP: conn.define_storage_pool_xml
135
- expect_too_many_args(conn, "define_storage_pool_xml", new_storage_pool_xml, 0, 1)
136
- expect_too_few_args(conn, "define_storage_pool_xml")
137
- expect_invalid_arg_type(conn, "define_storage_pool_xml", nil)
138
- expect_invalid_arg_type(conn, "define_storage_pool_xml", 1)
139
- expect_invalid_arg_type(conn, "define_storage_pool_xml", new_storage_pool_xml, "foo")
140
- expect_fail(conn, Libvirt::Error, "invalid xml", "define_storage_pool_xml", "hello")
141
-
142
- expect_success(conn, "storage pool XML", "define_storage_pool_xml", new_storage_pool_xml)
143
-
144
- newpool.undefine
145
-
146
- # TESTGROUP: conn.discover_storage_pool_sources
147
- expect_too_many_args(conn, "discover_storage_pool_sources", 1, 2, 3, 4)
148
- expect_too_few_args(conn, "discover_storage_pool_sources")
149
- expect_invalid_arg_type(conn, "discover_storage_pool_sources", 1)
150
- expect_invalid_arg_type(conn, "discover_storage_pool_sources", "foo", 1)
151
- expect_invalid_arg_type(conn, "discover_storage_pool_sources", "foo", "bar", "baz")
152
-
153
- expect_fail(conn, Libvirt::Error, "invalid pool type", "discover_storage_pool_sources", "foo")
154
-
155
- expect_success(conn, "pool type", "discover_storage_pool_sources", "logical")
156
-
157
58
  # TESTGROUP: pool.build
158
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
59
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
159
60
 
160
61
  expect_too_many_args(newpool, "build", 1, 2)
161
62
  expect_invalid_arg_type(newpool, "build", 'foo')
@@ -165,14 +66,14 @@ expect_success(newpool, "no args", "build")
165
66
  newpool.undefine
166
67
 
167
68
  # TESTGROUP: pool.undefine
168
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
69
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
169
70
 
170
71
  expect_too_many_args(newpool, "undefine", 1)
171
72
 
172
73
  expect_success(newpool, "no args", "undefine")
173
74
 
174
75
  # TESTGROUP: pool.create
175
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
76
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
176
77
 
177
78
  expect_too_many_args(newpool, "create", 1, 2)
178
79
  expect_invalid_arg_type(newpool, "create", 'foo')
@@ -183,14 +84,14 @@ newpool.destroy
183
84
  newpool.undefine
184
85
 
185
86
  # TESTGROUP: pool.destroy
186
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
87
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
187
88
 
188
89
  expect_too_many_args(newpool, "destroy", 1)
189
90
 
190
91
  expect_success(newpool, "no args", "destroy")
191
92
 
192
93
  # TESTGROUP: pool.delete
193
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
94
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
194
95
 
195
96
  expect_too_many_args(newpool, "delete", 1, 2)
196
97
  expect_invalid_arg_type(newpool, "delete", 'foo')
@@ -202,7 +103,7 @@ expect_success(newpool, "no args", "delete")
202
103
  newpool.undefine
203
104
 
204
105
  # TESTGROUP: pool.refresh
205
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
106
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
206
107
 
207
108
  expect_too_many_args(newpool, "refresh", 1, 2)
208
109
  expect_invalid_arg_type(newpool, "refresh", 'foo')
@@ -212,7 +113,7 @@ expect_success(newpool, "no args", "refresh")
212
113
  newpool.destroy
213
114
 
214
115
  # TESTGROUP: pool.name
215
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
116
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
216
117
 
217
118
  expect_too_many_args(newpool, "name", 1)
218
119
 
@@ -221,16 +122,16 @@ expect_success(newpool, "no args", "name") {|x| x == "ruby-libvirt-tester"}
221
122
  newpool.destroy
222
123
 
223
124
  # TESTGROUP: pool.uuid
224
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
125
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
225
126
 
226
127
  expect_too_many_args(newpool, "uuid", 1)
227
128
 
228
- expect_success(newpool, "no args", "uuid") {|x| x == UUID}
129
+ expect_success(newpool, "no args", "uuid") {|x| x == $POOL_UUID}
229
130
 
230
131
  newpool.destroy
231
132
 
232
133
  # TESTGROUP: pool.info
233
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
134
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
234
135
 
235
136
  expect_too_many_args(newpool, "info", 1)
236
137
 
@@ -239,7 +140,7 @@ expect_success(newpool, "no args", "info")
239
140
  newpool.destroy
240
141
 
241
142
  # TESTGROUP: pool.xml_desc
242
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
143
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
243
144
 
244
145
  expect_too_many_args(newpool, "xml_desc", 1, 2)
245
146
  expect_invalid_arg_type(newpool, "xml_desc", "foo")
@@ -249,7 +150,7 @@ expect_success(newpool, "no args", "xml_desc")
249
150
  newpool.destroy
250
151
 
251
152
  # TESTGROUP: pool.autostart?
252
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
153
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
253
154
 
254
155
  expect_too_many_args(newpool, "autostart?", 1)
255
156
 
@@ -262,7 +163,7 @@ expect_success(newpool, "no args", "autostart?") {|x| x == true}
262
163
  newpool.undefine
263
164
 
264
165
  # TESTGROUP: pool.autostart=
265
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
166
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
266
167
 
267
168
  expect_too_many_args(newpool, "autostart=", 1, 2)
268
169
  expect_invalid_arg_type(newpool, "autostart=", 'foo')
@@ -286,7 +187,7 @@ end
286
187
  newpool.undefine
287
188
 
288
189
  # TESTGROUP: pool.num_of_volumes
289
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
190
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
290
191
 
291
192
  expect_too_many_args(newpool, "num_of_volumes", 1)
292
193
 
@@ -295,7 +196,7 @@ expect_success(newpool, "no args", "num_of_volumes") {|x| x == 0}
295
196
  newpool.destroy
296
197
 
297
198
  # TESTGROUP: pool.list_volumes
298
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
199
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
299
200
 
300
201
  expect_too_many_args(newpool, "list_volumes", 1)
301
202
 
@@ -304,14 +205,14 @@ expect_success(newpool, "no args", "list_volumes")
304
205
  newpool.destroy
305
206
 
306
207
  # TESTGROUP: pool.free
307
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
208
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
308
209
  newpool.undefine
309
210
  expect_too_many_args(newpool, "free", 1)
310
211
 
311
212
  expect_success(newpool, "no args", "free")
312
213
 
313
214
  # TESTGROUP: pool.lookup_volume_by_name
314
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
215
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
315
216
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
316
217
 
317
218
  expect_too_many_args(newpool, "lookup_volume_by_name", 1, 2)
@@ -326,7 +227,7 @@ newvol.delete
326
227
  newpool.destroy
327
228
 
328
229
  # TESTGROUP: pool.lookup_volume_by_key
329
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
230
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
330
231
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
331
232
 
332
233
  expect_too_many_args(newpool, "lookup_volume_by_key", 1, 2)
@@ -341,7 +242,7 @@ newvol.delete
341
242
  newpool.destroy
342
243
 
343
244
  # TESTGROUP: pool.lookup_volume_by_path
344
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
245
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
345
246
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
346
247
 
347
248
  expect_too_many_args(newpool, "lookup_volume_by_path", 1, 2)
@@ -356,7 +257,7 @@ newvol.delete
356
257
  newpool.destroy
357
258
 
358
259
  # TESTGROUP: vol.name
359
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
260
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
360
261
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
361
262
 
362
263
  expect_too_many_args(newvol, "name", 1)
@@ -367,7 +268,7 @@ newvol.delete
367
268
  newpool.destroy
368
269
 
369
270
  # TESTGROUP: vol.key
370
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
271
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
371
272
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
372
273
 
373
274
  expect_too_many_args(newvol, "key", 1)
@@ -378,7 +279,7 @@ newvol.delete
378
279
  newpool.destroy
379
280
 
380
281
  # TESTGROUP: pool.create_volume_xml
381
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
282
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
382
283
 
383
284
  expect_too_many_args(newpool, "create_volume_xml", new_storage_vol_xml, 0, 1)
384
285
  expect_too_few_args(newpool, "create_volume_xml")
@@ -395,7 +296,7 @@ newvol.delete
395
296
  newpool.destroy
396
297
 
397
298
  # TESTGROUP: pool.create_volume_xml_from
398
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
299
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
399
300
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
400
301
 
401
302
  expect_too_many_args(newpool, "create_volume_xml_from", new_storage_vol_xml_2, 0, 1, 2)
@@ -414,7 +315,7 @@ newvol.delete
414
315
  newpool.destroy
415
316
 
416
317
  # TESTGROUP: pool.active?
417
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
318
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
418
319
 
419
320
  expect_too_many_args(newpool, "active?", 1)
420
321
 
@@ -422,7 +323,7 @@ expect_success(newpool, "no args", "active?") {|x| x == true}
422
323
 
423
324
  newpool.destroy
424
325
 
425
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
326
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
426
327
 
427
328
  expect_success(newpool, "no args", "active?") {|x| x == false}
428
329
 
@@ -434,7 +335,7 @@ newpool.destroy
434
335
  newpool.undefine
435
336
 
436
337
  # TESTGROUP: pool.persistent?
437
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
338
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
438
339
  sleep 1
439
340
 
440
341
  expect_too_many_args(newpool, "persistent?", 1)
@@ -443,14 +344,14 @@ expect_success(newpool, "no args", "persistent?") {|x| x == false}
443
344
 
444
345
  newpool.destroy
445
346
 
446
- newpool = conn.define_storage_pool_xml(new_storage_pool_xml)
347
+ newpool = conn.define_storage_pool_xml($new_storage_pool_xml)
447
348
 
448
349
  expect_success(newpool, "no args", "persistent?") {|x| x == true}
449
350
 
450
351
  newpool.undefine
451
352
 
452
353
  # TESTGROUP: vol.delete
453
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
354
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
454
355
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
455
356
 
456
357
  expect_too_many_args(newvol, "delete", 1, 2)
@@ -461,7 +362,7 @@ expect_success(newvol, "no args", "delete")
461
362
  newpool.destroy
462
363
 
463
364
  # TESTGROUP: vol.wipe
464
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
365
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
465
366
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
466
367
 
467
368
  expect_too_many_args(newvol, "wipe", 1, 2)
@@ -473,7 +374,7 @@ newvol.delete
473
374
  newpool.destroy
474
375
 
475
376
  # TESTGROUP: vol.info
476
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
377
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
477
378
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
478
379
 
479
380
  expect_too_many_args(newvol, "info", 1)
@@ -484,7 +385,7 @@ newvol.delete
484
385
  newpool.destroy
485
386
 
486
387
  # TESTGROUP: vol.xml_desc
487
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
388
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
488
389
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
489
390
 
490
391
  expect_too_many_args(newvol, "xml_desc", 1, 2)
@@ -496,7 +397,7 @@ newvol.delete
496
397
  newpool.destroy
497
398
 
498
399
  # TESTGROUP: vol.path
499
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
400
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
500
401
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
501
402
 
502
403
  expect_too_many_args(newvol, "path", 1)
@@ -507,7 +408,7 @@ newvol.delete
507
408
  newpool.destroy
508
409
 
509
410
  # TESTGROUP: vol.free
510
- newpool = conn.create_storage_pool_xml(new_storage_pool_xml)
411
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
511
412
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
512
413
  newvol.delete
513
414