class Libvirt::StoragePool
Constants
- BUILDING
- BUILD_NEW
virStoragePoolBuildFlags
- BUILD_NO_OVERWRITE
- BUILD_OVERWRITE
- BUILD_REPAIR
- BUILD_RESIZE
- CREATE_NORMAL
- CREATE_PREALLOC_METADATA
- CREATE_REFLINK
- CREATE_WITH_BUILD
- CREATE_WITH_BUILD_NO_OVERWRITE
- CREATE_WITH_BUILD_OVERWRITE
- DEGRADED
- DELETE_NORMAL
virStorageVolDeleteFlags
- DELETE_ZEROED
- INACCESSIBLE
- INACTIVE
virStoragePoolState
- RUNNING
- XML_INACTIVE
Attributes
Public Instance Methods
Call virStoragePoolIsActive to determine if this storage pool is active.
static VALUE libvirt_storage_pool_active_p(VALUE p)
{
ruby_libvirt_generate_call_truefalse(virStoragePoolIsActive,
ruby_libvirt_connect_get(p),
pool_get(p));
}
Call virStoragePoolGetAutostart to determine whether this storage pool will autostart when libvirtd starts.
static VALUE libvirt_storage_pool_autostart(VALUE p)
{
int r, autostart;
r = virStoragePoolGetAutostart(pool_get(p), &autostart);
ruby_libvirt_raise_error_if(r < 0, e_RetrieveError,
"virStoragePoolGetAutostart",
ruby_libvirt_connect_get(p));
return autostart ? Qtrue : Qfalse;
}
Call virStoragePoolSetAutostart to make this storage pool start when libvirtd starts.
static VALUE libvirt_storage_pool_autostart_equal(VALUE p, VALUE autostart)
{
if (autostart != Qtrue && autostart != Qfalse) {
rb_raise(rb_eTypeError,
"wrong argument type (expected TrueClass or FalseClass)");
}
ruby_libvirt_generate_call_nil(virStoragePoolSetAutostart,
ruby_libvirt_connect_get(p),
pool_get(p), RTEST(autostart) ? 1 : 0);
}
Call virStoragePoolGetAutostart to determine whether this storage pool will autostart when libvirtd starts.
Call virStoragePoolBuild to build this storage pool.
static VALUE libvirt_storage_pool_build(int argc, VALUE *argv, VALUE p)
{
VALUE flags = RUBY_Qnil;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_nil(virStoragePoolBuild,
ruby_libvirt_connect_get(p),
pool_get(p),
ruby_libvirt_value_to_uint(flags));
}
Call virStoragePoolCreate to start this storage pool.
static VALUE libvirt_storage_pool_create(int argc, VALUE *argv, VALUE p)
{
VALUE flags = RUBY_Qnil;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_nil(virStoragePoolCreate,
ruby_libvirt_connect_get(p),
pool_get(p),
ruby_libvirt_value_to_uint(flags));
}
Call virStorageVolCreateXML to create a new storage volume from xml.
Call virStorageVolCreateXMLFrom to clone a volume from an existing volume with the properties specified in xml.
Call virStorageVolCreateXML to create a new storage volume from xml.
static VALUE libvirt_storage_pool_create_volume_xml(int argc, VALUE *argv,
VALUE p)
{
virStorageVolPtr vol;
VALUE xml, flags = RUBY_Qnil;
rb_scan_args(argc, argv, "11", &xml, &flags);
vol = virStorageVolCreateXML(pool_get(p), StringValueCStr(xml),
ruby_libvirt_value_to_uint(flags));
ruby_libvirt_raise_error_if(vol == NULL, e_Error, "virStorageVolCreateXML",
ruby_libvirt_connect_get(p));
return vol_new(vol, ruby_libvirt_conn_attr(p));
}
Call virStorageVolCreateXMLFrom to clone a volume from an existing volume with the properties specified in xml.
static VALUE libvirt_storage_pool_create_volume_xml_from(int argc, VALUE *argv,
VALUE p)
{
virStorageVolPtr vol;
VALUE xml, flags = RUBY_Qnil, cloneval = RUBY_Qnil;
rb_scan_args(argc, argv, "21", &xml, &cloneval, &flags);
vol = virStorageVolCreateXMLFrom(pool_get(p), StringValueCStr(xml),
vol_get(cloneval),
ruby_libvirt_value_to_uint(flags));
ruby_libvirt_raise_error_if(vol == NULL, e_Error,
"virStorageVolCreateXMLFrom",
ruby_libvirt_connect_get(p));
return vol_new(vol, ruby_libvirt_conn_attr(p));
}
Call virStoragePoolDelete to delete the data corresponding to this data pool. This is a destructive operation.
static VALUE libvirt_storage_pool_delete(int argc, VALUE *argv, VALUE p)
{
VALUE flags = RUBY_Qnil;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_nil(virStoragePoolDelete,
ruby_libvirt_connect_get(p),
pool_get(p),
ruby_libvirt_value_to_uint(flags));
}
Call virStoragePoolDestroy to shutdown this storage pool.
static VALUE libvirt_storage_pool_destroy(VALUE p)
{
ruby_libvirt_generate_call_nil(virStoragePoolDestroy,
ruby_libvirt_connect_get(p),
pool_get(p));
}
Call virStoragePoolFree to free this storage pool object. After this call the storage pool object is no longer valid.
static VALUE libvirt_storage_pool_free(VALUE p)
{
ruby_libvirt_generate_call_free(StoragePool, p);
}
Call virStoragePoolGetInfo to retrieve information about this storage pool.
static VALUE libvirt_storage_pool_info(VALUE p)
{
virStoragePoolInfo info;
int r;
VALUE result;
r = virStoragePoolGetInfo(pool_get(p), &info);
ruby_libvirt_raise_error_if(r < 0, e_RetrieveError,
"virStoragePoolGetInfo",
ruby_libvirt_connect_get(p));
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 virStoragePoolListAllVolumes to get an array of volume objects for all volumes.
static VALUE libvirt_storage_pool_list_all_volumes(int argc, VALUE *argv,
VALUE p)
{
ruby_libvirt_generate_call_list_all(virStorageVolPtr, argc, argv,
virStoragePoolListAllVolumes,
pool_get(p), ruby_libvirt_conn_attr(p),
vol_new, virStorageVolFree);
}
Call virStoragePoolListVolumes to retrieve a list of volume names in this storage pools.
static VALUE libvirt_storage_pool_list_volumes(VALUE p)
{
int r, num;
char **names;
num = virStoragePoolNumOfVolumes(pool_get(p));
ruby_libvirt_raise_error_if(num < 0, e_RetrieveError,
"virStoragePoolNumOfVolumes",
ruby_libvirt_connect_get(p));
if (num == 0) {
return rb_ary_new2(num);
}
names = alloca(sizeof(char *) * num);
r = virStoragePoolListVolumes(pool_get(p), names, num);
ruby_libvirt_raise_error_if(r < 0, e_RetrieveError,
"virStoragePoolListVolumes",
ruby_libvirt_connect_get(p));
return ruby_libvirt_generate_list(r, names);
}
Call virStorageVolLookupByKey to retrieve a storage volume object by key.
static VALUE libvirt_storage_pool_lookup_vol_by_key(VALUE p, VALUE key)
{
virStorageVolPtr vol;
/* FIXME: Why does this take a connection, not a pool? */
vol = virStorageVolLookupByKey(ruby_libvirt_connect_get(p),
StringValueCStr(key));
ruby_libvirt_raise_error_if(vol == NULL, e_RetrieveError,
"virStorageVolLookupByKey",
ruby_libvirt_connect_get(p));
return vol_new(vol, ruby_libvirt_conn_attr(p));
}
Call virStorageVolLookupByName to retrieve a storage volume object by name.
static VALUE libvirt_storage_pool_lookup_vol_by_name(VALUE p, VALUE name)
{
virStorageVolPtr vol;
vol = virStorageVolLookupByName(pool_get(p), StringValueCStr(name));
ruby_libvirt_raise_error_if(vol == NULL, e_RetrieveError,
"virStorageVolLookupByName",
ruby_libvirt_connect_get(p));
return vol_new(vol, ruby_libvirt_conn_attr(p));
}
Call virStorageVolLookupByPath to retrieve a storage volume object by path.
static VALUE libvirt_storage_pool_lookup_vol_by_path(VALUE p, VALUE path)
{
virStorageVolPtr vol;
/* FIXME: Why does this take a connection, not a pool? */
vol = virStorageVolLookupByPath(ruby_libvirt_connect_get(p),
StringValueCStr(path));
ruby_libvirt_raise_error_if(vol == NULL, e_RetrieveError,
"virStorageVolLookupByPath",
ruby_libvirt_connect_get(p));
return vol_new(vol, ruby_libvirt_conn_attr(p));
}
Call virStoragePoolGetName to retrieve the name of this storage pool.
static VALUE libvirt_storage_pool_name(VALUE p)
{
ruby_libvirt_generate_call_string(virStoragePoolGetName,
ruby_libvirt_connect_get(p), 0,
pool_get(p));
}
Call virStoragePoolNumOfVolumes to retrieve the number of volumes in this storage pool.
static VALUE libvirt_storage_pool_num_of_volumes(VALUE p)
{
int n;
n = virStoragePoolNumOfVolumes(pool_get(p));
ruby_libvirt_raise_error_if(n < 0, e_RetrieveError,
"virStoragePoolNumOfVolumes",
ruby_libvirt_connect_get(p));
return INT2NUM(n);
}
Call virStoragePoolIsPersistent to determine if this storage pool is persistent.
static VALUE libvirt_storage_pool_persistent_p(VALUE p)
{
ruby_libvirt_generate_call_truefalse(virStoragePoolIsPersistent,
ruby_libvirt_connect_get(p),
pool_get(p));
}
Call virStoragePoolRefresh to refresh the list of volumes in this storage pool.
static VALUE libvirt_storage_pool_refresh(int argc, VALUE *argv, VALUE p)
{
VALUE flags = RUBY_Qnil;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_nil(virStoragePoolRefresh,
ruby_libvirt_connect_get(p),
pool_get(p),
ruby_libvirt_value_to_uint(flags));
}
Call virStoragePoolUndefine to undefine this storage pool.
static VALUE libvirt_storage_pool_undefine(VALUE p)
{
ruby_libvirt_generate_call_nil(virStoragePoolUndefine,
ruby_libvirt_connect_get(p),
pool_get(p));
}
Call virStoragePoolGetUUIDString to retrieve the UUID of this storage pool.
static VALUE libvirt_storage_pool_uuid(VALUE p)
{
ruby_libvirt_generate_uuid(virStoragePoolGetUUIDString,
ruby_libvirt_connect_get(p), pool_get(p));
}
Call virStoragePoolGetXMLDesc to retrieve the XML for this storage pool.
static VALUE libvirt_storage_pool_xml_desc(int argc, VALUE *argv, VALUE p)
{
VALUE flags = RUBY_Qnil;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_string(virStoragePoolGetXMLDesc,
ruby_libvirt_connect_get(p),
1, pool_get(p),
ruby_libvirt_value_to_uint(flags));
}