class Libvirt::StorageVol

Constants

BLOCK
DELETE_NORMAL

virStorageVolDeleteFlags

DELETE_WITH_SNAPSHOTS
DELETE_ZEROED
DIR
FILE

virStorageVolType

NETDIR
NETWORK
RESIZE_ALLOCATE
RESIZE_DELTA
RESIZE_SHRINK
WIPE_ALG_BSI
WIPE_ALG_DOD
WIPE_ALG_GUTMANN
WIPE_ALG_NNSA
WIPE_ALG_PFITZNER33
WIPE_ALG_PFITZNER7
WIPE_ALG_RANDOM
WIPE_ALG_SCHNEIER
WIPE_ALG_ZERO
XML_INACTIVE

Public Instance Methods

delete(flags=0) → nil click to toggle source

Call virStorageVolDelete to delete this volume. This is a destructive operation.

static VALUE libvirt_storage_vol_delete(int argc, VALUE *argv, VALUE v)
{
    VALUE flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "01", &flags);

    ruby_libvirt_generate_call_nil(virStorageVolDelete,
                                   ruby_libvirt_connect_get(v),
                                   vol_get(v),
                                   ruby_libvirt_value_to_uint(flags));
}
download(stream, offset, length, flags=0) → nil click to toggle source

Call virStorageVolDownload to download the content of a volume as a stream.

static VALUE libvirt_storage_vol_download(int argc, VALUE *argv, VALUE v)
{
    VALUE st = RUBY_Qnil, offset = RUBY_Qnil, length = RUBY_Qnil, flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "31", &st, &offset, &length, &flags);

    ruby_libvirt_generate_call_nil(virStorageVolDownload,
                                   ruby_libvirt_connect_get(v),
                                   vol_get(v), ruby_libvirt_stream_get(st),
                                   NUM2ULL(offset), NUM2ULL(length),
                                   ruby_libvirt_value_to_uint(flags));
}
free → nil click to toggle source

Call virStorageVolFree to free the storage volume object. After this call the storage volume object is no longer valid.

static VALUE libvirt_storage_vol_free(VALUE v)
{
    ruby_libvirt_generate_call_free(StorageVol, v);
}
info → Libvirt::StorageVolInfo click to toggle source

Call virStorageVolGetInfo to retrieve information about this storage volume.

static VALUE libvirt_storage_vol_info(VALUE v)
{
    virStorageVolInfo info;
    int r;
    VALUE result;

    r = virStorageVolGetInfo(vol_get(v), &info);
    ruby_libvirt_raise_error_if(r < 0, e_RetrieveError, "virStorageVolGetInfo",
                                ruby_libvirt_connect_get(v));

    result = rb_class_new_instance(0, NULL, c_storage_vol_info);
    rb_iv_set(result, "@type", INT2NUM(info.type));
    rb_iv_set(result, "@capacity", ULL2NUM(info.capacity));
    rb_iv_set(result, "@allocation", ULL2NUM(info.allocation));

    return result;
}
key → String click to toggle source

Call virStorageVolGetKey to retrieve the key for this storage volume.

static VALUE libvirt_storage_vol_key(VALUE v)
{
    ruby_libvirt_generate_call_string(virStorageVolGetKey,
                                      ruby_libvirt_connect_get(v), 0,
                                      vol_get(v));
}
name → String click to toggle source

Call virStorageVolGetName to retrieve the name of this storage volume.

static VALUE libvirt_storage_vol_name(VALUE v)
{
    ruby_libvirt_generate_call_string(virStorageVolGetName,
                                      ruby_libvirt_connect_get(v), 0,
                                      vol_get(v));
}
path → String click to toggle source

Call virStorageVolGetPath to retrieve the path for this storage volume.

static VALUE libvirt_storage_vol_path(VALUE v)
{
    ruby_libvirt_generate_call_string(virStorageVolGetPath,
                                      ruby_libvirt_connect_get(v), 1,
                                      vol_get(v));
}
pool → Libvirt::StoragePool click to toggle source

Call virStoragePoolLookupByVolume to retrieve the storage pool for this volume.

static VALUE libvirt_storage_vol_pool(VALUE v)
{
    virStoragePoolPtr pool;

    pool = virStoragePoolLookupByVolume(vol_get(v));
    ruby_libvirt_raise_error_if(pool == NULL, e_RetrieveError,
                                "virStoragePoolLookupByVolume",
                                ruby_libvirt_connect_get(v));

    return pool_new(pool, ruby_libvirt_conn_attr(v));
}
resize(capacity, flags=0) → nil click to toggle source

Call virStorageVolResize to resize the associated storage volume.

static VALUE libvirt_storage_vol_resize(int argc, VALUE *argv, VALUE v)
{
    VALUE capacity = RUBY_Qnil, flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "11", &capacity, &flags);

    ruby_libvirt_generate_call_nil(virStorageVolResize,
                                   ruby_libvirt_connect_get(v),
                                   vol_get(v), NUM2ULL(capacity),
                                   ruby_libvirt_value_to_uint(flags));
}
upload(stream, offset, length, flags=0) → nil click to toggle source

Call virStorageVolUpload to upload new content to a volume from a stream.

static VALUE libvirt_storage_vol_upload(int argc, VALUE *argv, VALUE v)
{
    VALUE st = RUBY_Qnil, offset = RUBY_Qnil, length = RUBY_Qnil, flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "31", &st, &offset, &length, &flags);

    ruby_libvirt_generate_call_nil(virStorageVolUpload,
                                   ruby_libvirt_connect_get(v),
                                   vol_get(v), ruby_libvirt_stream_get(st),
                                   NUM2ULL(offset), NUM2ULL(length),
                                   ruby_libvirt_value_to_uint(flags));
}
wipe(flags=0) → nil click to toggle source

Call virStorageVolWipe to wipe the data from this storage volume. This is a destructive operation.

static VALUE libvirt_storage_vol_wipe(int argc, VALUE *argv, VALUE v)
{
    VALUE flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "01", &flags);

    ruby_libvirt_generate_call_nil(virStorageVolWipe,
                                   ruby_libvirt_connect_get(v),
                                   vol_get(v),
                                   ruby_libvirt_value_to_uint(flags));
}
wipe_pattern(alg, flags=0) → nil click to toggle source

Call virStorageVolWipePattern to wipe the data from this storage volume. This is a destructive operation.

static VALUE libvirt_storage_vol_wipe_pattern(int argc, VALUE *argv, VALUE v)
{
    VALUE alg = RUBY_Qnil, flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "11", &alg, &flags);

    ruby_libvirt_generate_call_nil(virStorageVolWipePattern,
                                   ruby_libvirt_connect_get(v),
                                   vol_get(v), NUM2UINT(alg),
                                   ruby_libvirt_value_to_uint(flags));
}
xml_desc(flags=0) → String click to toggle source

Call virStorageVolGetXMLDesc to retrieve the xml for this storage volume.

static VALUE libvirt_storage_vol_xml_desc(int argc, VALUE *argv, VALUE v)
{
    VALUE flags = RUBY_Qnil;

    rb_scan_args(argc, argv, "01", &flags);

    ruby_libvirt_generate_call_string(virStorageVolGetXMLDesc,
                                      ruby_libvirt_connect_get(v),
                                      1, vol_get(v),
                                      ruby_libvirt_value_to_uint(flags));
}