class Libvirt::Domain::Snapshot
Constants
- CREATE_ATOMIC
- CREATE_CURRENT
- CREATE_DISK_ONLY
- CREATE_HALT
- CREATE_LIVE
- CREATE_NO_METADATA
- CREATE_QUIESCE
- CREATE_REDEFINE
- CREATE_REUSE_EXT
- DELETE_CHILDREN
- DELETE_CHILDREN_ONLY
- DELETE_METADATA_ONLY
- LIST_ACTIVE
- LIST_DESCENDANTS
- LIST_DISK_ONLY
- LIST_EXTERNAL
- LIST_INACTIVE
- LIST_INTERNAL
- LIST_LEAVES
- LIST_METADATA
- LIST_NO_LEAVES
- LIST_NO_METADATA
- LIST_ROOTS
- REVERT_FORCE
- REVERT_PAUSED
- REVERT_RUNNING
Public Instance Methods
Call virDomainSnapshotIsCurrent to determine if the snapshot is the domain's current snapshot.
static VALUE libvirt_domain_snapshot_current_p(int argc, VALUE *argv, VALUE s)
{
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_truefalse(virDomainSnapshotIsCurrent,
ruby_libvirt_connect_get(s),
domain_snapshot_get(s),
ruby_libvirt_value_to_uint(flags));
}
Call virDomainSnapshotDelete to delete this snapshot.
static VALUE libvirt_domain_snapshot_delete(int argc, VALUE *argv, VALUE s)
{
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_nil(virDomainSnapshotDelete,
ruby_libvirt_connect_get(s),
domain_snapshot_get(s),
ruby_libvirt_value_to_uint(flags));
}
Call virDomainSnapshotFree to free up the snapshot object. After this call the snapshot object is no longer valid.
static VALUE libvirt_domain_snapshot_free(VALUE s)
{
ruby_libvirt_generate_call_free(DomainSnapshot, s);
}
Call virDomainSnapshotHasMetadata to determine if the snapshot is associated with libvirt metadata.
static VALUE libvirt_domain_snapshot_has_metadata_p(int argc, VALUE *argv,
VALUE s)
{
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_truefalse(virDomainSnapshotHasMetadata,
ruby_libvirt_connect_get(s),
domain_snapshot_get(s),
ruby_libvirt_value_to_uint(flags));
}
Call virDomainSnapshotListAllChildren to get an array of snapshot objects that are children of this snapshot.
static VALUE libvirt_domain_snapshot_list_all_children(int argc, VALUE *argv,
VALUE s)
{
ruby_libvirt_generate_call_list_all(virDomainSnapshotPtr, argc, argv,
virDomainSnapshotListAllChildren,
domain_snapshot_get(s), s,
domain_snapshot_new,
virDomainSnapshotFree);
}
Call virDomainSnapshotListChildrenNames to get an array of strings representing the children of this snapshot.
static VALUE libvirt_domain_snapshot_list_children_names(int argc, VALUE *argv,
VALUE s)
{
VALUE flags, result;
char **children;
int num_children, ret, i, j, exception = 0;
struct ruby_libvirt_str_new2_and_ary_store_arg arg;
rb_scan_args(argc, argv, "01", &flags);
num_children = virDomainSnapshotNumChildren(domain_snapshot_get(s),
ruby_libvirt_value_to_uint(flags));
ruby_libvirt_raise_error_if(num_children < 0, e_RetrieveError,
"virDomainSnapshotNumChildren",
ruby_libvirt_connect_get(s));
result = rb_ary_new2(num_children);
if (num_children == 0) {
return result;
}
children = alloca(num_children * sizeof(char *));
ret = virDomainSnapshotListChildrenNames(domain_snapshot_get(s), children,
num_children,
ruby_libvirt_value_to_uint(flags));
ruby_libvirt_raise_error_if(ret < 0, e_RetrieveError,
"virDomainSnapshotListChildrenNames",
ruby_libvirt_connect_get(s));
for (i = 0; i < ret; i++) {
arg.arr = result;
arg.index = i;
arg.value = children[i];
rb_protect(ruby_libvirt_str_new2_and_ary_store_wrap, (VALUE)&arg,
&exception);
if (exception) {
goto error;
}
free(children[i]);
}
return result;
error:
for (j = i; j < ret; j++) {
free(children[j]);
}
rb_jump_tag(exception);
/* not necessary, just to shut the compiler up */
return Qnil;
}
Call virDomainSnapshotGetName to get the name associated with a snapshot.
static VALUE libvirt_domain_snapshot_name(VALUE s)
{
ruby_libvirt_generate_call_string(virDomainSnapshotGetName,
ruby_libvirt_connect_get(s),
0, domain_snapshot_get(s));
}
Call virDomainSnapshotNumChildren to get the number of children snapshots of this snapshot.
static VALUE libvirt_domain_snapshot_num_children(int argc, VALUE *argv,
VALUE s)
{
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_int(virDomainSnapshotNumChildren,
ruby_libvirt_connect_get(s),
domain_snapshot_get(s),
ruby_libvirt_value_to_uint(flags));
}
Call virDomainSnapshotGetParent to get the parent of this snapshot (nil will be returned if this is a root snapshot).
static VALUE libvirt_domain_snapshot_parent(int argc, VALUE *argv, VALUE s)
{
virDomainSnapshotPtr snap;
VALUE flags;
virErrorPtr err;
rb_scan_args(argc, argv, "01", &flags);
snap = virDomainSnapshotGetParent(domain_snapshot_get(s),
ruby_libvirt_value_to_uint(flags));
if (snap == NULL) {
/* snap may be NULL if there is a root, in which case we want to return
* nil
*/
err = virConnGetLastError(ruby_libvirt_connect_get(s));
if (err->code == VIR_ERR_NO_DOMAIN_SNAPSHOT) {
return Qnil;
}
ruby_libvirt_raise_error_if(snap == NULL, e_RetrieveError,
"virDomainSnapshotGetParent",
ruby_libvirt_connect_get(s));
}
return domain_snapshot_new(snap, s);
}
Call virDomainSnapshotGetXMLDesc to retrieve the xml description for this snapshot.
static VALUE libvirt_domain_snapshot_xml_desc(int argc, VALUE *argv, VALUE s)
{
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
ruby_libvirt_generate_call_string(virDomainSnapshotGetXMLDesc,
ruby_libvirt_connect_get(s), 1,
domain_snapshot_get(s),
ruby_libvirt_value_to_uint(flags));
}