class Libvirt::StoragePool
Constants
- BUILDING
- BUILD_NEW
virStoragePoolBuildFlags
- BUILD_REPAIR
- BUILD_RESIZE
- DEGRADED
- DELETE_NORMAL
virStoragePoolDeleteFlags
- DELETE_ZEROED
- INACCESSIBLE
- INACTIVE
virStoragePoolState
- RUNNING
Attributes
Public Instance Methods
Call
virStoragePoolIsActive[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolIsActive]
to determine if this storage pool is active.
static VALUE libvirt_pool_active_p(VALUE p) {
gen_call_truefalse(virStoragePoolIsActive, conn(p), pool_get(p));
}
Call
virStoragePoolGetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetAutostart]
to determine whether this storage pool will autostart when libvirtd starts.
static VALUE libvirt_pool_autostart(VALUE s){
Call
virStoragePoolSetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolSetAutostart]
to make this storage pool start when libvirtd starts.
static VALUE libvirt_pool_autostart_set(VALUE s, VALUE autostart) {
if (autostart != Qtrue && autostart != Qfalse)
rb_raise(rb_eTypeError,
"wrong argument type (expected TrueClass or FalseClass)");
gen_call_void(virStoragePoolSetAutostart, conn(s), pool_get(s),
RTEST(autostart) ? 1 : 0);
}
Call
virStoragePoolGetAutostart[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetAutostart]
to determine whether this storage pool will autostart when libvirtd starts.
static VALUE libvirt_pool_autostart(VALUE s){
Call
virStoragePoolBuild[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolBuild]
to build this storage pool.
static VALUE libvirt_pool_build(int argc, VALUE *argv, VALUE p) {
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
gen_call_void(virStoragePoolBuild, conn(p), pool_get(p), NUM2UINT(flags));
}
Call
virStoragePoolCreate[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolCreate]
to start this storage pool.
static VALUE libvirt_pool_create(int argc, VALUE *argv, VALUE p) {
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
gen_call_void(virStoragePoolCreate, conn(p), pool_get(p), NUM2UINT(flags));
}
Call
virStorageVolCreateXML[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolCreateXML]
to create a new storage volume from xml.
static VALUE libvirt_pool_vol_create_xml(int argc, VALUE *argv, VALUE p) {
virStorageVolPtr vol;
virConnectPtr c = conn(p);
VALUE xml, flags;
rb_scan_args(argc, argv, "11", &xml, &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
vol = virStorageVolCreateXML(pool_get(p), StringValueCStr(xml),
NUM2UINT(flags));
_E(vol == NULL, create_error(e_Error, "virNetworkCreateXML", c));
return vol_new(vol, conn_attr(p));
}
Call
virStorageVolCreateXMLFrom[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolCreateXMLFrom]
to clone a volume from an existing volume with the properties specified in
xml.
static VALUE libvirt_pool_vol_create_xml_from(int argc, VALUE *argv, VALUE p) {
virStorageVolPtr vol;
virConnectPtr c = conn(p);
VALUE xml, flags, cloneval;
rb_scan_args(argc, argv, "21", &xml, &cloneval, &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
vol = virStorageVolCreateXMLFrom(pool_get(p), StringValueCStr(xml),
vol_get(cloneval), NUM2UINT(flags));
_E(vol == NULL, create_error(e_Error, "virNetworkCreateXMLFrom", c));
return vol_new(vol, conn_attr(p));
}
Call
virStoragePoolDelete[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolDelete]
to delete the data corresponding to this data pool. This is a destructive
operation.
static VALUE libvirt_pool_delete(int argc, VALUE *argv, VALUE p) {
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
gen_call_void(virStoragePoolDelete, conn(p), pool_get(p), NUM2UINT(flags));
}
Call
virStoragePoolDestroy[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolDestroy]
to shutdown this storage pool.
static VALUE libvirt_pool_destroy(VALUE p) {
gen_call_void(virStoragePoolDestroy, conn(p), pool_get(p));
}
Call
virStoragePoolFree[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolFree]
to free this storage pool object. After this call the storage pool object
is no longer valid.
static VALUE libvirt_pool_free(VALUE s) {
gen_call_free(StoragePool, s);
}
Call
virStoragePoolGetInfo[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetInfo]
to retrieve information about this storage pool.
static VALUE libvirt_pool_info(VALUE s) {
virStoragePoolInfo info;
int r;
VALUE result;
r = virStoragePoolGetInfo(pool_get(s), &info);
_E(r < 0, create_error(e_RetrieveError, "virStoragePoolGetInfo", conn(s)));
result = rb_class_new_instance(0, NULL, c_storage_pool_info);
rb_iv_set(result, "@state", INT2NUM(info.state));
rb_iv_set(result, "@capacity", ULL2NUM(info.capacity));
rb_iv_set(result, "@allocation", ULL2NUM(info.allocation));
rb_iv_set(result, "@available", ULL2NUM(info.available));
return result;
}
Call
virStoragePoolListVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolListVolumes]
to retrieve a list of volume names in this storage pools.
static VALUE libvirt_pool_list_volumes(VALUE s) {
int r, num;
char **names;
virStoragePoolPtr pool = pool_get(s);
num = virStoragePoolNumOfVolumes(pool);
_E(num < 0, create_error(e_RetrieveError, "virStoragePoolNumOfVolumes",
conn(s)));
if (num == 0)
return rb_ary_new2(num);
names = ALLOC_N(char *, num);
r = virStoragePoolListVolumes(pool, names, num);
if (r < 0) {
xfree(names);
rb_exc_raise(create_error(e_RetrieveError, "virStoragePoolListVolumes",
conn(s)));
}
return gen_list(num, &names);
}
Call
virStorageVolLookupByKey[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByKey]
to retrieve a storage volume object by key.
static VALUE libvirt_pool_lookup_vol_by_key(VALUE p, VALUE key) {
virStorageVolPtr vol;
/* FIXME: Why does this take a connection, not a pool? */
vol = virStorageVolLookupByKey(conn(p), StringValueCStr(key));
_E(vol == NULL, create_error(e_RetrieveError, "virStorageVolLookupByKey",
conn(p)));
return vol_new(vol, conn_attr(p));
}
Call
virStorageVolLookupByName[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByName]
to retrieve a storage volume object by name.
static VALUE libvirt_pool_lookup_vol_by_name(VALUE p, VALUE name) {
virStorageVolPtr vol;
vol = virStorageVolLookupByName(pool_get(p), StringValueCStr(name));
_E(vol == NULL, create_error(e_RetrieveError, "virStorageVolLookupByName",
conn(p)));
return vol_new(vol, conn_attr(p));
}
Call
virStorageVolLookupByPath[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolLookupByPath]
to retrieve a storage volume object by path.
static VALUE libvirt_pool_lookup_vol_by_path(VALUE p, VALUE path) {
virStorageVolPtr vol;
/* FIXME: Why does this take a connection, not a pool? */
vol = virStorageVolLookupByPath(conn(p), StringValueCStr(path));
_E(vol == NULL, create_error(e_RetrieveError, "virStorageVolLookupByPath",
conn(p)));
return vol_new(vol, conn_attr(p));
}
Call
virStoragePoolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetName]
to retrieve the name of this storage pool.
static VALUE libvirt_pool_name(VALUE s) {
gen_call_string(virStoragePoolGetName, conn(s), 0, pool_get(s));
}
Call
virStoragePoolNumOfVolumes[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolNumOfVolumes]
to retrieve the number of volumes in this storage pool.
static VALUE libvirt_pool_num_of_volumes(VALUE s) {
int n = virStoragePoolNumOfVolumes(pool_get(s));
_E(n < 0, create_error(e_RetrieveError, "virStoragePoolNumOfVolumes",
conn(s)));
return INT2NUM(n);
}
Call
virStoragePoolIsPersistent[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolIsPersistent]
to determine if this storage pool is persistent.
static VALUE libvirt_pool_persistent_p(VALUE p) {
gen_call_truefalse(virStoragePoolIsPersistent, conn(p), pool_get(p));
}
Call
virStoragePoolRefresh[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolRefresh]
to refresh the list of volumes in this storage pool.
static VALUE libvirt_pool_refresh(int argc, VALUE *argv, VALUE p) {
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
gen_call_void(virStoragePoolRefresh, conn(p), pool_get(p), NUM2UINT(flags));
}
Call
virStoragePoolUndefine[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolUndefine]
to undefine this storage pool.
static VALUE libvirt_pool_undefine(VALUE p) {
gen_call_void(virStoragePoolUndefine, conn(p), pool_get(p));
}
Call
virStoragePoolGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetUUIDString]
to retrieve the UUID of this storage pool.
static VALUE libvirt_pool_uuid(VALUE s) {
char uuid[VIR_UUID_STRING_BUFLEN];
int r;
r = virStoragePoolGetUUIDString(pool_get(s), uuid);
_E(r < 0, create_error(e_RetrieveError, "virStoragePoolGetUUIDString",
conn(s)));
return rb_str_new2((char *) uuid);
}
Call
virStoragePoolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolGetXMLDesc]
to retrieve the XML for this storage pool.
static VALUE libvirt_pool_xml_desc(int argc, VALUE *argv, VALUE s) {
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
gen_call_string(virStoragePoolGetXMLDesc, conn(s), 1, pool_get(s),
NUM2UINT(flags));
}