ruby-libvirt 0.4.0 → 0.5.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.
- checksums.yaml +7 -0
- data/NEWS +10 -0
- data/README +188 -21
- data/Rakefile +11 -7
- data/ext/libvirt/_libvirt.c +252 -234
- data/ext/libvirt/common.c +346 -71
- data/ext/libvirt/common.h +171 -111
- data/ext/libvirt/connect.c +1851 -798
- data/ext/libvirt/connect.h +6 -5
- data/ext/libvirt/domain.c +3903 -1060
- data/ext/libvirt/domain.h +5 -3
- data/ext/libvirt/extconf.rb +275 -41
- data/ext/libvirt/interface.c +60 -41
- data/ext/libvirt/interface.h +3 -1
- data/ext/libvirt/network.c +291 -72
- data/ext/libvirt/network.h +3 -2
- data/ext/libvirt/nodedevice.c +138 -59
- data/ext/libvirt/nodedevice.h +3 -1
- data/ext/libvirt/nwfilter.c +39 -34
- data/ext/libvirt/nwfilter.h +3 -1
- data/ext/libvirt/secret.c +122 -64
- data/ext/libvirt/secret.h +3 -1
- data/ext/libvirt/storage.c +451 -233
- data/ext/libvirt/storage.h +1 -1
- data/ext/libvirt/stream.c +120 -122
- data/ext/libvirt/stream.h +4 -2
- data/tests/test_conn.rb +214 -67
- data/tests/test_domain.rb +553 -209
- data/tests/test_interface.rb +4 -10
- data/tests/test_network.rb +21 -12
- data/tests/test_nodedevice.rb +11 -1
- data/tests/test_nwfilter.rb +4 -0
- data/tests/test_open.rb +59 -6
- data/tests/test_secret.rb +25 -0
- data/tests/test_storage.rb +132 -28
- data/tests/test_stream.rb +171 -0
- data/tests/test_utils.rb +86 -15
- metadata +43 -66
data/ext/libvirt/nwfilter.h
CHANGED
data/ext/libvirt/secret.c
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
* secret.c: virSecret methods
|
3
3
|
*
|
4
4
|
* Copyright (C) 2010 Red Hat Inc.
|
5
|
+
* Copyright (C) 2013 Chris Lalancette <clalancette@gmail.com>
|
5
6
|
*
|
6
7
|
* This library is free software; you can redistribute it and/or
|
7
8
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -28,136 +29,173 @@
|
|
28
29
|
#if HAVE_TYPE_VIRSECRETPTR
|
29
30
|
static VALUE c_secret;
|
30
31
|
|
31
|
-
static void secret_free(void *s)
|
32
|
-
|
32
|
+
static void secret_free(void *s)
|
33
|
+
{
|
34
|
+
ruby_libvirt_free_struct(Secret, s);
|
33
35
|
}
|
34
36
|
|
35
|
-
static virSecretPtr secret_get(VALUE s)
|
36
|
-
|
37
|
+
static virSecretPtr secret_get(VALUE s)
|
38
|
+
{
|
39
|
+
ruby_libvirt_get_struct(Secret, s);
|
37
40
|
}
|
38
41
|
|
39
|
-
VALUE
|
40
|
-
|
42
|
+
VALUE ruby_libvirt_secret_new(virSecretPtr s, VALUE conn)
|
43
|
+
{
|
44
|
+
return ruby_libvirt_new_class(c_secret, s, conn, secret_free);
|
41
45
|
}
|
42
46
|
|
43
47
|
/*
|
44
48
|
* call-seq:
|
45
49
|
* secret.uuid -> string
|
46
50
|
*
|
47
|
-
* Call
|
51
|
+
* Call virSecretGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUUIDString]
|
48
52
|
* to retrieve the UUID for this secret.
|
49
53
|
*/
|
50
|
-
static VALUE libvirt_secret_uuid(VALUE s)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
r = virSecretGetUUIDString(secret, uuid);
|
56
|
-
_E(r < 0, create_error(e_RetrieveError, "virSecretGetUUIDString", conn(s)));
|
57
|
-
|
58
|
-
return rb_str_new2((char *)uuid);
|
54
|
+
static VALUE libvirt_secret_uuid(VALUE s)
|
55
|
+
{
|
56
|
+
ruby_libvirt_generate_uuid(virSecretGetUUIDString,
|
57
|
+
ruby_libvirt_connect_get(s), secret_get(s));
|
59
58
|
}
|
60
59
|
|
61
60
|
/*
|
62
61
|
* call-seq:
|
63
62
|
* secret.usagetype -> fixnum
|
64
63
|
*
|
65
|
-
* Call
|
64
|
+
* Call virSecretGetUsageType[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUsageType]
|
66
65
|
* to retrieve the usagetype for this secret.
|
67
66
|
*/
|
68
|
-
static VALUE libvirt_secret_usagetype(VALUE s)
|
69
|
-
|
67
|
+
static VALUE libvirt_secret_usagetype(VALUE s)
|
68
|
+
{
|
69
|
+
ruby_libvirt_generate_call_int(virSecretGetUsageType,
|
70
|
+
ruby_libvirt_connect_get(s),
|
71
|
+
secret_get(s));
|
70
72
|
}
|
71
73
|
|
72
74
|
/*
|
73
75
|
* call-seq:
|
74
76
|
* secret.usageid -> string
|
75
77
|
*
|
76
|
-
* Call
|
78
|
+
* Call virSecretGetUsageID[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUsageID]
|
77
79
|
* to retrieve the usageid for this secret.
|
78
80
|
*/
|
79
|
-
static VALUE libvirt_secret_usageid(VALUE s)
|
80
|
-
|
81
|
+
static VALUE libvirt_secret_usageid(VALUE s)
|
82
|
+
{
|
83
|
+
ruby_libvirt_generate_call_string(virSecretGetUsageID,
|
84
|
+
ruby_libvirt_connect_get(s), 0,
|
85
|
+
secret_get(s));
|
81
86
|
}
|
82
87
|
|
83
88
|
/*
|
84
89
|
* call-seq:
|
85
90
|
* secret.xml_desc(flags=0) -> string
|
86
91
|
*
|
87
|
-
* Call
|
92
|
+
* Call virSecretGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetXMLDesc]
|
88
93
|
* to retrieve the XML for this secret.
|
89
94
|
*/
|
90
|
-
static VALUE libvirt_secret_xml_desc(int argc, VALUE *argv, VALUE s)
|
95
|
+
static VALUE libvirt_secret_xml_desc(int argc, VALUE *argv, VALUE s)
|
96
|
+
{
|
91
97
|
VALUE flags;
|
92
98
|
|
93
99
|
rb_scan_args(argc, argv, "01", &flags);
|
94
100
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
NUM2UINT(flags));
|
101
|
+
ruby_libvirt_generate_call_string(virSecretGetXMLDesc,
|
102
|
+
ruby_libvirt_connect_get(s), 1,
|
103
|
+
secret_get(s),
|
104
|
+
ruby_libvirt_value_to_uint(flags));
|
100
105
|
}
|
101
106
|
|
102
107
|
/*
|
103
108
|
* call-seq:
|
104
109
|
* secret.set_value(value, flags=0) -> nil
|
105
110
|
*
|
106
|
-
* Call
|
107
|
-
* to set a new value in this secret.
|
111
|
+
* Call virSecretSetValue[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretSetValue]
|
112
|
+
* to set a new value in this secret. Deprecated; use secret.value= instead.
|
108
113
|
*/
|
109
|
-
static VALUE libvirt_secret_set_value(int argc, VALUE *argv, VALUE s)
|
110
|
-
|
111
|
-
VALUE value;
|
114
|
+
static VALUE libvirt_secret_set_value(int argc, VALUE *argv, VALUE s)
|
115
|
+
{
|
116
|
+
VALUE flags, value;
|
112
117
|
|
113
118
|
rb_scan_args(argc, argv, "11", &value, &flags);
|
114
119
|
|
115
|
-
|
120
|
+
StringValue(value);
|
121
|
+
|
122
|
+
ruby_libvirt_generate_call_nil(virSecretSetValue,
|
123
|
+
ruby_libvirt_connect_get(s),
|
124
|
+
secret_get(s),
|
125
|
+
(unsigned char *)RSTRING_PTR(value),
|
126
|
+
RSTRING_LEN(value),
|
127
|
+
ruby_libvirt_value_to_uint(flags));
|
128
|
+
}
|
129
|
+
|
130
|
+
/*
|
131
|
+
* call-seq:
|
132
|
+
* secret.value = value,flags=0
|
133
|
+
*
|
134
|
+
* Call virSecretSetValue[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretSetValue]
|
135
|
+
* to set a new value in this secret.
|
136
|
+
*/
|
137
|
+
static VALUE libvirt_secret_value_equal(VALUE s, VALUE in)
|
138
|
+
{
|
139
|
+
VALUE flags, value;
|
140
|
+
|
141
|
+
if (TYPE(in) == T_STRING) {
|
142
|
+
value = in;
|
116
143
|
flags = INT2NUM(0);
|
144
|
+
}
|
145
|
+
else if (TYPE(in) == T_ARRAY) {
|
146
|
+
if (RARRAY_LEN(in) != 2) {
|
147
|
+
rb_raise(rb_eArgError, "wrong number of arguments (%ld for 2)",
|
148
|
+
RARRAY_LEN(in));
|
149
|
+
}
|
150
|
+
value = rb_ary_entry(in, 0);
|
151
|
+
flags = rb_ary_entry(in, 1);
|
152
|
+
}
|
153
|
+
else {
|
154
|
+
rb_raise(rb_eTypeError,
|
155
|
+
"wrong argument type (expected Number or Array)");
|
156
|
+
}
|
117
157
|
|
118
158
|
StringValue(value);
|
119
159
|
|
120
|
-
|
121
|
-
|
122
|
-
|
160
|
+
ruby_libvirt_generate_call_nil(virSecretSetValue,
|
161
|
+
ruby_libvirt_connect_get(s),
|
162
|
+
secret_get(s),
|
163
|
+
(unsigned char *)RSTRING_PTR(value),
|
164
|
+
RSTRING_LEN(value), NUM2UINT(flags));
|
123
165
|
}
|
124
166
|
|
125
167
|
/*
|
126
168
|
* call-seq:
|
127
|
-
* secret.
|
169
|
+
* secret.value(flags=0) -> string
|
128
170
|
*
|
129
|
-
* Call
|
171
|
+
* Call virSecretGetValue[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetValue]
|
130
172
|
* to retrieve the value from this secret.
|
131
173
|
*/
|
132
|
-
static VALUE
|
133
|
-
|
134
|
-
VALUE flags;
|
174
|
+
static VALUE libvirt_secret_value(int argc, VALUE *argv, VALUE s)
|
175
|
+
{
|
176
|
+
VALUE flags, ret;
|
135
177
|
unsigned char *val;
|
136
178
|
size_t value_size;
|
137
|
-
VALUE ret;
|
138
179
|
int exception = 0;
|
139
|
-
struct
|
180
|
+
struct ruby_libvirt_str_new_arg args;
|
140
181
|
|
141
182
|
rb_scan_args(argc, argv, "01", &flags);
|
142
183
|
|
143
|
-
|
144
|
-
|
184
|
+
val = virSecretGetValue(secret_get(s), &value_size,
|
185
|
+
ruby_libvirt_value_to_uint(flags));
|
145
186
|
|
146
|
-
val
|
147
|
-
|
148
|
-
|
149
|
-
conn(s)));
|
187
|
+
ruby_libvirt_raise_error_if(val == NULL, e_RetrieveError,
|
188
|
+
"virSecretGetValue",
|
189
|
+
ruby_libvirt_connect_get(s));
|
150
190
|
|
151
191
|
args.val = (char *)val;
|
152
192
|
args.size = value_size;
|
153
|
-
ret = rb_protect(
|
193
|
+
ret = rb_protect(ruby_libvirt_str_new_wrap, (VALUE)&args, &exception);
|
194
|
+
free(val);
|
154
195
|
if (exception) {
|
155
|
-
free(val);
|
156
196
|
rb_jump_tag(exception);
|
157
197
|
}
|
158
198
|
|
159
|
-
free(val);
|
160
|
-
|
161
199
|
return ret;
|
162
200
|
}
|
163
201
|
|
@@ -165,22 +203,26 @@ static VALUE libvirt_secret_get_value(int argc, VALUE *argv, VALUE s) {
|
|
165
203
|
* call-seq:
|
166
204
|
* secret.undefine -> nil
|
167
205
|
*
|
168
|
-
* Call
|
206
|
+
* Call virSecretUndefine[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretUndefine]
|
169
207
|
* to undefine this secret.
|
170
208
|
*/
|
171
|
-
static VALUE libvirt_secret_undefine(VALUE s)
|
172
|
-
|
209
|
+
static VALUE libvirt_secret_undefine(VALUE s)
|
210
|
+
{
|
211
|
+
ruby_libvirt_generate_call_nil(virSecretUndefine,
|
212
|
+
ruby_libvirt_connect_get(s),
|
213
|
+
secret_get(s));
|
173
214
|
}
|
174
215
|
|
175
216
|
/*
|
176
217
|
* call-seq:
|
177
218
|
* secret.free -> nil
|
178
219
|
*
|
179
|
-
* Call
|
220
|
+
* Call virSecretFree[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretFree]
|
180
221
|
* to free this secret. After this call the secret object is no longer valid.
|
181
222
|
*/
|
182
|
-
static VALUE libvirt_secret_free(VALUE s)
|
183
|
-
|
223
|
+
static VALUE libvirt_secret_free(VALUE s)
|
224
|
+
{
|
225
|
+
ruby_libvirt_generate_call_free(Secret, s);
|
184
226
|
}
|
185
227
|
|
186
228
|
#endif
|
@@ -188,14 +230,28 @@ static VALUE libvirt_secret_free(VALUE s) {
|
|
188
230
|
/*
|
189
231
|
* Class Libvirt::Secret
|
190
232
|
*/
|
191
|
-
void
|
233
|
+
void ruby_libvirt_secret_init(void)
|
192
234
|
{
|
193
235
|
#if HAVE_TYPE_VIRSECRETPTR
|
194
236
|
c_secret = rb_define_class_under(m_libvirt, "Secret", rb_cObject);
|
195
237
|
|
238
|
+
rb_define_attr(c_secret, "connection", 1, 0);
|
239
|
+
|
196
240
|
rb_define_const(c_secret, "USAGE_TYPE_VOLUME",
|
197
241
|
INT2NUM(VIR_SECRET_USAGE_TYPE_VOLUME));
|
198
|
-
|
242
|
+
|
243
|
+
#if HAVE_CONST_VIR_SECRET_USAGE_TYPE_CEPH
|
244
|
+
rb_define_const(c_secret, "USAGE_TYPE_CEPH",
|
245
|
+
INT2NUM(VIR_SECRET_USAGE_TYPE_CEPH));
|
246
|
+
#endif
|
247
|
+
#if HAVE_CONST_VIR_SECRET_USAGE_TYPE_ISCSI
|
248
|
+
rb_define_const(c_secret, "USAGE_TYPE_ISCSI",
|
249
|
+
INT2NUM(VIR_SECRET_USAGE_TYPE_ISCSI));
|
250
|
+
#endif
|
251
|
+
#if HAVE_CONST_VIR_SECRET_USAGE_TYPE_NONE
|
252
|
+
rb_define_const(c_secret, "USAGE_TYPE_NONE",
|
253
|
+
INT2NUM(VIR_SECRET_USAGE_TYPE_NONE));
|
254
|
+
#endif
|
199
255
|
|
200
256
|
/* Secret object methods */
|
201
257
|
rb_define_method(c_secret, "uuid", libvirt_secret_uuid, 0);
|
@@ -203,7 +259,9 @@ void init_secret()
|
|
203
259
|
rb_define_method(c_secret, "usageid", libvirt_secret_usageid, 0);
|
204
260
|
rb_define_method(c_secret, "xml_desc", libvirt_secret_xml_desc, -1);
|
205
261
|
rb_define_method(c_secret, "set_value", libvirt_secret_set_value, -1);
|
206
|
-
rb_define_method(c_secret, "
|
262
|
+
rb_define_method(c_secret, "value=", libvirt_secret_value_equal, 1);
|
263
|
+
rb_define_method(c_secret, "value", libvirt_secret_value, -1);
|
264
|
+
rb_define_alias(c_secret, "get_value", "value");
|
207
265
|
rb_define_method(c_secret, "undefine", libvirt_secret_undefine, 0);
|
208
266
|
rb_define_method(c_secret, "free", libvirt_secret_free, 0);
|
209
267
|
#endif
|
data/ext/libvirt/secret.h
CHANGED
data/ext/libvirt/storage.c
CHANGED
@@ -2,6 +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
6
|
*
|
6
7
|
* This library is free software; you can redistribute it and/or
|
7
8
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -28,10 +29,11 @@
|
|
28
29
|
|
29
30
|
#if HAVE_TYPE_VIRSTORAGEVOLPTR
|
30
31
|
/* this has to be here (as opposed to below with the rest of the volume
|
31
|
-
* stuff) because
|
32
|
+
* stuff) because libvirt_storage_vol_get_pool() relies on it
|
32
33
|
*/
|
33
|
-
static virStorageVolPtr vol_get(VALUE
|
34
|
-
|
34
|
+
static virStorageVolPtr vol_get(VALUE v)
|
35
|
+
{
|
36
|
+
ruby_libvirt_get_struct(StorageVol, v);
|
35
37
|
}
|
36
38
|
#endif
|
37
39
|
|
@@ -43,173 +45,189 @@ static VALUE c_storage_pool_info;
|
|
43
45
|
* Class Libvirt::StoragePool
|
44
46
|
*/
|
45
47
|
|
46
|
-
static void pool_free(void *d)
|
47
|
-
|
48
|
+
static void pool_free(void *d)
|
49
|
+
{
|
50
|
+
ruby_libvirt_free_struct(StoragePool, d);
|
48
51
|
}
|
49
52
|
|
50
|
-
static virStoragePoolPtr pool_get(VALUE
|
51
|
-
|
53
|
+
static virStoragePoolPtr pool_get(VALUE p)
|
54
|
+
{
|
55
|
+
ruby_libvirt_get_struct(StoragePool, p);
|
52
56
|
}
|
53
57
|
|
54
|
-
VALUE pool_new(virStoragePoolPtr
|
55
|
-
|
58
|
+
VALUE pool_new(virStoragePoolPtr p, VALUE conn)
|
59
|
+
{
|
60
|
+
return ruby_libvirt_new_class(c_storage_pool, p, conn, pool_free);
|
56
61
|
}
|
57
62
|
|
58
63
|
/*
|
59
64
|
* call-seq:
|
60
65
|
* vol.pool -> Libvirt::StoragePool
|
61
66
|
*
|
62
|
-
* Call
|
67
|
+
* Call virStoragePoolLookupByVolume[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolLookupByVolume]
|
63
68
|
* to retrieve the storage pool for this volume.
|
64
69
|
*/
|
65
|
-
static VALUE
|
70
|
+
static VALUE libvirt_storage_vol_pool(VALUE v)
|
71
|
+
{
|
66
72
|
virStoragePoolPtr pool;
|
67
73
|
|
68
74
|
pool = virStoragePoolLookupByVolume(vol_get(v));
|
69
|
-
|
70
|
-
|
75
|
+
ruby_libvirt_raise_error_if(pool == NULL, e_RetrieveError,
|
76
|
+
"virStoragePoolLookupByVolume",
|
77
|
+
ruby_libvirt_connect_get(v));
|
71
78
|
|
72
|
-
return pool_new(pool,
|
79
|
+
return pool_new(pool, ruby_libvirt_conn_attr(v));
|
73
80
|
}
|
74
81
|
|
75
82
|
/*
|
76
83
|
* call-seq:
|
77
84
|
* pool.build(flags=0) -> nil
|
78
85
|
*
|
79
|
-
* Call
|
86
|
+
* Call virStoragePoolBuild[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolBuild]
|
80
87
|
* to build this storage pool.
|
81
88
|
*/
|
82
|
-
static VALUE
|
89
|
+
static VALUE libvirt_storage_pool_build(int argc, VALUE *argv, VALUE p)
|
90
|
+
{
|
83
91
|
VALUE flags;
|
84
92
|
|
85
93
|
rb_scan_args(argc, argv, "01", &flags);
|
86
94
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
95
|
+
ruby_libvirt_generate_call_nil(virStoragePoolBuild,
|
96
|
+
ruby_libvirt_connect_get(p),
|
97
|
+
pool_get(p),
|
98
|
+
ruby_libvirt_value_to_uint(flags));
|
91
99
|
}
|
92
100
|
|
93
101
|
/*
|
94
102
|
* call-seq:
|
95
103
|
* pool.undefine -> nil
|
96
104
|
*
|
97
|
-
* Call
|
105
|
+
* Call virStoragePoolUndefine[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolUndefine]
|
98
106
|
* to undefine this storage pool.
|
99
107
|
*/
|
100
|
-
static VALUE
|
101
|
-
|
108
|
+
static VALUE libvirt_storage_pool_undefine(VALUE p)
|
109
|
+
{
|
110
|
+
ruby_libvirt_generate_call_nil(virStoragePoolUndefine,
|
111
|
+
ruby_libvirt_connect_get(p),
|
112
|
+
pool_get(p));
|
102
113
|
}
|
103
114
|
|
104
115
|
/*
|
105
116
|
* call-seq:
|
106
117
|
* pool.create(flags=0) -> nil
|
107
118
|
*
|
108
|
-
* Call
|
119
|
+
* Call virStoragePoolCreate[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolCreate]
|
109
120
|
* to start this storage pool.
|
110
121
|
*/
|
111
|
-
static VALUE
|
122
|
+
static VALUE libvirt_storage_pool_create(int argc, VALUE *argv, VALUE p)
|
123
|
+
{
|
112
124
|
VALUE flags;
|
113
125
|
|
114
126
|
rb_scan_args(argc, argv, "01", &flags);
|
115
127
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
128
|
+
ruby_libvirt_generate_call_nil(virStoragePoolCreate,
|
129
|
+
ruby_libvirt_connect_get(p),
|
130
|
+
pool_get(p),
|
131
|
+
ruby_libvirt_value_to_uint(flags));
|
120
132
|
}
|
121
133
|
|
122
134
|
/*
|
123
135
|
* call-seq:
|
124
136
|
* pool.destroy -> nil
|
125
137
|
*
|
126
|
-
* Call
|
138
|
+
* Call virStoragePoolDestroy[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolDestroy]
|
127
139
|
* to shutdown this storage pool.
|
128
140
|
*/
|
129
|
-
static VALUE
|
130
|
-
|
141
|
+
static VALUE libvirt_storage_pool_destroy(VALUE p)
|
142
|
+
{
|
143
|
+
ruby_libvirt_generate_call_nil(virStoragePoolDestroy,
|
144
|
+
ruby_libvirt_connect_get(p),
|
145
|
+
pool_get(p));
|
131
146
|
}
|
132
147
|
|
133
148
|
/*
|
134
149
|
* call-seq:
|
135
150
|
* pool.delete(flags=0) -> nil
|
136
151
|
*
|
137
|
-
* Call
|
152
|
+
* Call virStoragePoolDelete[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolDelete]
|
138
153
|
* to delete the data corresponding to this data pool. This is a destructive
|
139
154
|
* operation.
|
140
155
|
*/
|
141
|
-
static VALUE
|
156
|
+
static VALUE libvirt_storage_pool_delete(int argc, VALUE *argv, VALUE p)
|
157
|
+
{
|
142
158
|
VALUE flags;
|
143
159
|
|
144
160
|
rb_scan_args(argc, argv, "01", &flags);
|
145
161
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
162
|
+
ruby_libvirt_generate_call_nil(virStoragePoolDelete,
|
163
|
+
ruby_libvirt_connect_get(p),
|
164
|
+
pool_get(p),
|
165
|
+
ruby_libvirt_value_to_uint(flags));
|
150
166
|
}
|
151
167
|
|
152
168
|
/*
|
153
169
|
* call-seq:
|
154
170
|
* pool.refresh(flags=0) -> nil
|
155
171
|
*
|
156
|
-
* Call
|
172
|
+
* Call virStoragePoolRefresh[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolRefresh]
|
157
173
|
* to refresh the list of volumes in this storage pool.
|
158
174
|
*/
|
159
|
-
static VALUE
|
175
|
+
static VALUE libvirt_storage_pool_refresh(int argc, VALUE *argv, VALUE p)
|
176
|
+
{
|
160
177
|
VALUE flags;
|
161
178
|
|
162
179
|
rb_scan_args(argc, argv, "01", &flags);
|
163
180
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
181
|
+
ruby_libvirt_generate_call_nil(virStoragePoolRefresh,
|
182
|
+
ruby_libvirt_connect_get(p),
|
183
|
+
pool_get(p),
|
184
|
+
ruby_libvirt_value_to_uint(flags));
|
168
185
|
}
|
169
186
|
|
170
187
|
/*
|
171
188
|
* call-seq:
|
172
189
|
* pool.name -> string
|
173
190
|
*
|
174
|
-
* Call
|
191
|
+
* Call virStoragePoolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetName]
|
175
192
|
* to retrieve the name of this storage pool.
|
176
193
|
*/
|
177
|
-
static VALUE
|
178
|
-
|
194
|
+
static VALUE libvirt_storage_pool_name(VALUE p)
|
195
|
+
{
|
196
|
+
ruby_libvirt_generate_call_string(virStoragePoolGetName,
|
197
|
+
ruby_libvirt_connect_get(p), 0,
|
198
|
+
pool_get(p));
|
179
199
|
}
|
180
200
|
|
181
201
|
/*
|
182
202
|
* call-seq:
|
183
203
|
* pool.uuid -> string
|
184
204
|
*
|
185
|
-
* Call
|
205
|
+
* Call virStoragePoolGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetUUIDString]
|
186
206
|
* to retrieve the UUID of this storage pool.
|
187
207
|
*/
|
188
|
-
static VALUE
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
r = virStoragePoolGetUUIDString(pool_get(s), uuid);
|
193
|
-
_E(r < 0, create_error(e_RetrieveError, "virStoragePoolGetUUIDString",
|
194
|
-
conn(s)));
|
195
|
-
|
196
|
-
return rb_str_new2((char *) uuid);
|
208
|
+
static VALUE libvirt_storage_pool_uuid(VALUE p)
|
209
|
+
{
|
210
|
+
ruby_libvirt_generate_uuid(virStoragePoolGetUUIDString,
|
211
|
+
ruby_libvirt_connect_get(p), pool_get(p));
|
197
212
|
}
|
198
213
|
|
199
214
|
/*
|
200
215
|
* call-seq:
|
201
216
|
* pool.info -> Libvirt::StoragePoolInfo
|
202
217
|
*
|
203
|
-
* Call
|
218
|
+
* Call virStoragePoolGetInfo[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetInfo]
|
204
219
|
* to retrieve information about this storage pool.
|
205
220
|
*/
|
206
|
-
static VALUE
|
221
|
+
static VALUE libvirt_storage_pool_info(VALUE p)
|
222
|
+
{
|
207
223
|
virStoragePoolInfo info;
|
208
224
|
int r;
|
209
225
|
VALUE result;
|
210
226
|
|
211
|
-
r = virStoragePoolGetInfo(pool_get(
|
212
|
-
|
227
|
+
r = virStoragePoolGetInfo(pool_get(p), &info);
|
228
|
+
ruby_libvirt_raise_error_if(r < 0, e_RetrieveError,
|
229
|
+
"virStoragePoolGetInfo",
|
230
|
+
ruby_libvirt_connect_get(p));
|
213
231
|
|
214
232
|
result = rb_class_new_instance(0, NULL, c_storage_pool_info);
|
215
233
|
rb_iv_set(result, "@state", INT2NUM(info.state));
|
@@ -224,34 +242,36 @@ static VALUE libvirt_pool_info(VALUE s) {
|
|
224
242
|
* call-seq:
|
225
243
|
* pool.xml_desc(flags=0) -> string
|
226
244
|
*
|
227
|
-
* Call
|
245
|
+
* Call virStoragePoolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetXMLDesc]
|
228
246
|
* to retrieve the XML for this storage pool.
|
229
247
|
*/
|
230
|
-
static VALUE
|
248
|
+
static VALUE libvirt_storage_pool_xml_desc(int argc, VALUE *argv, VALUE p)
|
249
|
+
{
|
231
250
|
VALUE flags;
|
232
251
|
|
233
252
|
rb_scan_args(argc, argv, "01", &flags);
|
234
253
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
NUM2UINT(flags));
|
254
|
+
ruby_libvirt_generate_call_string(virStoragePoolGetXMLDesc,
|
255
|
+
ruby_libvirt_connect_get(p),
|
256
|
+
1, pool_get(p),
|
257
|
+
ruby_libvirt_value_to_uint(flags));
|
240
258
|
}
|
241
259
|
|
242
260
|
/*
|
243
261
|
* call-seq:
|
244
262
|
* pool.autostart? -> [true|false]
|
245
263
|
*
|
246
|
-
* Call
|
264
|
+
* Call virStoragePoolGetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetAutostart]
|
247
265
|
* to determine whether this storage pool will autostart when libvirtd starts.
|
248
266
|
*/
|
249
|
-
static VALUE
|
267
|
+
static VALUE libvirt_storage_pool_autostart(VALUE p)
|
268
|
+
{
|
250
269
|
int r, autostart;
|
251
270
|
|
252
|
-
r = virStoragePoolGetAutostart(pool_get(
|
253
|
-
|
254
|
-
|
271
|
+
r = virStoragePoolGetAutostart(pool_get(p), &autostart);
|
272
|
+
ruby_libvirt_raise_error_if(r < 0, e_RetrieveError,
|
273
|
+
"virStoragePoolGetAutostart",
|
274
|
+
ruby_libvirt_connect_get(p));
|
255
275
|
|
256
276
|
return autostart ? Qtrue : Qfalse;
|
257
277
|
}
|
@@ -260,29 +280,36 @@ static VALUE libvirt_pool_autostart(VALUE s){
|
|
260
280
|
* call-seq:
|
261
281
|
* pool.autostart = [true|false]
|
262
282
|
*
|
263
|
-
* Call
|
283
|
+
* Call virStoragePoolSetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolSetAutostart]
|
264
284
|
* to make this storage pool start when libvirtd starts.
|
265
285
|
*/
|
266
|
-
static VALUE
|
267
|
-
|
286
|
+
static VALUE libvirt_storage_pool_autostart_equal(VALUE p, VALUE autostart)
|
287
|
+
{
|
288
|
+
if (autostart != Qtrue && autostart != Qfalse) {
|
268
289
|
rb_raise(rb_eTypeError,
|
269
290
|
"wrong argument type (expected TrueClass or FalseClass)");
|
291
|
+
}
|
270
292
|
|
271
|
-
|
272
|
-
|
293
|
+
ruby_libvirt_generate_call_nil(virStoragePoolSetAutostart,
|
294
|
+
ruby_libvirt_connect_get(p),
|
295
|
+
pool_get(p), RTEST(autostart) ? 1 : 0);
|
273
296
|
}
|
274
297
|
|
275
298
|
/*
|
276
299
|
* call-seq:
|
277
300
|
* pool.num_of_volumes -> fixnum
|
278
301
|
*
|
279
|
-
* Call
|
302
|
+
* Call virStoragePoolNumOfVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolNumOfVolumes]
|
280
303
|
* to retrieve the number of volumes in this storage pool.
|
281
304
|
*/
|
282
|
-
static VALUE
|
283
|
-
|
284
|
-
|
285
|
-
|
305
|
+
static VALUE libvirt_storage_pool_num_of_volumes(VALUE p)
|
306
|
+
{
|
307
|
+
int n;
|
308
|
+
|
309
|
+
n = virStoragePoolNumOfVolumes(pool_get(p));
|
310
|
+
ruby_libvirt_raise_error_if(n < 0, e_RetrieveError,
|
311
|
+
"virStoragePoolNumOfVolumes",
|
312
|
+
ruby_libvirt_connect_get(p));
|
286
313
|
|
287
314
|
return INT2NUM(n);
|
288
315
|
}
|
@@ -291,41 +318,42 @@ static VALUE libvirt_pool_num_of_volumes(VALUE s) {
|
|
291
318
|
* call-seq:
|
292
319
|
* pool.list_volumes -> list
|
293
320
|
*
|
294
|
-
* Call
|
321
|
+
* Call virStoragePoolListVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolListVolumes]
|
295
322
|
* to retrieve a list of volume names in this storage pools.
|
296
323
|
*/
|
297
|
-
static VALUE
|
324
|
+
static VALUE libvirt_storage_pool_list_volumes(VALUE p)
|
325
|
+
{
|
298
326
|
int r, num;
|
299
327
|
char **names;
|
300
|
-
virStoragePoolPtr pool = pool_get(s);
|
301
328
|
|
302
|
-
num = virStoragePoolNumOfVolumes(
|
303
|
-
|
304
|
-
|
305
|
-
|
329
|
+
num = virStoragePoolNumOfVolumes(pool_get(p));
|
330
|
+
ruby_libvirt_raise_error_if(num < 0, e_RetrieveError,
|
331
|
+
"virStoragePoolNumOfVolumes",
|
332
|
+
ruby_libvirt_connect_get(p));
|
333
|
+
if (num == 0) {
|
306
334
|
return rb_ary_new2(num);
|
307
|
-
|
308
|
-
names = ALLOC_N(char *, num);
|
309
|
-
r = virStoragePoolListVolumes(pool, names, num);
|
310
|
-
if (r < 0) {
|
311
|
-
xfree(names);
|
312
|
-
rb_exc_raise(create_error(e_RetrieveError, "virStoragePoolListVolumes",
|
313
|
-
conn(s)));
|
314
335
|
}
|
315
336
|
|
316
|
-
|
337
|
+
names = alloca(sizeof(char *) * num);
|
338
|
+
r = virStoragePoolListVolumes(pool_get(p), names, num);
|
339
|
+
ruby_libvirt_raise_error_if(r < 0, e_RetrieveError,
|
340
|
+
"virStoragePoolListVolumes",
|
341
|
+
ruby_libvirt_connect_get(p));
|
342
|
+
|
343
|
+
return ruby_libvirt_generate_list(num, names);
|
317
344
|
}
|
318
345
|
|
319
346
|
/*
|
320
347
|
* call-seq:
|
321
348
|
* pool.free -> nil
|
322
349
|
*
|
323
|
-
* Call
|
350
|
+
* Call virStoragePoolFree[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolFree]
|
324
351
|
* to free this storage pool object. After this call the storage pool object
|
325
352
|
* is no longer valid.
|
326
353
|
*/
|
327
|
-
static VALUE
|
328
|
-
|
354
|
+
static VALUE libvirt_storage_pool_free(VALUE p)
|
355
|
+
{
|
356
|
+
ruby_libvirt_generate_call_free(StoragePool, p);
|
329
357
|
}
|
330
358
|
#endif
|
331
359
|
|
@@ -336,111 +364,144 @@ static VALUE libvirt_pool_free(VALUE s) {
|
|
336
364
|
static VALUE c_storage_vol;
|
337
365
|
static VALUE c_storage_vol_info;
|
338
366
|
|
339
|
-
static void vol_free(void *d)
|
340
|
-
|
367
|
+
static void vol_free(void *d)
|
368
|
+
{
|
369
|
+
ruby_libvirt_free_struct(StorageVol, d);
|
341
370
|
}
|
342
371
|
|
343
|
-
static VALUE vol_new(virStorageVolPtr
|
344
|
-
|
372
|
+
static VALUE vol_new(virStorageVolPtr v, VALUE conn)
|
373
|
+
{
|
374
|
+
return ruby_libvirt_new_class(c_storage_vol, v, conn, vol_free);
|
345
375
|
}
|
346
376
|
|
347
377
|
/*
|
348
378
|
* call-seq:
|
349
379
|
* pool.lookup_volume_by_name(name) -> Libvirt::StorageVol
|
350
380
|
*
|
351
|
-
* Call
|
381
|
+
* Call virStorageVolLookupByName[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByName]
|
352
382
|
* to retrieve a storage volume object by name.
|
353
383
|
*/
|
354
|
-
static VALUE
|
384
|
+
static VALUE libvirt_storage_pool_lookup_vol_by_name(VALUE p, VALUE name)
|
385
|
+
{
|
355
386
|
virStorageVolPtr vol;
|
356
387
|
|
357
388
|
vol = virStorageVolLookupByName(pool_get(p), StringValueCStr(name));
|
358
|
-
|
359
|
-
|
389
|
+
ruby_libvirt_raise_error_if(vol == NULL, e_RetrieveError,
|
390
|
+
"virStorageVolLookupByName",
|
391
|
+
ruby_libvirt_connect_get(p));
|
360
392
|
|
361
|
-
return vol_new(vol,
|
393
|
+
return vol_new(vol, ruby_libvirt_conn_attr(p));
|
362
394
|
}
|
363
395
|
|
364
396
|
/*
|
365
397
|
* call-seq:
|
366
398
|
* pool.lookup_volume_by_key(key) -> Libvirt::StorageVol
|
367
399
|
*
|
368
|
-
* Call
|
400
|
+
* Call virStorageVolLookupByKey[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByKey]
|
369
401
|
* to retrieve a storage volume object by key.
|
370
402
|
*/
|
371
|
-
static VALUE
|
403
|
+
static VALUE libvirt_storage_pool_lookup_vol_by_key(VALUE p, VALUE key)
|
404
|
+
{
|
372
405
|
virStorageVolPtr vol;
|
373
406
|
|
374
407
|
/* FIXME: Why does this take a connection, not a pool? */
|
375
|
-
vol = virStorageVolLookupByKey(
|
376
|
-
|
377
|
-
|
408
|
+
vol = virStorageVolLookupByKey(ruby_libvirt_connect_get(p),
|
409
|
+
StringValueCStr(key));
|
410
|
+
ruby_libvirt_raise_error_if(vol == NULL, e_RetrieveError,
|
411
|
+
"virStorageVolLookupByKey",
|
412
|
+
ruby_libvirt_connect_get(p));
|
378
413
|
|
379
|
-
return vol_new(vol,
|
414
|
+
return vol_new(vol, ruby_libvirt_conn_attr(p));
|
380
415
|
}
|
381
416
|
|
382
417
|
/*
|
383
418
|
* call-seq:
|
384
419
|
* pool.lookup_volume_by_path(path) -> Libvirt::StorageVol
|
385
420
|
*
|
386
|
-
* Call
|
421
|
+
* Call virStorageVolLookupByPath[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByPath]
|
387
422
|
* to retrieve a storage volume object by path.
|
388
423
|
*/
|
389
|
-
static VALUE
|
424
|
+
static VALUE libvirt_storage_pool_lookup_vol_by_path(VALUE p, VALUE path)
|
425
|
+
{
|
390
426
|
virStorageVolPtr vol;
|
391
427
|
|
392
428
|
/* FIXME: Why does this take a connection, not a pool? */
|
393
|
-
vol = virStorageVolLookupByPath(
|
394
|
-
|
395
|
-
|
429
|
+
vol = virStorageVolLookupByPath(ruby_libvirt_connect_get(p),
|
430
|
+
StringValueCStr(path));
|
431
|
+
ruby_libvirt_raise_error_if(vol == NULL, e_RetrieveError,
|
432
|
+
"virStorageVolLookupByPath",
|
433
|
+
ruby_libvirt_connect_get(p));
|
434
|
+
|
435
|
+
return vol_new(vol, ruby_libvirt_conn_attr(p));
|
436
|
+
}
|
396
437
|
|
397
|
-
|
438
|
+
#if HAVE_VIRSTORAGEPOOLLISTALLVOLUMES
|
439
|
+
/*
|
440
|
+
* call-seq:
|
441
|
+
* pool.list_all_volumes(flags=0) -> array
|
442
|
+
*
|
443
|
+
* Call virStoragePoolListAllVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolListAllVolumes]
|
444
|
+
* to get an array of volume objects for all volumes.
|
445
|
+
*/
|
446
|
+
static VALUE libvirt_storage_pool_list_all_volumes(int argc, VALUE *argv,
|
447
|
+
VALUE p)
|
448
|
+
{
|
449
|
+
ruby_libvirt_generate_call_list_all(virStorageVolPtr, argc, argv,
|
450
|
+
virStoragePoolListAllVolumes,
|
451
|
+
pool_get(p), p, vol_new,
|
452
|
+
virStorageVolFree);
|
398
453
|
}
|
454
|
+
#endif
|
399
455
|
|
400
456
|
/*
|
401
457
|
* call-seq:
|
402
458
|
* vol.name -> string
|
403
459
|
*
|
404
|
-
* Call
|
460
|
+
* Call virStorageVolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetName]
|
405
461
|
* to retrieve the name of this storage volume.
|
406
462
|
*/
|
407
|
-
static VALUE
|
408
|
-
|
463
|
+
static VALUE libvirt_storage_vol_name(VALUE v)
|
464
|
+
{
|
465
|
+
ruby_libvirt_generate_call_string(virStorageVolGetName,
|
466
|
+
ruby_libvirt_connect_get(v), 0,
|
467
|
+
vol_get(v));
|
409
468
|
}
|
410
469
|
|
411
470
|
/*
|
412
471
|
* call-seq:
|
413
472
|
* vol.key -> string
|
414
473
|
*
|
415
|
-
* Call
|
474
|
+
* Call virStorageVolGetKey[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetKey]
|
416
475
|
* to retrieve the key for this storage volume.
|
417
476
|
*/
|
418
|
-
static VALUE
|
419
|
-
|
477
|
+
static VALUE libvirt_storage_vol_key(VALUE v)
|
478
|
+
{
|
479
|
+
ruby_libvirt_generate_call_string(virStorageVolGetKey,
|
480
|
+
ruby_libvirt_connect_get(v), 0,
|
481
|
+
vol_get(v));
|
420
482
|
}
|
421
483
|
|
422
484
|
/*
|
423
485
|
* call-seq:
|
424
486
|
* pool.create_volume_xml(xml, flags=0) -> Libvirt::StorageVol
|
425
487
|
*
|
426
|
-
* Call
|
488
|
+
* Call virStorageVolCreateXML[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolCreateXML]
|
427
489
|
* to create a new storage volume from xml.
|
428
490
|
*/
|
429
|
-
static VALUE
|
491
|
+
static VALUE libvirt_storage_pool_create_volume_xml(int argc, VALUE *argv,
|
492
|
+
VALUE p)
|
493
|
+
{
|
430
494
|
virStorageVolPtr vol;
|
431
|
-
virConnectPtr c = conn(p);
|
432
495
|
VALUE xml, flags;
|
433
496
|
|
434
497
|
rb_scan_args(argc, argv, "11", &xml, &flags);
|
435
498
|
|
436
|
-
if (NIL_P(flags))
|
437
|
-
flags = INT2NUM(0);
|
438
|
-
|
439
499
|
vol = virStorageVolCreateXML(pool_get(p), StringValueCStr(xml),
|
440
|
-
|
441
|
-
|
500
|
+
ruby_libvirt_value_to_uint(flags));
|
501
|
+
ruby_libvirt_raise_error_if(vol == NULL, e_Error, "virNetworkCreateXML",
|
502
|
+
ruby_libvirt_connect_get(p));
|
442
503
|
|
443
|
-
return vol_new(vol,
|
504
|
+
return vol_new(vol, ruby_libvirt_conn_attr(p));
|
444
505
|
}
|
445
506
|
|
446
507
|
#if HAVE_VIRSTORAGEVOLCREATEXMLFROM
|
@@ -448,25 +509,26 @@ static VALUE libvirt_pool_vol_create_xml(int argc, VALUE *argv, VALUE p) {
|
|
448
509
|
* call-seq:
|
449
510
|
* pool.create_volume_xml_from(xml, clonevol, flags=0) -> Libvirt::StorageVol
|
450
511
|
*
|
451
|
-
* Call
|
512
|
+
* Call virStorageVolCreateXMLFrom[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolCreateXMLFrom]
|
452
513
|
* to clone a volume from an existing volume with the properties specified in
|
453
514
|
* xml.
|
454
515
|
*/
|
455
|
-
static VALUE
|
516
|
+
static VALUE libvirt_storage_pool_create_volume_xml_from(int argc, VALUE *argv,
|
517
|
+
VALUE p)
|
518
|
+
{
|
456
519
|
virStorageVolPtr vol;
|
457
|
-
virConnectPtr c = conn(p);
|
458
520
|
VALUE xml, flags, cloneval;
|
459
521
|
|
460
522
|
rb_scan_args(argc, argv, "21", &xml, &cloneval, &flags);
|
461
523
|
|
462
|
-
if (NIL_P(flags))
|
463
|
-
flags = INT2NUM(0);
|
464
|
-
|
465
524
|
vol = virStorageVolCreateXMLFrom(pool_get(p), StringValueCStr(xml),
|
466
|
-
vol_get(cloneval),
|
467
|
-
|
525
|
+
vol_get(cloneval),
|
526
|
+
ruby_libvirt_value_to_uint(flags));
|
527
|
+
ruby_libvirt_raise_error_if(vol == NULL, e_Error,
|
528
|
+
"virNetworkCreateXMLFrom",
|
529
|
+
ruby_libvirt_connect_get(p));
|
468
530
|
|
469
|
-
return vol_new(vol,
|
531
|
+
return vol_new(vol, ruby_libvirt_conn_attr(p));
|
470
532
|
}
|
471
533
|
#endif
|
472
534
|
|
@@ -475,11 +537,14 @@ static VALUE libvirt_pool_vol_create_xml_from(int argc, VALUE *argv, VALUE p) {
|
|
475
537
|
* call-seq:
|
476
538
|
* pool.active? -> [true|false]
|
477
539
|
*
|
478
|
-
* Call
|
540
|
+
* Call virStoragePoolIsActive[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolIsActive]
|
479
541
|
* to determine if this storage pool is active.
|
480
542
|
*/
|
481
|
-
static VALUE
|
482
|
-
|
543
|
+
static VALUE libvirt_storage_pool_active_p(VALUE p)
|
544
|
+
{
|
545
|
+
ruby_libvirt_generate_call_truefalse(virStoragePoolIsActive,
|
546
|
+
ruby_libvirt_connect_get(p),
|
547
|
+
pool_get(p));
|
483
548
|
}
|
484
549
|
#endif
|
485
550
|
|
@@ -488,11 +553,14 @@ static VALUE libvirt_pool_active_p(VALUE p) {
|
|
488
553
|
* call-seq:
|
489
554
|
* pool.persistent? -> [true|false]
|
490
555
|
*
|
491
|
-
* Call
|
556
|
+
* Call virStoragePoolIsPersistent[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolIsPersistent]
|
492
557
|
* to determine if this storage pool is persistent.
|
493
558
|
*/
|
494
|
-
static VALUE
|
495
|
-
|
559
|
+
static VALUE libvirt_storage_pool_persistent_p(VALUE p)
|
560
|
+
{
|
561
|
+
ruby_libvirt_generate_call_truefalse(virStoragePoolIsPersistent,
|
562
|
+
ruby_libvirt_connect_get(p),
|
563
|
+
pool_get(p));
|
496
564
|
}
|
497
565
|
#endif
|
498
566
|
|
@@ -500,18 +568,19 @@ static VALUE libvirt_pool_persistent_p(VALUE p) {
|
|
500
568
|
* call-seq:
|
501
569
|
* vol.delete(flags=0) -> nil
|
502
570
|
*
|
503
|
-
* Call
|
571
|
+
* Call virStorageVolDelete[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolDelete]
|
504
572
|
* to delete this volume. This is a destructive operation.
|
505
573
|
*/
|
506
|
-
static VALUE
|
574
|
+
static VALUE libvirt_storage_vol_delete(int argc, VALUE *argv, VALUE v)
|
575
|
+
{
|
507
576
|
VALUE flags;
|
508
577
|
|
509
578
|
rb_scan_args(argc, argv, "01", &flags);
|
510
579
|
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
580
|
+
ruby_libvirt_generate_call_nil(virStorageVolDelete,
|
581
|
+
ruby_libvirt_connect_get(v),
|
582
|
+
vol_get(v),
|
583
|
+
ruby_libvirt_value_to_uint(flags));
|
515
584
|
}
|
516
585
|
|
517
586
|
#if HAVE_VIRSTORAGEVOLWIPE
|
@@ -519,18 +588,19 @@ static VALUE libvirt_vol_delete(int argc, VALUE *argv, VALUE v) {
|
|
519
588
|
* call-seq:
|
520
589
|
* vol.wipe(flags=0) -> nil
|
521
590
|
*
|
522
|
-
* Call
|
591
|
+
* Call virStorageVolWipe[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolWipe]
|
523
592
|
* to wipe the data from this storage volume. This is a destructive operation.
|
524
593
|
*/
|
525
|
-
static VALUE
|
594
|
+
static VALUE libvirt_storage_vol_wipe(int argc, VALUE *argv, VALUE v)
|
595
|
+
{
|
526
596
|
VALUE flags;
|
527
597
|
|
528
598
|
rb_scan_args(argc, argv, "01", &flags);
|
529
599
|
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
600
|
+
ruby_libvirt_generate_call_nil(virStorageVolWipe,
|
601
|
+
ruby_libvirt_connect_get(v),
|
602
|
+
vol_get(v),
|
603
|
+
ruby_libvirt_value_to_uint(flags));
|
534
604
|
}
|
535
605
|
#endif
|
536
606
|
|
@@ -538,16 +608,18 @@ static VALUE libvirt_vol_wipe(int argc, VALUE *argv, VALUE v) {
|
|
538
608
|
* call-seq:
|
539
609
|
* vol.info -> Libvirt::StorageVolInfo
|
540
610
|
*
|
541
|
-
* Call
|
611
|
+
* Call virStorageVolGetInfo[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetInfo]
|
542
612
|
* to retrieve information about this storage volume.
|
543
613
|
*/
|
544
|
-
static VALUE
|
614
|
+
static VALUE libvirt_storage_vol_info(VALUE v)
|
615
|
+
{
|
545
616
|
virStorageVolInfo info;
|
546
617
|
int r;
|
547
618
|
VALUE result;
|
548
619
|
|
549
620
|
r = virStorageVolGetInfo(vol_get(v), &info);
|
550
|
-
|
621
|
+
ruby_libvirt_raise_error_if(r < 0, e_RetrieveError, "virStorageVolGetInfo",
|
622
|
+
ruby_libvirt_connect_get(v));
|
551
623
|
|
552
624
|
result = rb_class_new_instance(0, NULL, c_storage_vol_info);
|
553
625
|
rb_iv_set(result, "@type", INT2NUM(info.type));
|
@@ -561,42 +633,46 @@ static VALUE libvirt_vol_info(VALUE v) {
|
|
561
633
|
* call-seq:
|
562
634
|
* vol.xml_desc(flags=0) -> string
|
563
635
|
*
|
564
|
-
* Call
|
636
|
+
* Call virStorageVolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetXMLDesc]
|
565
637
|
* to retrieve the xml for this storage volume.
|
566
638
|
*/
|
567
|
-
static VALUE
|
639
|
+
static VALUE libvirt_storage_vol_xml_desc(int argc, VALUE *argv, VALUE v)
|
640
|
+
{
|
568
641
|
VALUE flags;
|
569
642
|
|
570
643
|
rb_scan_args(argc, argv, "01", &flags);
|
571
644
|
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
NUM2UINT(flags));
|
645
|
+
ruby_libvirt_generate_call_string(virStorageVolGetXMLDesc,
|
646
|
+
ruby_libvirt_connect_get(v),
|
647
|
+
1, vol_get(v),
|
648
|
+
ruby_libvirt_value_to_uint(flags));
|
577
649
|
}
|
578
650
|
|
579
651
|
/*
|
580
652
|
* call-seq:
|
581
653
|
* vol.path -> string
|
582
654
|
*
|
583
|
-
* Call
|
655
|
+
* Call virStorageVolGetPath[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetPath]
|
584
656
|
* to retrieve the path for this storage volume.
|
585
657
|
*/
|
586
|
-
static VALUE
|
587
|
-
|
658
|
+
static VALUE libvirt_storage_vol_path(VALUE v)
|
659
|
+
{
|
660
|
+
ruby_libvirt_generate_call_string(virStorageVolGetPath,
|
661
|
+
ruby_libvirt_connect_get(v), 1,
|
662
|
+
vol_get(v));
|
588
663
|
}
|
589
664
|
|
590
665
|
/*
|
591
666
|
* call-seq:
|
592
667
|
* vol.free -> nil
|
593
668
|
*
|
594
|
-
* Call
|
669
|
+
* Call virStorageVolFree[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolFree]
|
595
670
|
* to free the storage volume object. After this call the storage volume object
|
596
671
|
* is no longer valid.
|
597
672
|
*/
|
598
|
-
static VALUE
|
599
|
-
|
673
|
+
static VALUE libvirt_storage_vol_free(VALUE v)
|
674
|
+
{
|
675
|
+
ruby_libvirt_generate_call_free(StorageVol, v);
|
600
676
|
}
|
601
677
|
#endif
|
602
678
|
|
@@ -605,42 +681,87 @@ static VALUE libvirt_vol_free(VALUE s) {
|
|
605
681
|
* call-seq:
|
606
682
|
* vol.download(stream, offset, length, flags=0) -> nil
|
607
683
|
*
|
608
|
-
* Call
|
684
|
+
* Call virStorageVolDownload[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolDownload]
|
609
685
|
* to download the content of a volume as a stream.
|
610
686
|
*/
|
611
|
-
static VALUE
|
687
|
+
static VALUE libvirt_storage_vol_download(int argc, VALUE *argv, VALUE v)
|
688
|
+
{
|
612
689
|
VALUE st, offset, length, flags;
|
613
690
|
|
614
691
|
rb_scan_args(argc, argv, "31", &st, &offset, &length, &flags);
|
615
692
|
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
693
|
+
ruby_libvirt_generate_call_nil(virStorageVolDownload,
|
694
|
+
ruby_libvirt_connect_get(v),
|
695
|
+
vol_get(v), ruby_libvirt_stream_get(st),
|
696
|
+
NUM2ULL(offset), NUM2ULL(length),
|
697
|
+
ruby_libvirt_value_to_uint(flags));
|
621
698
|
}
|
622
699
|
|
623
700
|
/*
|
624
701
|
* call-seq:
|
625
702
|
* vol.upload(stream, offset, length, flags=0) -> nil
|
626
703
|
*
|
627
|
-
* Call
|
704
|
+
* Call virStorageVolUpload[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolUpload]
|
628
705
|
* to upload new content to a volume from a stream.
|
629
706
|
*/
|
630
|
-
static VALUE
|
707
|
+
static VALUE libvirt_storage_vol_upload(int argc, VALUE *argv, VALUE v)
|
708
|
+
{
|
631
709
|
VALUE st, offset, length, flags;
|
632
710
|
|
633
711
|
rb_scan_args(argc, argv, "31", &st, &offset, &length, &flags);
|
634
712
|
|
635
|
-
|
636
|
-
|
713
|
+
ruby_libvirt_generate_call_nil(virStorageVolUpload,
|
714
|
+
ruby_libvirt_connect_get(v),
|
715
|
+
vol_get(v), ruby_libvirt_stream_get(st),
|
716
|
+
NUM2ULL(offset), NUM2ULL(length),
|
717
|
+
ruby_libvirt_value_to_uint(flags));
|
718
|
+
}
|
719
|
+
#endif
|
720
|
+
|
721
|
+
#if HAVE_VIRSTORAGEVOLWIPEPATTERN
|
722
|
+
/*
|
723
|
+
* call-seq:
|
724
|
+
* vol.wipe_pattern(alg, flags=0) -> nil
|
725
|
+
*
|
726
|
+
* Call virStorageVolWipePattern[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolWipePattern]
|
727
|
+
* to wipe the data from this storage volume. This is a destructive operation.
|
728
|
+
*/
|
729
|
+
static VALUE libvirt_storage_vol_wipe_pattern(int argc, VALUE *argv, VALUE v)
|
730
|
+
{
|
731
|
+
VALUE alg, flags;
|
732
|
+
|
733
|
+
rb_scan_args(argc, argv, "11", &alg, &flags);
|
637
734
|
|
638
|
-
|
639
|
-
|
735
|
+
ruby_libvirt_generate_call_nil(virStorageVolWipePattern,
|
736
|
+
ruby_libvirt_connect_get(v),
|
737
|
+
vol_get(v), NUM2UINT(alg),
|
738
|
+
ruby_libvirt_value_to_uint(flags));
|
640
739
|
}
|
641
740
|
#endif
|
642
741
|
|
643
|
-
|
742
|
+
#if HAVE_VIRSTORAGEVOLRESIZE
|
743
|
+
/*
|
744
|
+
* call-seq:
|
745
|
+
* vol.resize(capacity, flags=0) -> nil
|
746
|
+
*
|
747
|
+
* Call virStorageVolResize[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolResize]
|
748
|
+
* to resize the associated storage volume.
|
749
|
+
*/
|
750
|
+
static VALUE libvirt_storage_vol_resize(int argc, VALUE *argv, VALUE v)
|
751
|
+
{
|
752
|
+
VALUE capacity, flags;
|
753
|
+
|
754
|
+
rb_scan_args(argc, argv, "11", &capacity, &flags);
|
755
|
+
|
756
|
+
ruby_libvirt_generate_call_nil(virStorageVolResize,
|
757
|
+
ruby_libvirt_connect_get(v),
|
758
|
+
vol_get(v), NUM2ULL(capacity),
|
759
|
+
ruby_libvirt_value_to_uint(flags));
|
760
|
+
}
|
761
|
+
#endif
|
762
|
+
|
763
|
+
void ruby_libvirt_storage_init(void)
|
764
|
+
{
|
644
765
|
/*
|
645
766
|
* Class Libvirt::StoragePool and Libvirt::StoragePoolInfo
|
646
767
|
*/
|
@@ -671,6 +792,11 @@ void init_storage(void) {
|
|
671
792
|
INT2NUM(VIR_STORAGE_POOL_INACCESSIBLE));
|
672
793
|
#endif
|
673
794
|
|
795
|
+
#if HAVE_CONST_VIR_STORAGE_XML_INACTIVE
|
796
|
+
rb_define_const(c_storage_pool, "XML_INACTIVE",
|
797
|
+
INT2NUM(VIR_STORAGE_XML_INACTIVE));
|
798
|
+
#endif
|
799
|
+
|
674
800
|
/* virStoragePoolBuildFlags */
|
675
801
|
rb_define_const(c_storage_pool, "BUILD_NEW",
|
676
802
|
INT2NUM(VIR_STORAGE_POOL_BUILD_NEW));
|
@@ -685,51 +811,79 @@ void init_storage(void) {
|
|
685
811
|
rb_define_const(c_storage_pool, "DELETE_ZEROED",
|
686
812
|
INT2NUM(VIR_STORAGE_POOL_DELETE_ZEROED));
|
687
813
|
|
814
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA
|
815
|
+
rb_define_const(c_storage_pool, "CREATE_PREALLOC_METADATA",
|
816
|
+
INT2NUM(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA));
|
817
|
+
#endif
|
818
|
+
|
688
819
|
/* Creating/destroying pools */
|
689
|
-
rb_define_method(c_storage_pool, "build",
|
690
|
-
rb_define_method(c_storage_pool, "undefine",
|
691
|
-
|
692
|
-
rb_define_method(c_storage_pool, "
|
693
|
-
rb_define_method(c_storage_pool, "
|
694
|
-
|
820
|
+
rb_define_method(c_storage_pool, "build", libvirt_storage_pool_build, -1);
|
821
|
+
rb_define_method(c_storage_pool, "undefine", libvirt_storage_pool_undefine,
|
822
|
+
0);
|
823
|
+
rb_define_method(c_storage_pool, "create", libvirt_storage_pool_create, -1);
|
824
|
+
rb_define_method(c_storage_pool, "destroy", libvirt_storage_pool_destroy,
|
825
|
+
0);
|
826
|
+
rb_define_method(c_storage_pool, "delete", libvirt_storage_pool_delete, -1);
|
827
|
+
rb_define_method(c_storage_pool, "refresh", libvirt_storage_pool_refresh,
|
828
|
+
-1);
|
695
829
|
/* StoragePool information */
|
696
|
-
rb_define_method(c_storage_pool, "name",
|
697
|
-
rb_define_method(c_storage_pool, "uuid",
|
698
|
-
rb_define_method(c_storage_pool, "info",
|
699
|
-
rb_define_method(c_storage_pool, "xml_desc",
|
700
|
-
|
701
|
-
rb_define_method(c_storage_pool, "autostart
|
830
|
+
rb_define_method(c_storage_pool, "name", libvirt_storage_pool_name, 0);
|
831
|
+
rb_define_method(c_storage_pool, "uuid", libvirt_storage_pool_uuid, 0);
|
832
|
+
rb_define_method(c_storage_pool, "info", libvirt_storage_pool_info, 0);
|
833
|
+
rb_define_method(c_storage_pool, "xml_desc", libvirt_storage_pool_xml_desc,
|
834
|
+
-1);
|
835
|
+
rb_define_method(c_storage_pool, "autostart",
|
836
|
+
libvirt_storage_pool_autostart, 0);
|
837
|
+
rb_define_method(c_storage_pool, "autostart?",
|
838
|
+
libvirt_storage_pool_autostart, 0);
|
702
839
|
rb_define_method(c_storage_pool, "autostart=",
|
703
|
-
|
840
|
+
libvirt_storage_pool_autostart_equal, 1);
|
704
841
|
/* List/lookup storage volumes within a pool */
|
705
842
|
rb_define_method(c_storage_pool, "num_of_volumes",
|
706
|
-
|
843
|
+
libvirt_storage_pool_num_of_volumes, 0);
|
707
844
|
rb_define_method(c_storage_pool, "list_volumes",
|
708
|
-
|
845
|
+
libvirt_storage_pool_list_volumes, 0);
|
709
846
|
/* Lookup volumes based on various attributes */
|
710
847
|
rb_define_method(c_storage_pool, "lookup_volume_by_name",
|
711
|
-
|
848
|
+
libvirt_storage_pool_lookup_vol_by_name, 1);
|
712
849
|
rb_define_method(c_storage_pool, "lookup_volume_by_key",
|
713
|
-
|
850
|
+
libvirt_storage_pool_lookup_vol_by_key, 1);
|
714
851
|
rb_define_method(c_storage_pool, "lookup_volume_by_path",
|
715
|
-
|
716
|
-
rb_define_method(c_storage_pool, "free",
|
717
|
-
rb_define_method(c_storage_pool, "
|
718
|
-
|
719
|
-
rb_define_alias(c_storage_pool, "
|
852
|
+
libvirt_storage_pool_lookup_vol_by_path, 1);
|
853
|
+
rb_define_method(c_storage_pool, "free", libvirt_storage_pool_free, 0);
|
854
|
+
rb_define_method(c_storage_pool, "create_volume_xml",
|
855
|
+
libvirt_storage_pool_create_volume_xml, -1);
|
856
|
+
rb_define_alias(c_storage_pool, "create_vol_xml", "create_volume_xml");
|
720
857
|
#if HAVE_VIRSTORAGEVOLCREATEXMLFROM
|
721
|
-
rb_define_method(c_storage_pool, "
|
722
|
-
|
723
|
-
rb_define_alias(c_storage_pool, "
|
724
|
-
"
|
858
|
+
rb_define_method(c_storage_pool, "create_volume_xml_from",
|
859
|
+
libvirt_storage_pool_create_volume_xml_from, -1);
|
860
|
+
rb_define_alias(c_storage_pool, "create_vol_xml_from",
|
861
|
+
"create_volume_xml_from");
|
725
862
|
#endif
|
726
863
|
#if HAVE_VIRSTORAGEPOOLISACTIVE
|
727
|
-
rb_define_method(c_storage_pool, "active?",
|
864
|
+
rb_define_method(c_storage_pool, "active?", libvirt_storage_pool_active_p,
|
865
|
+
0);
|
728
866
|
#endif
|
729
867
|
#if HAVE_VIRSTORAGEPOOLISPERSISTENT
|
730
868
|
rb_define_method(c_storage_pool, "persistent?",
|
731
|
-
|
869
|
+
libvirt_storage_pool_persistent_p, 0);
|
732
870
|
#endif
|
871
|
+
|
872
|
+
#if HAVE_VIRSTORAGEPOOLLISTALLVOLUMES
|
873
|
+
rb_define_method(c_storage_pool, "list_all_volumes",
|
874
|
+
libvirt_storage_pool_list_all_volumes, -1);
|
875
|
+
#endif
|
876
|
+
|
877
|
+
#if HAVE_CONST_VIR_STORAGE_POOL_BUILD_NO_OVERWRITE
|
878
|
+
rb_define_const(c_storage_pool, "BUILD_NO_OVERWRITE",
|
879
|
+
INT2NUM(VIR_STORAGE_POOL_BUILD_NO_OVERWRITE));
|
880
|
+
#endif
|
881
|
+
|
882
|
+
#if HAVE_CONST_VIR_STORAGE_POOL_BUILD_OVERWRITE
|
883
|
+
rb_define_const(c_storage_pool, "BUILD_OVERWRITE",
|
884
|
+
INT2NUM(VIR_STORAGE_POOL_BUILD_OVERWRITE));
|
885
|
+
#endif
|
886
|
+
|
733
887
|
#endif
|
734
888
|
|
735
889
|
#if HAVE_TYPE_VIRSTORAGEVOLPTR
|
@@ -745,9 +899,20 @@ void init_storage(void) {
|
|
745
899
|
c_storage_vol = rb_define_class_under(m_libvirt, "StorageVol",
|
746
900
|
rb_cObject);
|
747
901
|
|
902
|
+
#if HAVE_CONST_VIR_STORAGE_XML_INACTIVE
|
903
|
+
rb_define_const(c_storage_vol, "XML_INACTIVE",
|
904
|
+
INT2NUM(VIR_STORAGE_XML_INACTIVE));
|
905
|
+
#endif
|
906
|
+
|
748
907
|
/* virStorageVolType */
|
749
908
|
rb_define_const(c_storage_vol, "FILE", INT2NUM(VIR_STORAGE_VOL_FILE));
|
750
909
|
rb_define_const(c_storage_vol, "BLOCK", INT2NUM(VIR_STORAGE_VOL_BLOCK));
|
910
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_DIR
|
911
|
+
rb_define_const(c_storage_vol, "DIR", INT2NUM(VIR_STORAGE_VOL_DIR));
|
912
|
+
#endif
|
913
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_NETWORK
|
914
|
+
rb_define_const(c_storage_vol, "NETWORK", INT2NUM(VIR_STORAGE_VOL_NETWORK));
|
915
|
+
#endif
|
751
916
|
|
752
917
|
/* virStorageVolDeleteFlags */
|
753
918
|
rb_define_const(c_storage_vol, "DELETE_NORMAL",
|
@@ -755,21 +920,74 @@ void init_storage(void) {
|
|
755
920
|
rb_define_const(c_storage_vol, "DELETE_ZEROED",
|
756
921
|
INT2NUM(VIR_STORAGE_VOL_DELETE_ZEROED));
|
757
922
|
|
758
|
-
rb_define_method(c_storage_vol, "pool",
|
759
|
-
rb_define_method(c_storage_vol, "name",
|
760
|
-
rb_define_method(c_storage_vol, "key",
|
761
|
-
rb_define_method(c_storage_vol, "delete",
|
923
|
+
rb_define_method(c_storage_vol, "pool", libvirt_storage_vol_pool, 0);
|
924
|
+
rb_define_method(c_storage_vol, "name", libvirt_storage_vol_name, 0);
|
925
|
+
rb_define_method(c_storage_vol, "key", libvirt_storage_vol_key, 0);
|
926
|
+
rb_define_method(c_storage_vol, "delete", libvirt_storage_vol_delete, -1);
|
762
927
|
#if HAVE_VIRSTORAGEVOLWIPE
|
763
|
-
rb_define_method(c_storage_vol, "wipe",
|
928
|
+
rb_define_method(c_storage_vol, "wipe", libvirt_storage_vol_wipe, -1);
|
929
|
+
#endif
|
930
|
+
#if HAVE_VIRSTORAGEVOLWIPEPATTERN
|
931
|
+
rb_define_method(c_storage_vol, "wipe_pattern",
|
932
|
+
libvirt_storage_vol_wipe_pattern, -1);
|
933
|
+
#endif
|
934
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_ZERO
|
935
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_ZERO",
|
936
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_ZERO));
|
937
|
+
#endif
|
938
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_NNSA
|
939
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_NNSA",
|
940
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_NNSA));
|
941
|
+
#endif
|
942
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_DOD
|
943
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_DOD",
|
944
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_DOD));
|
945
|
+
#endif
|
946
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_BSI
|
947
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_BSI",
|
948
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_BSI));
|
764
949
|
#endif
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
950
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_GUTMANN
|
951
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_GUTMANN",
|
952
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_GUTMANN));
|
953
|
+
#endif
|
954
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER
|
955
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_SCHNEIER",
|
956
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER));
|
957
|
+
#endif
|
958
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7
|
959
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_PFITZNER7",
|
960
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7));
|
961
|
+
#endif
|
962
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33
|
963
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_PFITZNER33",
|
964
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33));
|
965
|
+
#endif
|
966
|
+
#if HAVE_CONST_VIR_STORAGE_VOL_WIPE_ALG_RANDOM
|
967
|
+
rb_define_const(c_storage_vol, "WIPE_ALG_RANDOM",
|
968
|
+
INT2NUM(VIR_STORAGE_VOL_WIPE_ALG_RANDOM));
|
969
|
+
#endif
|
970
|
+
|
971
|
+
rb_define_method(c_storage_vol, "info", libvirt_storage_vol_info, 0);
|
972
|
+
rb_define_method(c_storage_vol, "xml_desc", libvirt_storage_vol_xml_desc,
|
973
|
+
-1);
|
974
|
+
rb_define_method(c_storage_vol, "path", libvirt_storage_vol_path, 0);
|
975
|
+
rb_define_method(c_storage_vol, "free", libvirt_storage_vol_free, 0);
|
769
976
|
|
770
977
|
#if HAVE_VIRSTORAGEVOLDOWNLOAD
|
771
|
-
rb_define_method(c_storage_vol, "download",
|
772
|
-
|
978
|
+
rb_define_method(c_storage_vol, "download", libvirt_storage_vol_download,
|
979
|
+
-1);
|
980
|
+
rb_define_method(c_storage_vol, "upload", libvirt_storage_vol_upload, -1);
|
981
|
+
#endif
|
982
|
+
|
983
|
+
#if HAVE_VIRSTORAGEVOLRESIZE
|
984
|
+
rb_define_const(c_storage_vol, "RESIZE_ALLOCATE",
|
985
|
+
INT2NUM(VIR_STORAGE_VOL_RESIZE_ALLOCATE));
|
986
|
+
rb_define_const(c_storage_vol, "RESIZE_DELTA",
|
987
|
+
INT2NUM(VIR_STORAGE_VOL_RESIZE_DELTA));
|
988
|
+
rb_define_const(c_storage_vol, "RESIZE_SHRINK",
|
989
|
+
INT2NUM(VIR_STORAGE_VOL_RESIZE_SHRINK));
|
990
|
+
rb_define_method(c_storage_vol, "resize", libvirt_storage_vol_resize, -1);
|
773
991
|
#endif
|
774
992
|
|
775
993
|
#endif
|