Sys::Virt::DomainSnapshot - Represent & manage a libvirt guest domain


Sys-Virt documentation Contained in the Sys-Virt distribution.

Index


Code Index:

NAME

Top

Sys::Virt::DomainSnapshot - Represent & manage a libvirt guest domain

DESCRIPTION

Top

The Sys::Virt::DomainSnapshot module represents a guest domain managed by the virtual machine monitor.

METHODS

Top

my $xml = $dom->get_xml_description()

Returns an XML document containing a complete description of the domain's configuration

$dom->delete()

Deletes this snapshot object & its datra

$dom->revert_to()

Revert the domain to the state associated with this snapshot

AUTHORS

Top

Daniel P. Berrange <berrange@redhat.com>

COPYRIGHT

Top

LICENSE

Top

This program is free software; you can redistribute it and/or modify it under the terms of either the GNU General Public License as published by the Free Software Foundation (either version 2 of the License, or at your option any later version), or, the Artistic License, as specified in the Perl README file.

SEE ALSO

Top

Sys::Virt, Sys::Virt::Error, http://libvirt.org


Sys-Virt documentation Contained in the Sys-Virt distribution.
# -*- perl -*-
#
# Copyright (C) 2006 Red Hat
# Copyright (C) 2006-2007 Daniel P. Berrange
#
# This program is free software; You can redistribute it and/or modify
# it under either:
#
# a) the GNU General Public License as published by the Free
#   Software Foundation; either version 2, or (at your option) any
#   later version,
#
# or
#
# b) the "Artistic License"
#
# The file "LICENSE" distributed along with this file provides full
# details of the terms and conditions of the two licenses.

package Sys::Virt::DomainSnapshot;

use strict;
use warnings;


sub _new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my %params = @_;

    my $dom = exists $params{domain} ? $params{domain} : die "domain parameter is required";
    my $self;
    if (exists $params{name}) {
	$self = Sys::Virt::DomainSnapshot::_lookup_by_name($dom,  $params{name});
    } elsif (exists $params{xml}) {
	$self = Sys::Virt::DomainSnapshot::_create_xml($dom,  $params{xml});
    } else {
	die "name or xml parameters are required";
    }

    bless $self, $class;

    return $self;
}

1;