1Sys::Virt::StoragePool(U3s)er Contributed Perl DocumentatSiyosn::Virt::StoragePool(3)
2
3
4
6 Sys::Virt::StoragePool - Represent & manage a libvirt storage pool
7
9 The "Sys::Virt::StoragePool" module represents a storage pool managed
10 by libvirt. There are a variety of storage pool implementations for
11 LVM, Local directories/filesystems, network filesystems, disk
12 partitioning, iSCSI, and SCSI.
13
15 my $uuid = $pool->get_uuid()
16 Returns a 16 byte long string containing the raw globally unique
17 identifier (UUID) for the storage pool.
18
19 my $uuid = $pool->get_uuid_string()
20 Returns a printable string representation of the raw UUID, in the
21 format 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'.
22
23 my $name = $pool->get_name()
24 Returns a string with a locally unique name of the storage pool
25
26 $pool->is_active()
27 Returns a true value if the storage pool is currently running
28
29 $pool->is_persistent()
30 Returns a true value if the storage pool has a persistent
31 configuration file defined
32
33 my $xml = $pool->get_xml_description()
34 Returns an XML document containing a complete description of the
35 storage pool's configuration
36
37 $pool->create()
38 Start a storage pool whose configuration was previously defined
39 using the "define_storage_pool" method in Sys::Virt.
40
41 $pool->undefine()
42 Remove the configuration associated with a storage pool previously
43 defined with the "define_storage pool" method in Sys::Virt. If the
44 storage pool is running, you probably want to use the "shutdown" or
45 "destroy" methods instead.
46
47 $pool->destroy()
48 Immediately terminate the machine, and remove it from the virtual
49 machine monitor. The $pool handle is invalid after this call
50 completes and should not be used again.
51
52 $flag = $pool->get_autostart();
53 Return a true value if the storage pool is configured to
54 automatically start upon boot. Return false, otherwise
55
56 $pool->set_autostart($flag)
57 Set the state of the autostart flag, which determines whether the
58 storage pool will automatically start upon boot of the host OS
59
60 $pool->refresh([$flags]);
61 Refresh the storage pool state. Typically this will rescan the list
62 of storage volumes. The $flags parameter is currently unused and if
63 omitted defaults to zero.
64
65 $pool->build([$flags]);
66 Construct the storage pool if it does not exist. As an example, for
67 a disk based storage pool this would ensure a partition table
68 exists. The $flags parameter allows control over the build
69 operation and if omitted defaults to zero.
70
71 $pool->delete([$flags]);
72 Delete the storage pool. The $flags parameter allows the data to be
73 optionally wiped during delete and if omitted defaults to zero.
74
75 %info = $pool->get_info()
76 Retrieve information about the current storage pool state. The
77 returned hash has the following keys
78
79 state
80 The current status of the storage pool. See constants later.
81
82 capacity
83 The total logical size of the storage pool
84
85 allocation
86 The current physical allocation of the storage pool
87
88 available
89 The available space for creation of new volumes. This may be
90 less than the difference between capacity & allocation if there
91 are sizing / metadata constraints for volumes
92
93 my $nnames = $pool->num_of_storage_volumes()
94 Return the number of running volumes in this storage pool. The
95 value can be used as the "maxnames" parameter to
96 "list_storage_vol_names".
97
98 my @volNames = $pool->list_storage_vol_names($maxnames)
99 Return a list of all volume names in this storage pool. The names
100 can be used with the "get_volume_by_name" method.
101
102 my @nets = $pool->list_volumes()
103 Return a list of all volumes in the storage pool. The elements in
104 the returned list are instances of the Sys::Virt::StorageVol class.
105
106 my $vol = $pool->get_volume_by_name($name)
107 Return the volume with a name of $name. The returned object is an
108 instance of the Sys::Virt::StorageVol class.
109
110 my $vol = $pool->create_volume($xml)
111 Create a new volume based on the XML description passed into the
112 $xml parameter. The returned object is an instance of the
113 Sys::Virt::StorageVol class. If the optional "clonevol" is
114 provided, data will be copied from that source volume
115
116 my $vol = $pool->clone_volume($xml, $clonevol);
117 Create a new volume based on the XML description passed into the
118 $xml parameter. The returned object is an instance of the
119 Sys::Virt::StorageVol class. The new volume will be populated with
120 data from the specified clone source volume.
121
123 The following sets of constants may be useful in dealing with some of
124 the methods in this package
125
126 POOL STATES
127 The following constants are useful for interpreting the "state" key
128 value in the hash returned by "get_info"
129
130 Sys::Virt::StoragePool::STATE_INACTIVE
131 The storage pool is not currently active
132
133 Sys::Virt::StoragePool::STATE_BUILDING
134 The storage pool is still being constructed and is not ready for
135 use yet.
136
137 Sys::Virt::StoragePool::STATE_RUNNING
138 The storage pool is running and can be queried for volumes
139
140 Sys::Virt::StoragePool::STATE_DEGRADED
141 The storage pool is running, but its operation is degraded due to a
142 failure.
143
144 DELETION MODES
145 Sys::Virt::StoragePool::DELETE_NORMAL
146 Delete the pool without any attempt to scrub data
147
148 Sys::Virt::StoragePool::DELETE_ZEROED
149 Fill the allocated storage with zeros when deleting
150
151 BUILD MODES
152 Sys::Virt::StoragePool::BUILD_NEW
153 Construct a new storage pool from constituent bits
154
155 Sys::Virt::StoragePool::BUILD_RESIZE
156 Resize an existing built storage pool preserving data where
157 appropriate
158
159 Sys::Virt::StoragePool::BUILD_REPAIR
160 Repair an existing storage pool operating in degraded mode
161
163 Daniel P. Berrange <berrange@redhat.com>
164
166 Copyright (C) 2006-2009 Red Hat Copyright (C) 2006-2009 Daniel P.
167 Berrange
168
170 This program is free software; you can redistribute it and/or modify it
171 under the terms of either the GNU General Public License as published
172 by the Free Software Foundation (either version 2 of the License, or at
173 your option any later version), or, the Artistic License, as specified
174 in the Perl README file.
175
177 Sys::Virt, Sys::Virt::Error, "http://libvirt.org"
178
179
180
181perl v5.12.3 2010-05-19 Sys::Virt::StoragePool(3)