Debian Codegraph @

lib/Sys/Virt/DomainCheckpoint.pm

raw
1 # -*- perl -*-
2 #
3 # Copyright (C) 2006 Red Hat
4 # Copyright (C) 2006-2007 Daniel P. Berrange
5 #
6 # This program is free software; You can redistribute it and/or modify
7 # it under either:
8 #
9 # a) the GNU General Public License as published by the Free
10 # Software Foundation; either version 2, or (at your option) any
11 # later version,
12 #
13 # or
14 #
15 # b) the "Artistic License"
16 #
17 # The file "LICENSE" distributed along with this file provides full
18 # details of the terms and conditions of the two licenses.
19
20 =pod
21
22 =head1 NAME
23
24 Sys::Virt::DomainCheckpoint - Represent & manage a libvirt guest domain checkpoint
25
26 =head1 DESCRIPTION
27
28 The C<Sys::Virt::DomainCheckpoint> module represents a guest domain
29 checkpoint managed by the virtual machine monitor.
30
31 =head1 METHODS
32
33 =over 4
34
35 =cut
36
37 package Sys::Virt::DomainCheckpoint;
38
39 use strict;
40 use warnings;
41
42
43 sub _new {
44 my $proto = shift;
45 my $class = ref($proto) || $proto;
46 my %params = @_;
47
48 my $dom = exists $params{domain} ? $params{domain} : die "domain parameter is required";
49 my $self;
50 if (exists $params{name}) {
51 $self = Sys::Virt::DomainCheckpoint::_lookup_by_name($dom, $params{name});
52 } elsif (exists $params{xml}) {
53 $self = Sys::Virt::DomainCheckpoint::_create_xml($dom, $params{xml}, $params{flags} ? $params{flags} : 0);
54 } else {
55 die "name or xml parameters are required";
56 }
57
58 bless $self, $class;
59
60 return $self;
61 }
62
63 =item my $str = $domchkp->get_name()
64
65 Return the name of the checkpoint
66
67 =item my $xml = $domchkp->get_xml_description($flags)
68
69 Returns an XML document containing a complete description of
70 the domain checkpoints' configuration. The C<$flags> parameter
71 accepts the following constants
72
73 =over 4
74
75 =item Sys::Virt::DomainCheckpoint::XML_SECURE
76
77 Include security sensitive information in the XML dump, such as
78 passwords.
79
80 =item Sys::Virt::DomainCheckpoint::XML_SIZE
81
82 Include dynamic per-<disk> size information
83
84 =item Sys::Virt::DomainCheckpoint::XML_NO_DOMAIN
85
86 Suppress <domain> sub-element
87
88 =back
89
90 =item $domchkp->delete($flags)
91
92 Deletes this checkpoint object & its data. The optional C<$flags> parameter controls
93 what should be deleted via the C<Sys::Virt::DomainCheckpoint::DELETE_*>
94 constants.
95
96 =item $parentchkp = $domchkp->get_parent();
97
98 Return the parent of the checkpoint, if any
99
100 =item my @checkpoints = $domchkp->list_all_children($flags)
101
102 Return a list of all domain checkpoints that are children of this
103 checkpoint. The elements in the returned list are instances of the
104 L<Sys::Virt::DomainCheckpoint> class. The C<$flags> parameter can be
105 used to filter the list of return domain checkpoints.
106
107 =back
108
109 =head1 CONSTANTS
110
111 =head2 CHECKPOINT CREATION
112
113 The following constants are useful when creating checkpoints
114
115 =over 4
116
117 =item Sys::Virt::DomainCheckpoint::CREATE_REDEFINE
118
119 Replace/set the metadata with the checkpoint
120
121 =item Sys::Virt::DomainCheckpoint::CREATE_QUIESCE
122
123 Quiesce the guest disks while taking the checkpoint
124
125 =item Sys::Virt::DomainCheckpoint::CREATE_REDEFINE_VALIDATE
126
127 Validate disk data state
128
129 =back
130
131 =head2 CHECKPOINT DELETION
132
133 The following constants are useful when deleting checkpoints
134
135 =over 4
136
137 =item Sys::Virt::DomainCheckpoint::DELETE_CHILDREN
138
139 Recursively delete any child checkpoints
140
141 =item Sys::Virt::DomainCheckpoint::DELETE_CHILDREN_ONLY
142
143 Only delete the child checkpoints
144
145 =item Sys::Virt::DomainCheckpoint::DELETE_METADATA_ONLY
146
147 Only delete the checkpoint metadata
148
149 =back
150
151 =head2 CHECKPOINT LIST
152
153 The following constants are useful when listing checkpoints
154
155 =over 4
156
157 =item Sys::Virt::DomainCheckpoint::LIST_ROOTS
158
159 Only list checkpoints which are root nodes in the tree
160
161 =item Sys::Virt::DomainCheckpoint::LIST_DESCENDANTS
162
163 Only list checkpoints which are descendants of the current
164 checkpoint
165
166 =item Sys::Virt::DomainCheckpoint::LIST_LEAVES
167
168 Only list leaf nodes in the checkpoint tree
169
170 =item Sys::Virt::DomainCheckpoint::LIST_NO_LEAVES
171
172 Only list non-leaf nodes in the checkpoint tree
173
174 =item Sys::Virt::DomainCheckpoint::LIST_TOPOLOGICAL
175
176 Sort list in topological order w.r.t. to parent/child
177 relationships.
178
179 =back
180
181 =over 4
182
183 =cut
184
185 1;
186
187 =back
188
189 =head1 AUTHORS
190
191 Daniel P. Berrange <[email protected]>
192
193 =head1 COPYRIGHT
194
195 Copyright (C) 2006 Red Hat
196 Copyright (C) 2006-2007 Daniel P. Berrange
197
198 =head1 LICENSE
199
200 This program is free software; you can redistribute it and/or modify
201 it under the terms of either the GNU General Public License as published
202 by the Free Software Foundation (either version 2 of the License, or at
203 your option any later version), or, the Artistic License, as specified
204 in the Perl README file.
205
206 =head1 SEE ALSO
207
208 L<Sys::Virt>, L<Sys::Virt::Error>, C<http://libvirt.org>
209
210 =cut