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/ext/libvirt/network.c
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* network.c: virNetwork methods
|
3
3
|
*
|
4
4
|
* Copyright (C) 2007,2010 Red Hat Inc.
|
5
|
-
* Copyright (C) 2013 Chris Lalancette <clalancette@gmail.com>
|
5
|
+
* Copyright (C) 2013,2014 Chris Lalancette <clalancette@gmail.com>
|
6
6
|
*
|
7
7
|
* This library is free software; you can redistribute it and/or
|
8
8
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -107,7 +107,7 @@ static VALUE libvirt_network_destroy(VALUE n)
|
|
107
107
|
|
108
108
|
/*
|
109
109
|
* call-seq:
|
110
|
-
* net.name ->
|
110
|
+
* net.name -> String
|
111
111
|
*
|
112
112
|
* Call virNetworkGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetName]
|
113
113
|
* to retrieve the name of this network.
|
@@ -121,7 +121,7 @@ static VALUE libvirt_network_name(VALUE n)
|
|
121
121
|
|
122
122
|
/*
|
123
123
|
* call-seq:
|
124
|
-
* net.uuid ->
|
124
|
+
* net.uuid -> String
|
125
125
|
*
|
126
126
|
* Call virNetworkGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetUUIDString]
|
127
127
|
* to retrieve the UUID of this network.
|
@@ -134,7 +134,7 @@ static VALUE libvirt_network_uuid(VALUE n)
|
|
134
134
|
|
135
135
|
/*
|
136
136
|
* call-seq:
|
137
|
-
* net.xml_desc(flags=0) ->
|
137
|
+
* net.xml_desc(flags=0) -> String
|
138
138
|
*
|
139
139
|
* Call virNetworkGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetXMLDesc]
|
140
140
|
* to retrieve the XML for this network.
|
@@ -153,7 +153,7 @@ static VALUE libvirt_network_xml_desc(int argc, VALUE *argv, VALUE n)
|
|
153
153
|
|
154
154
|
/*
|
155
155
|
* call-seq:
|
156
|
-
* net.bridge_name ->
|
156
|
+
* net.bridge_name -> String
|
157
157
|
*
|
158
158
|
* Call virNetworkGetBridgeName[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetBridgeName]
|
159
159
|
* to retrieve the bridge name for this network.
|
@@ -246,6 +246,84 @@ static VALUE libvirt_network_persistent_p(VALUE n)
|
|
246
246
|
}
|
247
247
|
#endif
|
248
248
|
|
249
|
+
#if HAVE_VIRNETWORKGETDHCPLEASES
|
250
|
+
struct leases_arg {
|
251
|
+
virNetworkDHCPLeasePtr *leases;
|
252
|
+
int nleases;
|
253
|
+
};
|
254
|
+
|
255
|
+
static VALUE leases_wrap(VALUE arg)
|
256
|
+
{
|
257
|
+
struct leases_arg *e = (struct leases_arg *)arg;
|
258
|
+
VALUE result, hash;
|
259
|
+
virNetworkDHCPLeasePtr lease;
|
260
|
+
int i;
|
261
|
+
|
262
|
+
result = rb_ary_new2(e->nleases);
|
263
|
+
|
264
|
+
for (i = 0; i < e->nleases; i++) {
|
265
|
+
lease = e->leases[i];
|
266
|
+
|
267
|
+
hash = rb_hash_new();
|
268
|
+
rb_hash_aset(hash, rb_str_new2("iface"), rb_str_new2(lease->iface));
|
269
|
+
rb_hash_aset(hash, rb_str_new2("expirytime"),
|
270
|
+
LL2NUM(lease->expirytime));
|
271
|
+
rb_hash_aset(hash, rb_str_new2("type"), INT2NUM(lease->type));
|
272
|
+
rb_hash_aset(hash, rb_str_new2("mac"), rb_str_new2(lease->mac));
|
273
|
+
rb_hash_aset(hash, rb_str_new2("iaid"), rb_str_new2(lease->iaid));
|
274
|
+
rb_hash_aset(hash, rb_str_new2("ipaddr"), rb_str_new2(lease->ipaddr));
|
275
|
+
rb_hash_aset(hash, rb_str_new2("prefix"), UINT2NUM(lease->prefix));
|
276
|
+
rb_hash_aset(hash, rb_str_new2("hostname"),
|
277
|
+
rb_str_new2(lease->hostname));
|
278
|
+
rb_hash_aset(hash, rb_str_new2("clientid"),
|
279
|
+
rb_str_new2(lease->clientid));
|
280
|
+
|
281
|
+
rb_ary_store(result, i, hash);
|
282
|
+
}
|
283
|
+
|
284
|
+
return result;
|
285
|
+
}
|
286
|
+
|
287
|
+
/*
|
288
|
+
* call-seq:
|
289
|
+
* net.dhcp_leases(mac=nil, flags=0) -> Hash
|
290
|
+
*
|
291
|
+
* Call virNetworkGetDHCPLeases[http://www.libvirt.org/html/libvirt-libvirt.html#virNetworkGetDHCPLeases]
|
292
|
+
* to retrieve the leases for this network.
|
293
|
+
*/
|
294
|
+
static VALUE libvirt_network_get_dhcp_leases(int argc, VALUE *argv, VALUE n)
|
295
|
+
{
|
296
|
+
VALUE mac, flags, result;
|
297
|
+
int nleases, i = 0, exception = 0;
|
298
|
+
virNetworkDHCPLeasePtr *leases = NULL;
|
299
|
+
struct leases_arg args;
|
300
|
+
|
301
|
+
rb_scan_args(argc, argv, "02", &mac, &flags);
|
302
|
+
|
303
|
+
nleases = virNetworkGetDHCPLeases(network_get(n),
|
304
|
+
ruby_libvirt_get_cstring_or_null(mac),
|
305
|
+
&leases,
|
306
|
+
ruby_libvirt_value_to_uint(flags));
|
307
|
+
ruby_libvirt_raise_error_if(nleases < 0, e_Error, "virNetworkGetDHCPLeases",
|
308
|
+
ruby_libvirt_connect_get(n));
|
309
|
+
|
310
|
+
args.leases = leases;
|
311
|
+
args.nleases = nleases;
|
312
|
+
result = rb_protect(leases_wrap, (VALUE)&args, &exception);
|
313
|
+
|
314
|
+
for (i = 0; i < nleases; i++) {
|
315
|
+
virNetworkDHCPLeaseFree(leases[i]);
|
316
|
+
}
|
317
|
+
free(leases);
|
318
|
+
|
319
|
+
if (exception) {
|
320
|
+
rb_jump_tag(exception);
|
321
|
+
}
|
322
|
+
|
323
|
+
return result;
|
324
|
+
}
|
325
|
+
#endif
|
326
|
+
|
249
327
|
#endif
|
250
328
|
|
251
329
|
/*
|
@@ -450,5 +528,20 @@ void ruby_libvirt_network_init(void)
|
|
450
528
|
INT2NUM(VIR_NETWORK_UPDATE_COMMAND_DELETE));
|
451
529
|
#endif
|
452
530
|
|
531
|
+
#if HAVE_VIRNETWORKGETDHCPLEASES
|
532
|
+
rb_define_method(c_network, "dhcp_leases",
|
533
|
+
libvirt_network_get_dhcp_leases, -1);
|
534
|
+
#endif
|
535
|
+
|
536
|
+
#if HAVE_CONST_VIR_IP_ADDR_TYPE_IPV4
|
537
|
+
rb_define_const(c_network, "IP_ADDR_TYPE_IPV4",
|
538
|
+
INT2NUM(VIR_IP_ADDR_TYPE_IPV4));
|
539
|
+
#endif
|
540
|
+
|
541
|
+
#if HAVE_CONST_VIR_IP_ADDR_TYPE_IPV6
|
542
|
+
rb_define_const(c_network, "IP_ADDR_TYPE_IPV6",
|
543
|
+
INT2NUM(VIR_IP_ADDR_TYPE_IPV6));
|
544
|
+
#endif
|
545
|
+
|
453
546
|
#endif
|
454
547
|
}
|
data/ext/libvirt/nodedevice.c
CHANGED
@@ -46,7 +46,7 @@ VALUE ruby_libvirt_nodedevice_new(virNodeDevicePtr n, VALUE conn)
|
|
46
46
|
|
47
47
|
/*
|
48
48
|
* call-seq:
|
49
|
-
* nodedevice.name ->
|
49
|
+
* nodedevice.name -> String
|
50
50
|
*
|
51
51
|
* Call virNodeDeviceGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetName]
|
52
52
|
* to retrieve the name of the node device.
|
@@ -60,7 +60,7 @@ static VALUE libvirt_nodedevice_name(VALUE c)
|
|
60
60
|
|
61
61
|
/*
|
62
62
|
* call-seq:
|
63
|
-
* nodedevice.parent ->
|
63
|
+
* nodedevice.parent -> String
|
64
64
|
*
|
65
65
|
* Call virNodeDeviceGetParent[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetParent]
|
66
66
|
* to retrieve the parent of the node device.
|
@@ -85,7 +85,7 @@ static VALUE libvirt_nodedevice_parent(VALUE c)
|
|
85
85
|
|
86
86
|
/*
|
87
87
|
* call-seq:
|
88
|
-
* nodedevice.num_of_caps ->
|
88
|
+
* nodedevice.num_of_caps -> Fixnum
|
89
89
|
*
|
90
90
|
* Call virNodeDeviceNumOfCaps[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceNumOfCaps]
|
91
91
|
* to retrieve the number of capabilities of the node device.
|
@@ -129,7 +129,7 @@ static VALUE libvirt_nodedevice_list_caps(VALUE c)
|
|
129
129
|
|
130
130
|
/*
|
131
131
|
* call-seq:
|
132
|
-
* nodedevice.xml_desc(flags=0) ->
|
132
|
+
* nodedevice.xml_desc(flags=0) -> String
|
133
133
|
*
|
134
134
|
* Call virNodeDeviceGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virNodeDeviceGetXMLDesc]
|
135
135
|
* to retrieve the XML for the node device.
|
data/ext/libvirt/nwfilter.c
CHANGED
@@ -60,7 +60,7 @@ static VALUE libvirt_nwfilter_undefine(VALUE n)
|
|
60
60
|
|
61
61
|
/*
|
62
62
|
* call-seq:
|
63
|
-
* nwfilter.name ->
|
63
|
+
* nwfilter.name -> String
|
64
64
|
*
|
65
65
|
* Call virNWFilterGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virNWFilterGetName]
|
66
66
|
* to retrieve the network filter name.
|
@@ -74,7 +74,7 @@ static VALUE libvirt_nwfilter_name(VALUE n)
|
|
74
74
|
|
75
75
|
/*
|
76
76
|
* call-seq:
|
77
|
-
* nwfilter.uuid ->
|
77
|
+
* nwfilter.uuid -> String
|
78
78
|
*
|
79
79
|
* Call virNWFilterGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virNWFilterGetUUIDString]
|
80
80
|
* to retrieve the network filter UUID.
|
@@ -87,7 +87,7 @@ static VALUE libvirt_nwfilter_uuid(VALUE n)
|
|
87
87
|
|
88
88
|
/*
|
89
89
|
* call-seq:
|
90
|
-
* nwfilter.xml_desc(flags=0) ->
|
90
|
+
* nwfilter.xml_desc(flags=0) -> String
|
91
91
|
*
|
92
92
|
* Call virNWFilterGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virNWFilterGetXMLDesc]
|
93
93
|
* to retrieve the XML for this network filter.
|
data/ext/libvirt/secret.c
CHANGED
@@ -46,7 +46,7 @@ VALUE ruby_libvirt_secret_new(virSecretPtr s, VALUE conn)
|
|
46
46
|
|
47
47
|
/*
|
48
48
|
* call-seq:
|
49
|
-
* secret.uuid ->
|
49
|
+
* secret.uuid -> String
|
50
50
|
*
|
51
51
|
* Call virSecretGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUUIDString]
|
52
52
|
* to retrieve the UUID for this secret.
|
@@ -59,7 +59,7 @@ static VALUE libvirt_secret_uuid(VALUE s)
|
|
59
59
|
|
60
60
|
/*
|
61
61
|
* call-seq:
|
62
|
-
* secret.usagetype ->
|
62
|
+
* secret.usagetype -> Fixnum
|
63
63
|
*
|
64
64
|
* Call virSecretGetUsageType[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUsageType]
|
65
65
|
* to retrieve the usagetype for this secret.
|
@@ -73,7 +73,7 @@ static VALUE libvirt_secret_usagetype(VALUE s)
|
|
73
73
|
|
74
74
|
/*
|
75
75
|
* call-seq:
|
76
|
-
* secret.usageid ->
|
76
|
+
* secret.usageid -> String
|
77
77
|
*
|
78
78
|
* Call virSecretGetUsageID[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUsageID]
|
79
79
|
* to retrieve the usageid for this secret.
|
@@ -87,7 +87,7 @@ static VALUE libvirt_secret_usageid(VALUE s)
|
|
87
87
|
|
88
88
|
/*
|
89
89
|
* call-seq:
|
90
|
-
* secret.xml_desc(flags=0) ->
|
90
|
+
* secret.xml_desc(flags=0) -> String
|
91
91
|
*
|
92
92
|
* Call virSecretGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetXMLDesc]
|
93
93
|
* to retrieve the XML for this secret.
|
@@ -166,7 +166,7 @@ static VALUE libvirt_secret_value_equal(VALUE s, VALUE in)
|
|
166
166
|
|
167
167
|
/*
|
168
168
|
* call-seq:
|
169
|
-
* secret.value(flags=0) ->
|
169
|
+
* secret.value(flags=0) -> String
|
170
170
|
*
|
171
171
|
* Call virSecretGetValue[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetValue]
|
172
172
|
* to retrieve the value from this secret.
|
data/ext/libvirt/storage.c
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* storage.c: virStoragePool and virStorageVolume methods
|
3
3
|
*
|
4
4
|
* Copyright (C) 2007,2010 Red Hat Inc.
|
5
|
-
* Copyright (C) 2013 Chris Lalancette <clalancette@gmail.com>
|
5
|
+
* Copyright (C) 2013,2014 Chris Lalancette <clalancette@gmail.com>
|
6
6
|
*
|
7
7
|
* This library is free software; you can redistribute it and/or
|
8
8
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -186,7 +186,7 @@ static VALUE libvirt_storage_pool_refresh(int argc, VALUE *argv, VALUE p)
|
|
186
186
|
|
187
187
|
/*
|
188
188
|
* call-seq:
|
189
|
-
* pool.name ->
|
189
|
+
* pool.name -> String
|
190
190
|
*
|
191
191
|
* Call virStoragePoolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetName]
|
192
192
|
* to retrieve the name of this storage pool.
|
@@ -200,7 +200,7 @@ static VALUE libvirt_storage_pool_name(VALUE p)
|
|
200
200
|
|
201
201
|
/*
|
202
202
|
* call-seq:
|
203
|
-
* pool.uuid ->
|
203
|
+
* pool.uuid -> String
|
204
204
|
*
|
205
205
|
* Call virStoragePoolGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetUUIDString]
|
206
206
|
* to retrieve the UUID of this storage pool.
|
@@ -240,7 +240,7 @@ static VALUE libvirt_storage_pool_info(VALUE p)
|
|
240
240
|
|
241
241
|
/*
|
242
242
|
* call-seq:
|
243
|
-
* pool.xml_desc(flags=0) ->
|
243
|
+
* pool.xml_desc(flags=0) -> String
|
244
244
|
*
|
245
245
|
* Call virStoragePoolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetXMLDesc]
|
246
246
|
* to retrieve the XML for this storage pool.
|
@@ -297,7 +297,7 @@ static VALUE libvirt_storage_pool_autostart_equal(VALUE p, VALUE autostart)
|
|
297
297
|
|
298
298
|
/*
|
299
299
|
* call-seq:
|
300
|
-
* pool.num_of_volumes ->
|
300
|
+
* pool.num_of_volumes -> Fixnum
|
301
301
|
*
|
302
302
|
* Call virStoragePoolNumOfVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolNumOfVolumes]
|
303
303
|
* to retrieve the number of volumes in this storage pool.
|
@@ -438,7 +438,7 @@ static VALUE libvirt_storage_pool_lookup_vol_by_path(VALUE p, VALUE path)
|
|
438
438
|
#if HAVE_VIRSTORAGEPOOLLISTALLVOLUMES
|
439
439
|
/*
|
440
440
|
* call-seq:
|
441
|
-
* pool.list_all_volumes(flags=0) ->
|
441
|
+
* pool.list_all_volumes(flags=0) -> Array
|
442
442
|
*
|
443
443
|
* Call virStoragePoolListAllVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolListAllVolumes]
|
444
444
|
* to get an array of volume objects for all volumes.
|
@@ -455,7 +455,7 @@ static VALUE libvirt_storage_pool_list_all_volumes(int argc, VALUE *argv,
|
|
455
455
|
|
456
456
|
/*
|
457
457
|
* call-seq:
|
458
|
-
* vol.name ->
|
458
|
+
* vol.name -> String
|
459
459
|
*
|
460
460
|
* Call virStorageVolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetName]
|
461
461
|
* to retrieve the name of this storage volume.
|
@@ -469,7 +469,7 @@ static VALUE libvirt_storage_vol_name(VALUE v)
|
|
469
469
|
|
470
470
|
/*
|
471
471
|
* call-seq:
|
472
|
-
* vol.key ->
|
472
|
+
* vol.key -> String
|
473
473
|
*
|
474
474
|
* Call virStorageVolGetKey[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetKey]
|
475
475
|
* to retrieve the key for this storage volume.
|
@@ -498,7 +498,7 @@ static VALUE libvirt_storage_pool_create_volume_xml(int argc, VALUE *argv,
|
|
498
498
|
|
499
499
|
vol = virStorageVolCreateXML(pool_get(p), StringValueCStr(xml),
|
500
500
|
ruby_libvirt_value_to_uint(flags));
|
501
|
-
ruby_libvirt_raise_error_if(vol == NULL, e_Error, "
|
501
|
+
ruby_libvirt_raise_error_if(vol == NULL, e_Error, "virStorageVolCreateXML",
|
502
502
|
ruby_libvirt_connect_get(p));
|
503
503
|
|
504
504
|
return vol_new(vol, ruby_libvirt_conn_attr(p));
|
@@ -525,7 +525,7 @@ static VALUE libvirt_storage_pool_create_volume_xml_from(int argc, VALUE *argv,
|
|
525
525
|
vol_get(cloneval),
|
526
526
|
ruby_libvirt_value_to_uint(flags));
|
527
527
|
ruby_libvirt_raise_error_if(vol == NULL, e_Error,
|
528
|
-
"
|
528
|
+
"virStorageVolCreateXMLFrom",
|
529
529
|
ruby_libvirt_connect_get(p));
|
530
530
|
|
531
531
|
return vol_new(vol, ruby_libvirt_conn_attr(p));
|
@@ -631,7 +631,7 @@ static VALUE libvirt_storage_vol_info(VALUE v)
|
|
631
631
|
|
632
632
|
/*
|
633
633
|
* call-seq:
|
634
|
-
* vol.xml_desc(flags=0) ->
|
634
|
+
* vol.xml_desc(flags=0) -> String
|
635
635
|
*
|
636
636
|
* Call virStorageVolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetXMLDesc]
|
637
637
|
* to retrieve the xml for this storage volume.
|
@@ -650,7 +650,7 @@ static VALUE libvirt_storage_vol_xml_desc(int argc, VALUE *argv, VALUE v)
|
|
650
650
|
|
651
651
|
/*
|
652
652
|
* call-seq:
|
653
|
-
* vol.path ->
|
653
|
+
* vol.path -> String
|
654
654
|
*
|
655
655
|
* Call virStorageVolGetPath[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetPath]
|
656
656
|
* to retrieve the path for this storage volume.
|
@@ -913,6 +913,9 @@ void ruby_libvirt_storage_init(void)
|
|
913
913
|
#if HAVE_CONST_VIR_STORAGE_VOL_NETWORK
|
914
914
|
rb_define_const(c_storage_vol, "NETWORK", INT2NUM(VIR_STORAGE_VOL_NETWORK));
|
915
915
|
#endif
|
916
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_NETDIR
|
917
|
+
rb_define_const(c_storage_vol, "NETDIR", INT2NUM(VIR_STORAGE_VOL_NETDIR));
|
918
|
+
#endif
|
916
919
|
|
917
920
|
/* virStorageVolDeleteFlags */
|
918
921
|
rb_define_const(c_storage_vol, "DELETE_NORMAL",
|
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`
|
@@ -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
|
@@ -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
@@ -220,7 +220,7 @@ newdom.undefine
|
|
220
220
|
|
221
221
|
newdom = conn.create_domain_xml($new_dom_xml)
|
222
222
|
sleep 1
|
223
|
-
expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_set_max_downtime", 10)
|
223
|
+
#expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_set_max_downtime", 10)
|
224
224
|
|
225
225
|
#newdom.migrate_to_uri("qemu://remote/system")
|
226
226
|
#expect_success(newdom, "10 second downtime", "migrate_set_max_downtime", 10)
|
@@ -603,7 +603,7 @@ sleep 1
|
|
603
603
|
|
604
604
|
expect_too_many_args(newdom, "name", 1)
|
605
605
|
|
606
|
-
expect_success(newdom, "no args", "name") {|x| x == "
|
606
|
+
expect_success(newdom, "no args", "name") {|x| x == "rb-libvirt-test"}
|
607
607
|
|
608
608
|
newdom.destroy
|
609
609
|
|
@@ -1187,7 +1187,7 @@ newdom.undefine
|
|
1187
1187
|
|
1188
1188
|
newdom = conn.create_domain_xml($new_dom_xml)
|
1189
1189
|
sleep 1
|
1190
|
-
expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_max_downtime=", 10)
|
1190
|
+
#expect_fail(newdom, Libvirt::Error, "while no migration in progress", "migrate_max_downtime=", 10)
|
1191
1191
|
|
1192
1192
|
# FIXME: get this working
|
1193
1193
|
#newdom.migrate_to_uri("qemu://remote/system")
|