class Libvirt::StorageVol

Class Libvirt::StorageVol and Libvirt::StorageVolInfo

Constants

BLOCK
DELETE_NORMAL

virStoragePoolDeleteFlags

DELETE_ZEROED
FILE

virStorageVolType

Public Instance Methods

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

Call virStorageVolDelete[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolDelete] to delete this volume. This is a destructive operation.

static VALUE libvirt_vol_delete(int argc, VALUE *argv, VALUE v) {
    VALUE flags;

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

    if (NIL_P(flags))
        flags = INT2NUM(0);

    gen_call_void(virStorageVolDelete, conn(v), vol_get(v), NUM2UINT(flags));
}
download(stream, offset, length, flags=0) → nil click to toggle source

Call virStorageVolDownload[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolDownload] to download the content of a volume as a stream.

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

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

    if (NIL_P(flags))
        flags = INT2NUM(0);

    gen_call_void(virStorageVolDownload, conn(v), vol_get(v), stream_get(st),
                  NUM2ULL(offset), NUM2ULL(length), NUM2UINT(flags));
}
free → nil click to toggle source

Call virStorageVolFree[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolFree] to free the storage volume object. After this call the storage volume object is no longer valid.

static VALUE libvirt_vol_free(VALUE s) {
    gen_call_free(StorageVol, s);
}
info → Libvirt::StorageVolInfo click to toggle source

Call virStorageVolGetInfo[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetInfo] to retrieve information about this storage volume.

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

    r = virStorageVolGetInfo(vol_get(v), &info);
    _E(r < 0, create_error(e_RetrieveError, "virStorageVolGetInfo", conn(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[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetKey] to retrieve the key for this storage volume.

static VALUE libvirt_vol_key(VALUE v) {
    gen_call_string(virStorageVolGetKey, conn(v), 0, vol_get(v));
}
name → string click to toggle source

Call virStorageVolGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetName] to retrieve the name of this storage volume.

static VALUE libvirt_vol_name(VALUE v) {
    gen_call_string(virStorageVolGetName, conn(v), 0, vol_get(v));
}
path → string click to toggle source

Call virStorageVolGetPath[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetPath] to retrieve the path for this storage volume.

static VALUE libvirt_vol_path(VALUE v) {
    gen_call_string(virStorageVolGetPath, conn(v), 1, vol_get(v));
}
pool → Libvirt::StoragePool click to toggle source

Call virStoragePoolLookupByVolume[http://www.libvirt.org/html/libvirt-libvirt.html#virStoragePoolLookupByVolume] to retrieve the storage pool for this volume.

static VALUE libvirt_vol_get_pool(VALUE v) {
    virStoragePoolPtr pool;

    pool = virStoragePoolLookupByVolume(vol_get(v));
    _E(pool == NULL, create_error(e_RetrieveError,
                                  "virStoragePoolLookupByVolume", conn(v)));

    return pool_new(pool, conn_attr(v));
}
upload(stream, offset, length, flags=0) → nil click to toggle source

Call virStorageVolUpload[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolUpload] to upload new content to a volume from a stream.

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

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

    if (NIL_P(flags))
        flags = INT2NUM(0);

    gen_call_void(virStorageVolUpload, conn(v), vol_get(v), stream_get(st),
                  NUM2ULL(offset), NUM2ULL(length), NUM2UINT(flags));
}
wipe(flags=0) → nil click to toggle source

Call virStorageVolWipe[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolWipe] to wipe the data from this storage volume. This is a destructive operation.

static VALUE libvirt_vol_wipe(int argc, VALUE *argv, VALUE v) {
    VALUE flags;

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

    if (NIL_P(flags))
        flags = INT2NUM(0);

    gen_call_void(virStorageVolWipe, conn(v), vol_get(v), NUM2UINT(flags));
}
xml_desc(flags=0) → string click to toggle source

Call virStorageVolGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virStorageVolGetXMLDesc] to retrieve the xml for this storage volume.

static VALUE libvirt_vol_xml_desc(int argc, VALUE *argv, VALUE v) {
    VALUE flags;

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

    if (NIL_P(flags))
        flags = INT2NUM(0);

    gen_call_string(virStorageVolGetXMLDesc, conn(v), 1, vol_get(v),
                    NUM2UINT(flags));
}