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.
@@ -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-2016 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
@@ -64,7 +64,7 @@ VALUE pool_new(virStoragePoolPtr p, VALUE conn)
64
64
  * call-seq:
65
65
  * vol.pool -> Libvirt::StoragePool
66
66
  *
67
- * Call virStoragePoolLookupByVolume[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolLookupByVolume]
67
+ * Call virStoragePoolLookupByVolume[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolLookupByVolume]
68
68
  * to retrieve the storage pool for this volume.
69
69
  */
70
70
  static VALUE libvirt_storage_vol_pool(VALUE v)
@@ -83,12 +83,12 @@ static VALUE libvirt_storage_vol_pool(VALUE v)
83
83
  * call-seq:
84
84
  * pool.build(flags=0) -> nil
85
85
  *
86
- * Call virStoragePoolBuild[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolBuild]
86
+ * Call virStoragePoolBuild[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolBuild]
87
87
  * to build this storage pool.
88
88
  */
89
89
  static VALUE libvirt_storage_pool_build(int argc, VALUE *argv, VALUE p)
90
90
  {
91
- VALUE flags;
91
+ VALUE flags = RUBY_Qnil;
92
92
 
93
93
  rb_scan_args(argc, argv, "01", &flags);
94
94
 
@@ -102,7 +102,7 @@ static VALUE libvirt_storage_pool_build(int argc, VALUE *argv, VALUE p)
102
102
  * call-seq:
103
103
  * pool.undefine -> nil
104
104
  *
105
- * Call virStoragePoolUndefine[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolUndefine]
105
+ * Call virStoragePoolUndefine[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolUndefine]
106
106
  * to undefine this storage pool.
107
107
  */
108
108
  static VALUE libvirt_storage_pool_undefine(VALUE p)
@@ -116,12 +116,12 @@ static VALUE libvirt_storage_pool_undefine(VALUE p)
116
116
  * call-seq:
117
117
  * pool.create(flags=0) -> nil
118
118
  *
119
- * Call virStoragePoolCreate[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolCreate]
119
+ * Call virStoragePoolCreate[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolCreate]
120
120
  * to start this storage pool.
121
121
  */
122
122
  static VALUE libvirt_storage_pool_create(int argc, VALUE *argv, VALUE p)
123
123
  {
124
- VALUE flags;
124
+ VALUE flags = RUBY_Qnil;
125
125
 
126
126
  rb_scan_args(argc, argv, "01", &flags);
127
127
 
@@ -135,7 +135,7 @@ static VALUE libvirt_storage_pool_create(int argc, VALUE *argv, VALUE p)
135
135
  * call-seq:
136
136
  * pool.destroy -> nil
137
137
  *
138
- * Call virStoragePoolDestroy[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolDestroy]
138
+ * Call virStoragePoolDestroy[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolDestroy]
139
139
  * to shutdown this storage pool.
140
140
  */
141
141
  static VALUE libvirt_storage_pool_destroy(VALUE p)
@@ -149,13 +149,13 @@ static VALUE libvirt_storage_pool_destroy(VALUE p)
149
149
  * call-seq:
150
150
  * pool.delete(flags=0) -> nil
151
151
  *
152
- * Call virStoragePoolDelete[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolDelete]
152
+ * Call virStoragePoolDelete[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolDelete]
153
153
  * to delete the data corresponding to this data pool. This is a destructive
154
154
  * operation.
155
155
  */
156
156
  static VALUE libvirt_storage_pool_delete(int argc, VALUE *argv, VALUE p)
157
157
  {
158
- VALUE flags;
158
+ VALUE flags = RUBY_Qnil;
159
159
 
160
160
  rb_scan_args(argc, argv, "01", &flags);
161
161
 
@@ -169,12 +169,12 @@ static VALUE libvirt_storage_pool_delete(int argc, VALUE *argv, VALUE p)
169
169
  * call-seq:
170
170
  * pool.refresh(flags=0) -> nil
171
171
  *
172
- * Call virStoragePoolRefresh[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolRefresh]
172
+ * Call virStoragePoolRefresh[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolRefresh]
173
173
  * to refresh the list of volumes in this storage pool.
174
174
  */
175
175
  static VALUE libvirt_storage_pool_refresh(int argc, VALUE *argv, VALUE p)
176
176
  {
177
- VALUE flags;
177
+ VALUE flags = RUBY_Qnil;
178
178
 
179
179
  rb_scan_args(argc, argv, "01", &flags);
180
180
 
@@ -186,9 +186,9 @@ static VALUE libvirt_storage_pool_refresh(int argc, VALUE *argv, VALUE p)
186
186
 
187
187
  /*
188
188
  * call-seq:
189
- * pool.name -> string
189
+ * pool.name -> String
190
190
  *
191
- * Call virStoragePoolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetName]
191
+ * Call virStoragePoolGetName[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetName]
192
192
  * to retrieve the name of this storage pool.
193
193
  */
194
194
  static VALUE libvirt_storage_pool_name(VALUE p)
@@ -200,9 +200,9 @@ static VALUE libvirt_storage_pool_name(VALUE p)
200
200
 
201
201
  /*
202
202
  * call-seq:
203
- * pool.uuid -> string
203
+ * pool.uuid -> String
204
204
  *
205
- * Call virStoragePoolGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetUUIDString]
205
+ * Call virStoragePoolGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetUUIDString]
206
206
  * to retrieve the UUID of this storage pool.
207
207
  */
208
208
  static VALUE libvirt_storage_pool_uuid(VALUE p)
@@ -215,7 +215,7 @@ static VALUE libvirt_storage_pool_uuid(VALUE p)
215
215
  * call-seq:
216
216
  * pool.info -> Libvirt::StoragePoolInfo
217
217
  *
218
- * Call virStoragePoolGetInfo[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetInfo]
218
+ * Call virStoragePoolGetInfo[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetInfo]
219
219
  * to retrieve information about this storage pool.
220
220
  */
221
221
  static VALUE libvirt_storage_pool_info(VALUE p)
@@ -240,14 +240,14 @@ static VALUE libvirt_storage_pool_info(VALUE p)
240
240
 
241
241
  /*
242
242
  * call-seq:
243
- * pool.xml_desc(flags=0) -> string
243
+ * pool.xml_desc(flags=0) -> String
244
244
  *
245
- * Call virStoragePoolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetXMLDesc]
245
+ * Call virStoragePoolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetXMLDesc]
246
246
  * to retrieve the XML for this storage pool.
247
247
  */
248
248
  static VALUE libvirt_storage_pool_xml_desc(int argc, VALUE *argv, VALUE p)
249
249
  {
250
- VALUE flags;
250
+ VALUE flags = RUBY_Qnil;
251
251
 
252
252
  rb_scan_args(argc, argv, "01", &flags);
253
253
 
@@ -261,7 +261,7 @@ static VALUE libvirt_storage_pool_xml_desc(int argc, VALUE *argv, VALUE p)
261
261
  * call-seq:
262
262
  * pool.autostart? -> [true|false]
263
263
  *
264
- * Call virStoragePoolGetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetAutostart]
264
+ * Call virStoragePoolGetAutostart[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetAutostart]
265
265
  * to determine whether this storage pool will autostart when libvirtd starts.
266
266
  */
267
267
  static VALUE libvirt_storage_pool_autostart(VALUE p)
@@ -280,7 +280,7 @@ static VALUE libvirt_storage_pool_autostart(VALUE p)
280
280
  * call-seq:
281
281
  * pool.autostart = [true|false]
282
282
  *
283
- * Call virStoragePoolSetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolSetAutostart]
283
+ * Call virStoragePoolSetAutostart[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolSetAutostart]
284
284
  * to make this storage pool start when libvirtd starts.
285
285
  */
286
286
  static VALUE libvirt_storage_pool_autostart_equal(VALUE p, VALUE autostart)
@@ -297,9 +297,9 @@ static VALUE libvirt_storage_pool_autostart_equal(VALUE p, VALUE autostart)
297
297
 
298
298
  /*
299
299
  * call-seq:
300
- * pool.num_of_volumes -> fixnum
300
+ * pool.num_of_volumes -> Fixnum
301
301
  *
302
- * Call virStoragePoolNumOfVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolNumOfVolumes]
302
+ * Call virStoragePoolNumOfVolumes[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolNumOfVolumes]
303
303
  * to retrieve the number of volumes in this storage pool.
304
304
  */
305
305
  static VALUE libvirt_storage_pool_num_of_volumes(VALUE p)
@@ -318,7 +318,7 @@ static VALUE libvirt_storage_pool_num_of_volumes(VALUE p)
318
318
  * call-seq:
319
319
  * pool.list_volumes -> list
320
320
  *
321
- * Call virStoragePoolListVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolListVolumes]
321
+ * Call virStoragePoolListVolumes[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolListVolumes]
322
322
  * to retrieve a list of volume names in this storage pools.
323
323
  */
324
324
  static VALUE libvirt_storage_pool_list_volumes(VALUE p)
@@ -347,7 +347,7 @@ static VALUE libvirt_storage_pool_list_volumes(VALUE p)
347
347
  * call-seq:
348
348
  * pool.free -> nil
349
349
  *
350
- * Call virStoragePoolFree[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolFree]
350
+ * Call virStoragePoolFree[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolFree]
351
351
  * to free this storage pool object. After this call the storage pool object
352
352
  * is no longer valid.
353
353
  */
@@ -378,7 +378,7 @@ static VALUE vol_new(virStorageVolPtr v, VALUE conn)
378
378
  * call-seq:
379
379
  * pool.lookup_volume_by_name(name) -> Libvirt::StorageVol
380
380
  *
381
- * Call virStorageVolLookupByName[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByName]
381
+ * Call virStorageVolLookupByName[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolLookupByName]
382
382
  * to retrieve a storage volume object by name.
383
383
  */
384
384
  static VALUE libvirt_storage_pool_lookup_vol_by_name(VALUE p, VALUE name)
@@ -397,7 +397,7 @@ static VALUE libvirt_storage_pool_lookup_vol_by_name(VALUE p, VALUE name)
397
397
  * call-seq:
398
398
  * pool.lookup_volume_by_key(key) -> Libvirt::StorageVol
399
399
  *
400
- * Call virStorageVolLookupByKey[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByKey]
400
+ * Call virStorageVolLookupByKey[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolLookupByKey]
401
401
  * to retrieve a storage volume object by key.
402
402
  */
403
403
  static VALUE libvirt_storage_pool_lookup_vol_by_key(VALUE p, VALUE key)
@@ -418,7 +418,7 @@ static VALUE libvirt_storage_pool_lookup_vol_by_key(VALUE p, VALUE key)
418
418
  * call-seq:
419
419
  * pool.lookup_volume_by_path(path) -> Libvirt::StorageVol
420
420
  *
421
- * Call virStorageVolLookupByPath[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByPath]
421
+ * Call virStorageVolLookupByPath[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolLookupByPath]
422
422
  * to retrieve a storage volume object by path.
423
423
  */
424
424
  static VALUE libvirt_storage_pool_lookup_vol_by_path(VALUE p, VALUE path)
@@ -438,9 +438,9 @@ 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) -> array
441
+ * pool.list_all_volumes(flags=0) -> Array
442
442
  *
443
- * Call virStoragePoolListAllVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolListAllVolumes]
443
+ * Call virStoragePoolListAllVolumes[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolListAllVolumes]
444
444
  * to get an array of volume objects for all volumes.
445
445
  */
446
446
  static VALUE libvirt_storage_pool_list_all_volumes(int argc, VALUE *argv,
@@ -455,9 +455,9 @@ static VALUE libvirt_storage_pool_list_all_volumes(int argc, VALUE *argv,
455
455
 
456
456
  /*
457
457
  * call-seq:
458
- * vol.name -> string
458
+ * vol.name -> String
459
459
  *
460
- * Call virStorageVolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetName]
460
+ * Call virStorageVolGetName[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetName]
461
461
  * to retrieve the name of this storage volume.
462
462
  */
463
463
  static VALUE libvirt_storage_vol_name(VALUE v)
@@ -469,9 +469,9 @@ static VALUE libvirt_storage_vol_name(VALUE v)
469
469
 
470
470
  /*
471
471
  * call-seq:
472
- * vol.key -> string
472
+ * vol.key -> String
473
473
  *
474
- * Call virStorageVolGetKey[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetKey]
474
+ * Call virStorageVolGetKey[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetKey]
475
475
  * to retrieve the key for this storage volume.
476
476
  */
477
477
  static VALUE libvirt_storage_vol_key(VALUE v)
@@ -485,20 +485,20 @@ static VALUE libvirt_storage_vol_key(VALUE v)
485
485
  * call-seq:
486
486
  * pool.create_volume_xml(xml, flags=0) -> Libvirt::StorageVol
487
487
  *
488
- * Call virStorageVolCreateXML[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolCreateXML]
488
+ * Call virStorageVolCreateXML[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolCreateXML]
489
489
  * to create a new storage volume from xml.
490
490
  */
491
491
  static VALUE libvirt_storage_pool_create_volume_xml(int argc, VALUE *argv,
492
492
  VALUE p)
493
493
  {
494
494
  virStorageVolPtr vol;
495
- VALUE xml, flags;
495
+ VALUE xml, flags = RUBY_Qnil;
496
496
 
497
497
  rb_scan_args(argc, argv, "11", &xml, &flags);
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, "virNetworkCreateXML",
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));
@@ -509,7 +509,7 @@ static VALUE libvirt_storage_pool_create_volume_xml(int argc, VALUE *argv,
509
509
  * call-seq:
510
510
  * pool.create_volume_xml_from(xml, clonevol, flags=0) -> Libvirt::StorageVol
511
511
  *
512
- * Call virStorageVolCreateXMLFrom[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolCreateXMLFrom]
512
+ * Call virStorageVolCreateXMLFrom[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolCreateXMLFrom]
513
513
  * to clone a volume from an existing volume with the properties specified in
514
514
  * xml.
515
515
  */
@@ -517,7 +517,7 @@ static VALUE libvirt_storage_pool_create_volume_xml_from(int argc, VALUE *argv,
517
517
  VALUE p)
518
518
  {
519
519
  virStorageVolPtr vol;
520
- VALUE xml, flags, cloneval;
520
+ VALUE xml, flags = RUBY_Qnil, cloneval = RUBY_Qnil;
521
521
 
522
522
  rb_scan_args(argc, argv, "21", &xml, &cloneval, &flags);
523
523
 
@@ -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
- "virNetworkCreateXMLFrom",
528
+ "virStorageVolCreateXMLFrom",
529
529
  ruby_libvirt_connect_get(p));
530
530
 
531
531
  return vol_new(vol, ruby_libvirt_conn_attr(p));
@@ -537,7 +537,7 @@ static VALUE libvirt_storage_pool_create_volume_xml_from(int argc, VALUE *argv,
537
537
  * call-seq:
538
538
  * pool.active? -> [true|false]
539
539
  *
540
- * Call virStoragePoolIsActive[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolIsActive]
540
+ * Call virStoragePoolIsActive[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolIsActive]
541
541
  * to determine if this storage pool is active.
542
542
  */
543
543
  static VALUE libvirt_storage_pool_active_p(VALUE p)
@@ -553,7 +553,7 @@ static VALUE libvirt_storage_pool_active_p(VALUE p)
553
553
  * call-seq:
554
554
  * pool.persistent? -> [true|false]
555
555
  *
556
- * Call virStoragePoolIsPersistent[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolIsPersistent]
556
+ * Call virStoragePoolIsPersistent[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolIsPersistent]
557
557
  * to determine if this storage pool is persistent.
558
558
  */
559
559
  static VALUE libvirt_storage_pool_persistent_p(VALUE p)
@@ -568,12 +568,12 @@ static VALUE libvirt_storage_pool_persistent_p(VALUE p)
568
568
  * call-seq:
569
569
  * vol.delete(flags=0) -> nil
570
570
  *
571
- * Call virStorageVolDelete[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolDelete]
571
+ * Call virStorageVolDelete[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolDelete]
572
572
  * to delete this volume. This is a destructive operation.
573
573
  */
574
574
  static VALUE libvirt_storage_vol_delete(int argc, VALUE *argv, VALUE v)
575
575
  {
576
- VALUE flags;
576
+ VALUE flags = RUBY_Qnil;
577
577
 
578
578
  rb_scan_args(argc, argv, "01", &flags);
579
579
 
@@ -588,12 +588,12 @@ static VALUE libvirt_storage_vol_delete(int argc, VALUE *argv, VALUE v)
588
588
  * call-seq:
589
589
  * vol.wipe(flags=0) -> nil
590
590
  *
591
- * Call virStorageVolWipe[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolWipe]
591
+ * Call virStorageVolWipe[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolWipe]
592
592
  * to wipe the data from this storage volume. This is a destructive operation.
593
593
  */
594
594
  static VALUE libvirt_storage_vol_wipe(int argc, VALUE *argv, VALUE v)
595
595
  {
596
- VALUE flags;
596
+ VALUE flags = RUBY_Qnil;
597
597
 
598
598
  rb_scan_args(argc, argv, "01", &flags);
599
599
 
@@ -608,7 +608,7 @@ static VALUE libvirt_storage_vol_wipe(int argc, VALUE *argv, VALUE v)
608
608
  * call-seq:
609
609
  * vol.info -> Libvirt::StorageVolInfo
610
610
  *
611
- * Call virStorageVolGetInfo[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetInfo]
611
+ * Call virStorageVolGetInfo[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetInfo]
612
612
  * to retrieve information about this storage volume.
613
613
  */
614
614
  static VALUE libvirt_storage_vol_info(VALUE v)
@@ -631,14 +631,14 @@ static VALUE libvirt_storage_vol_info(VALUE v)
631
631
 
632
632
  /*
633
633
  * call-seq:
634
- * vol.xml_desc(flags=0) -> string
634
+ * vol.xml_desc(flags=0) -> String
635
635
  *
636
- * Call virStorageVolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetXMLDesc]
636
+ * Call virStorageVolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetXMLDesc]
637
637
  * to retrieve the xml for this storage volume.
638
638
  */
639
639
  static VALUE libvirt_storage_vol_xml_desc(int argc, VALUE *argv, VALUE v)
640
640
  {
641
- VALUE flags;
641
+ VALUE flags = RUBY_Qnil;
642
642
 
643
643
  rb_scan_args(argc, argv, "01", &flags);
644
644
 
@@ -650,9 +650,9 @@ static VALUE libvirt_storage_vol_xml_desc(int argc, VALUE *argv, VALUE v)
650
650
 
651
651
  /*
652
652
  * call-seq:
653
- * vol.path -> string
653
+ * vol.path -> String
654
654
  *
655
- * Call virStorageVolGetPath[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetPath]
655
+ * Call virStorageVolGetPath[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetPath]
656
656
  * to retrieve the path for this storage volume.
657
657
  */
658
658
  static VALUE libvirt_storage_vol_path(VALUE v)
@@ -666,7 +666,7 @@ static VALUE libvirt_storage_vol_path(VALUE v)
666
666
  * call-seq:
667
667
  * vol.free -> nil
668
668
  *
669
- * Call virStorageVolFree[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolFree]
669
+ * Call virStorageVolFree[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolFree]
670
670
  * to free the storage volume object. After this call the storage volume object
671
671
  * is no longer valid.
672
672
  */
@@ -681,12 +681,12 @@ static VALUE libvirt_storage_vol_free(VALUE v)
681
681
  * call-seq:
682
682
  * vol.download(stream, offset, length, flags=0) -> nil
683
683
  *
684
- * Call virStorageVolDownload[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolDownload]
684
+ * Call virStorageVolDownload[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolDownload]
685
685
  * to download the content of a volume as a stream.
686
686
  */
687
687
  static VALUE libvirt_storage_vol_download(int argc, VALUE *argv, VALUE v)
688
688
  {
689
- VALUE st, offset, length, flags;
689
+ VALUE st = RUBY_Qnil, offset = RUBY_Qnil, length = RUBY_Qnil, flags = RUBY_Qnil;
690
690
 
691
691
  rb_scan_args(argc, argv, "31", &st, &offset, &length, &flags);
692
692
 
@@ -701,12 +701,12 @@ static VALUE libvirt_storage_vol_download(int argc, VALUE *argv, VALUE v)
701
701
  * call-seq:
702
702
  * vol.upload(stream, offset, length, flags=0) -> nil
703
703
  *
704
- * Call virStorageVolUpload[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolUpload]
704
+ * Call virStorageVolUpload[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolUpload]
705
705
  * to upload new content to a volume from a stream.
706
706
  */
707
707
  static VALUE libvirt_storage_vol_upload(int argc, VALUE *argv, VALUE v)
708
708
  {
709
- VALUE st, offset, length, flags;
709
+ VALUE st = RUBY_Qnil, offset = RUBY_Qnil, length = RUBY_Qnil, flags = RUBY_Qnil;
710
710
 
711
711
  rb_scan_args(argc, argv, "31", &st, &offset, &length, &flags);
712
712
 
@@ -723,12 +723,12 @@ static VALUE libvirt_storage_vol_upload(int argc, VALUE *argv, VALUE v)
723
723
  * call-seq:
724
724
  * vol.wipe_pattern(alg, flags=0) -> nil
725
725
  *
726
- * Call virStorageVolWipePattern[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolWipePattern]
726
+ * Call virStorageVolWipePattern[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolWipePattern]
727
727
  * to wipe the data from this storage volume. This is a destructive operation.
728
728
  */
729
729
  static VALUE libvirt_storage_vol_wipe_pattern(int argc, VALUE *argv, VALUE v)
730
730
  {
731
- VALUE alg, flags;
731
+ VALUE alg = RUBY_Qnil, flags = RUBY_Qnil;
732
732
 
733
733
  rb_scan_args(argc, argv, "11", &alg, &flags);
734
734
 
@@ -744,12 +744,12 @@ static VALUE libvirt_storage_vol_wipe_pattern(int argc, VALUE *argv, VALUE v)
744
744
  * call-seq:
745
745
  * vol.resize(capacity, flags=0) -> nil
746
746
  *
747
- * Call virStorageVolResize[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolResize]
747
+ * Call virStorageVolResize[http://www.libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolResize]
748
748
  * to resize the associated storage volume.
749
749
  */
750
750
  static VALUE libvirt_storage_vol_resize(int argc, VALUE *argv, VALUE v)
751
751
  {
752
- VALUE capacity, flags;
752
+ VALUE capacity = RUBY_Qnil, flags = RUBY_Qnil;
753
753
 
754
754
  rb_scan_args(argc, argv, "11", &capacity, &flags);
755
755
 
@@ -815,6 +815,27 @@ void ruby_libvirt_storage_init(void)
815
815
  rb_define_const(c_storage_pool, "CREATE_PREALLOC_METADATA",
816
816
  INT2NUM(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA));
817
817
  #endif
818
+ #if HAVE_CONST_VIR_STORAGE_VOL_CREATE_REFLINK
819
+ rb_define_const(c_storage_pool, "CREATE_REFLINK",
820
+ INT2NUM(VIR_STORAGE_VOL_CREATE_REFLINK));
821
+ #endif
822
+
823
+ #if HAVE_CONST_VIR_STORAGE_POOL_CREATE_NORMAL
824
+ rb_define_const(c_storage_pool, "CREATE_NORMAL",
825
+ INT2NUM(VIR_STORAGE_POOL_CREATE_NORMAL));
826
+ #endif
827
+ #if HAVE_CONST_VIR_STORAGE_POOL_CREATE_WITH_BUILD
828
+ rb_define_const(c_storage_pool, "CREATE_WITH_BUILD",
829
+ INT2NUM(VIR_STORAGE_POOL_CREATE_WITH_BUILD));
830
+ #endif
831
+ #if HAVE_CONST_VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE
832
+ rb_define_const(c_storage_pool, "CREATE_WITH_BUILD_OVERWRITE",
833
+ INT2NUM(VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE));
834
+ #endif
835
+ #if HAVE_CONST_VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE
836
+ rb_define_const(c_storage_pool, "CREATE_WITH_BUILD_NO_OVERWRITE",
837
+ INT2NUM(VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE));
838
+ #endif
818
839
 
819
840
  /* Creating/destroying pools */
820
841
  rb_define_method(c_storage_pool, "build", libvirt_storage_pool_build, -1);
@@ -913,12 +934,19 @@ void ruby_libvirt_storage_init(void)
913
934
  #if HAVE_CONST_VIR_STORAGE_VOL_NETWORK
914
935
  rb_define_const(c_storage_vol, "NETWORK", INT2NUM(VIR_STORAGE_VOL_NETWORK));
915
936
  #endif
937
+ #if HAVE_CONST_VIR_STORAGE_VOL_NETDIR
938
+ rb_define_const(c_storage_vol, "NETDIR", INT2NUM(VIR_STORAGE_VOL_NETDIR));
939
+ #endif
916
940
 
917
941
  /* virStorageVolDeleteFlags */
918
942
  rb_define_const(c_storage_vol, "DELETE_NORMAL",
919
943
  INT2NUM(VIR_STORAGE_VOL_DELETE_NORMAL));
920
944
  rb_define_const(c_storage_vol, "DELETE_ZEROED",
921
945
  INT2NUM(VIR_STORAGE_VOL_DELETE_ZEROED));
946
+ #if HAVE_CONST_VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS
947
+ rb_define_const(c_storage_vol, "DELETE_WITH_SNAPSHOTS",
948
+ INT2NUM(VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS));
949
+ #endif
922
950
 
923
951
  rb_define_method(c_storage_vol, "pool", libvirt_storage_vol_pool, 0);
924
952
  rb_define_method(c_storage_vol, "name", libvirt_storage_vol_name, 0);
data/ext/libvirt/stream.c CHANGED
@@ -2,7 +2,7 @@
2
2
  * stream.c: virStream 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-2016 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
@@ -48,7 +48,7 @@ VALUE ruby_libvirt_stream_new(virStreamPtr s, VALUE conn)
48
48
  * call-seq:
49
49
  * stream.send(buffer) -> Fixnum
50
50
  *
51
- * Call virStreamSend[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamSend]
51
+ * Call virStreamSend[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamSend]
52
52
  * to send the data in buffer out to the stream. The return value is the
53
53
  * number of bytes sent, which may be less than the size of the buffer. If
54
54
  * an error occurred, -1 is returned. If the transmit buffers are full and the
@@ -72,7 +72,7 @@ static VALUE libvirt_stream_send(VALUE s, VALUE buffer)
72
72
  * call-seq:
73
73
  * stream.recv(bytes) -> [return_value, data]
74
74
  *
75
- * Call virStreamRecv[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamRecv]
75
+ * Call virStreamRecv[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecv]
76
76
  * to receive up to bytes amount of data from the stream. The return is an
77
77
  * array with two elements; the return code from the virStreamRecv call and
78
78
  * the data (as a String) read from the stream. If an error occurred, the
@@ -131,14 +131,14 @@ static int internal_sendall(virStreamPtr RUBY_LIBVIRT_UNUSED(st), char *data,
131
131
 
132
132
  memcpy(data, RSTRING_PTR(buffer), RSTRING_LEN(buffer));
133
133
 
134
- return NUM2INT(retcode);
134
+ return RSTRING_LEN(buffer);
135
135
  }
136
136
 
137
137
  /*
138
138
  * call-seq:
139
139
  * stream.sendall(opaque=nil){|opaque, nbytes| send block} -> nil
140
140
  *
141
- * Call virStreamSendAll[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamSendAll]
141
+ * Call virStreamSendAll[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamSendAll]
142
142
  * to send the entire data stream. The send block is required and is executed
143
143
  * one or more times to send data. Each invocation of the send block yields
144
144
  * the opaque data passed into the initial call and the number of bytes this
@@ -149,7 +149,7 @@ static int internal_sendall(virStreamPtr RUBY_LIBVIRT_UNUSED(st), char *data,
149
149
  */
150
150
  static VALUE libvirt_stream_sendall(int argc, VALUE *argv, VALUE s)
151
151
  {
152
- VALUE opaque;
152
+ VALUE opaque = RUBY_Qnil;
153
153
  int ret;
154
154
 
155
155
  if (!rb_block_given_p()) {
@@ -184,7 +184,7 @@ static int internal_recvall(virStreamPtr RUBY_LIBVIRT_UNUSED(st),
184
184
  * call-seq:
185
185
  * stream.recvall(opaque){|data, opaque| receive block} -> nil
186
186
  *
187
- * Call virStreamRecvAll[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamRecvAll]
187
+ * Call virStreamRecvAll[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecvAll]
188
188
  * to receive the entire data stream. The receive block is required and is
189
189
  * called one or more times to receive data. Each invocation of the receive
190
190
  * block yields the data received and the opaque data passed into the initial
@@ -192,7 +192,7 @@ static int internal_recvall(virStreamPtr RUBY_LIBVIRT_UNUSED(st),
192
192
  */
193
193
  static VALUE libvirt_stream_recvall(int argc, VALUE *argv, VALUE s)
194
194
  {
195
- VALUE opaque;
195
+ VALUE opaque = RUBY_Qnil;
196
196
  int ret;
197
197
 
198
198
  if (!rb_block_given_p()) {
@@ -246,7 +246,7 @@ static void stream_event_callback(virStreamPtr st, int events, void *opaque)
246
246
  * call-seq:
247
247
  * stream.event_add_callback(events, callback, opaque=nil) -> nil
248
248
  *
249
- * Call virStreamEventAddCallback[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamEventAddCallback]
249
+ * Call virStreamEventAddCallback[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventAddCallback]
250
250
  * to register a callback to be notified when a stream becomes readable or
251
251
  * writeable. The events parameter is an integer representing the events the
252
252
  * user is interested in; it should be one or more of EVENT_READABLE,
@@ -259,7 +259,7 @@ static void stream_event_callback(virStreamPtr st, int events, void *opaque)
259
259
  */
260
260
  static VALUE libvirt_stream_event_add_callback(int argc, VALUE *argv, VALUE s)
261
261
  {
262
- VALUE events, callback, opaque, passthrough;
262
+ VALUE events = RUBY_Qnil, callback = RUBY_Qnil, opaque = RUBY_Qnil, passthrough;
263
263
  int ret;
264
264
 
265
265
  rb_scan_args(argc, argv, "21", &events, &callback, &opaque);
@@ -288,7 +288,7 @@ static VALUE libvirt_stream_event_add_callback(int argc, VALUE *argv, VALUE s)
288
288
  * call-seq:
289
289
  * stream.event_update_callback(events) -> nil
290
290
  *
291
- * Call virStreamEventUpdateCallback[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamEventUpdateCallback]
291
+ * Call virStreamEventUpdateCallback[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventUpdateCallback]
292
292
  * to change the events that the event callback is looking for. The events
293
293
  * parameter is an integer representing the events the user is interested in;
294
294
  * it should be one or more of EVENT_READABLE, EVENT_WRITABLE, EVENT_ERROR,
@@ -305,7 +305,7 @@ static VALUE libvirt_stream_event_update_callback(VALUE s, VALUE events)
305
305
  * call-seq:
306
306
  * stream.event_remove_callback -> nil
307
307
  *
308
- * Call virStreamEventRemoveCallback[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamEventRemoveCallback]
308
+ * Call virStreamEventRemoveCallback[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventRemoveCallback]
309
309
  * to remove the event callback currently registered to this stream.
310
310
  */
311
311
  static VALUE libvirt_stream_event_remove_callback(VALUE s)
@@ -319,7 +319,7 @@ static VALUE libvirt_stream_event_remove_callback(VALUE s)
319
319
  * call-seq:
320
320
  * stream.finish -> nil
321
321
  *
322
- * Call virStreamFinish[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamFinish]
322
+ * Call virStreamFinish[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamFinish]
323
323
  * to finish this stream. Finish is typically used when the stream is no
324
324
  * longer needed and needs to be cleaned up.
325
325
  */
@@ -333,7 +333,7 @@ static VALUE libvirt_stream_finish(VALUE s)
333
333
  * call-seq:
334
334
  * stream.abort -> nil
335
335
  *
336
- * Call virStreamAbort[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamAbort]
336
+ * Call virStreamAbort[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamAbort]
337
337
  * to abort this stream. Abort is typically used when something on the stream
338
338
  * has failed, and the stream needs to be cleaned up.
339
339
  */
@@ -347,7 +347,7 @@ static VALUE libvirt_stream_abort(VALUE s)
347
347
  * call-seq:
348
348
  * stream.free -> nil
349
349
  *
350
- * Call virStreamFree[http://www.libvirt.org/html/libvirt-libvirt.html#virStreamFree]
350
+ * Call virStreamFree[http://www.libvirt.org/html/libvirt-libvirt-stream.html#virStreamFree]
351
351
  * to free this stream. The object will no longer be valid after this call.
352
352
  */
353
353
  static VALUE libvirt_stream_free(VALUE s)