1Sys::Virt::Domain(3) User Contributed Perl Documentation Sys::Virt::Domain(3)
2
3
4
6 Sys::Virt::Domain - Represent & manage a libvirt guest domain
7
9 The "Sys::Virt::Domain" module represents a guest domain managed by the
10 virtual machine monitor.
11
13 my $id = $dom->get_id()
14 Returns an integer with a locally unique identifier for the domain.
15
16 my $uuid = $dom->get_uuid()
17 Returns a 16 byte long string containing the raw globally unique
18 identifier (UUID) for the domain.
19
20 my $uuid = $dom->get_uuid_string()
21 Returns a printable string representation of the raw UUID, in the
22 format 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'.
23
24 my $name = $dom->get_name()
25 Returns a string with a locally unique name of the domain
26
27 my $xml = $dom->get_xml_description()
28 Returns an XML document containing a complete description of the
29 domain's configuration
30
31 my $type = $dom->get_os_type()
32 Returns a string containing the name of the OS type running within
33 the domain.
34
35 $dom->create()
36 Start a domain whose configuration was previously defined using the
37 "define_domain" method in Sys::Virt.
38
39 $dom->undefine()
40 Remove the configuration associated with a domain previously
41 defined with the "define_domain" method in Sys::Virt. If the domain
42 is running, you probably want to use the "shutdown" or "destroy"
43 methods instead.
44
45 $dom->suspend()
46 Temporarily stop execution of the domain, allowing later continua‐
47 tion by calling the "resume" method.
48
49 $dom->resume()
50 Resume execution of a domain previously halted with the "suspend"
51 method.
52
53 $dom->save($filename)
54 Take a snapshot of the domain's state and save the information to
55 the file named in the $filename parameter. The domain can later be
56 restored from this file with the "restore_domain" method on the
57 Sys::Virt object.
58
59 $dom->destroy()
60 Immediately terminate the machine, and remove it from the virtual
61 machine monitor. The $dom handle is invalid after this call com‐
62 pletes and should not be used again.
63
64 my $info = $dom->get_info()
65 Returns a hash reference summarising the execution state of the
66 domain. The elements of the hash are as follows:
67
68 maxMem
69 The maximum memory allowed for this domain, in kilobytes
70
71 memory
72 The current memory allocated to the domain in kilobytes
73
74 cpuTime
75 The amount of CPU time used by the domain
76
77 nrVirtCpu
78 The current number of virtual CPUs enabled in the domain
79
80 state
81 The execution state of the machine, which will be one of the
82 constants &Sys::Virt::Domain::STATE_*.
83
84 $dom->set_max_memory($mem)
85 Set the maximum memory for the domain to the value $mem. The value
86 of the $mem parameter is specified in kilobytes.
87
88 $mem = $dom->get_max_memory()
89 Returns the current maximum memory allowed for this domain in kilo‐
90 bytes.
91
92 $dom->set_memory($mem)
93 Set the current memory for the domain to the value $mem. The value
94 of the $mem parameter is specified in kilobytes. This must be less
95 than, or equal to the domain's max memory limit.
96
97 $dom->shutdown()
98 Request that the guest OS perform a graceful shutdown and poweroff.
99
100 $dom->reboot($flags)
101 Request that the guest OS perform a graceful shutdown and option‐
102 ally restart. The $flags parameter determines how the domain
103 restarts (if at all). It should be one of the constants
104 &Sys::Virt::Domain::REBOOT_* listed later in this document.
105
107 The first set of constants enumerate the possible machine runtime
108 states, returned by the "get_info" method.
109
110 &Sys::Virt::Domain::STATE_NOSTATE
111 The domain is active, but is not running / blocked (eg idle)
112
113 &Sys::Virt::Domain::STATE_RUNNING
114 The domain is active and running
115
116 &Sys::Virt::Domain::STATE_BLOCKED
117 The domain is active, but execution is blocked
118
119 &Sys::Virt::Domain::STATE_PAUSED
120 The domain is active, but execution has been paused
121
122 &Sys::Virt::Domain::STATE_SHUTDOWN
123 The domain is active, but in the shutdown phase
124
125 &Sys::Virt::Domain::STATE_SHUTOFF
126 The domain is inactive, and shut down.
127
128 &Sys::Virt::Domain::STATE_CRASHED
129 The domain is inactive, and crashed.
130
131 The next set of constants enumerate the different flags which can be
132 passed when requesting a reboot.
133
134 &Sys::Virt::Domain::REBOOT_DESTROY
135 Destroy the domain, rather than restarting the domain
136
137 &Sys::Virt::Domain::REBOOT_RESTART
138 Restart the domain after shutdown is complete
139
140 &Sys::Virt::Domain::REBOOT_PRESERVE
141 Leave the domain inactive after shutdown is complete
142
143 &Sys::Virt::Domain::REBOOT_RENAME_RESTART
144 Restart the domain under a different (automatically generated) name
145 after shutdown is complete
146
148 Daniel P. Berrange <berrange@redhat.com>
149
151 Copyright (C) 2006 Red Hat
152
153 Sys::Virt is distributed under the terms of the GPLv2 or later
154
156 Sys::Virt, Sys::Virt::Error, "http://libvirt.org"
157
158
159
160perl v5.8.8 2007-04-17 Sys::Virt::Domain(3)