File: formatstorage.html

package info (click to toggle)
libvirt 0.4.6-10%2Blenny2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 29,084 kB
  • ctags: 8,508
  • sloc: ansic: 75,483; xml: 11,901; sh: 10,518; python: 4,309; makefile: 863; perl: 356; awk: 48; sed: 16
file content (422 lines) | stat: -rw-r--r-- 21,249 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
        This file is autogenerated from formatstorage.html.in
        Do not edit this file. Changes will be lost.
      -->
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <link rel="stylesheet" type="text/css" href="main.css" />
    <link rel="SHORTCUT ICON" href="32favicon.png" />
    <title>libvirt: Storage pool and volume XML format</title>
    <meta name="description" content="libvirt, virtualization, virtualization API" />
  </head>
  <body>
    <div id="header">
      <div id="headerLogo"></div>
      <div id="headerSearch">
        <form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><div>
            <input id="query" name="query" type="text" size="12" value="" />
            <input id="submit" name="submit" type="submit" value="Search" />
          </div></form>
      </div>
    </div>
    <div id="body">
      <div id="menu">
        <ul class="l0"><li>
            <div>
              <a title="Front page of the libvirt website" class="inactive" href="index.html">Home</a>
            </div>
          </li><li>
            <div>
              <a title="Details of new features and bugs fixed in each release" class="inactive" href="news.html">News</a>
            </div>
          </li><li>
            <div>
              <a title="Get the latest source releases, binary builds and get access to the source repository" class="inactive" href="downloads.html">Downloads</a>
            </div>
          </li><li>
            <div>
              <a title="Information for users, administrators and developers" class="active" href="docs.html">Documentation</a>
              <ul class="l1"><li>
                  <div>
                    <a title="Information about deploying and using libvirt" class="inactive" href="deployment.html">Deployment</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Overview of the logical subsystems in the libvirt API" class="inactive" href="intro.html">Architecture</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Description of the XML formats used in libvirt" class="active" href="format.html">XML format</a>
                    <ul class="l2"><li>
                        <div>
                          <a title="The domain XML format" class="inactive" href="formatdomain.html">Domains</a>
                        </div>
                      </li><li>
                        <div>
                          <a title="The virtual network XML format" class="inactive" href="formatnetwork.html">Networks</a>
                        </div>
                      </li><li>
                        <div>
                          <span class="active">Storage</span>
                        </div>
                      </li><li>
                        <div>
                          <a title="The driver capabilities XML format" class="inactive" href="formatcaps.html">Capabilities</a>
                        </div>
                      </li><li>
                        <div>
                          <a title="The host device XML format" class="inactive" href="formatnode.html">Node Devices</a>
                        </div>
                      </li></ul>
                  </div>
                </li><li>
                  <div>
                    <a title="Hypervisor specific driver information" class="inactive" href="drivers.html">Drivers</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Reference manual for the C public API" class="inactive" href="html/index.html">API reference</a>
                  </div>
                </li><li>
                  <div>
                    <a title="Bindings of the libvirt API for other languages" class="inactive" href="bindings.html">Language bindings</a>
                  </div>
                </li></ul>
            </div>
          </li><li>
            <div>
              <a title="User contributed content" class="inactive" href="http://wiki.libvirt.org">Wiki</a>
            </div>
          </li><li>
            <div>
              <a title="Frequently asked questions" class="inactive" href="FAQ.html">FAQ</a>
            </div>
          </li><li>
            <div>
              <a title="How and where to report bugs and request features" class="inactive" href="bugs.html">Bug reports</a>
            </div>
          </li><li>
            <div>
              <a title="How to contact the developers via email and IRC" class="inactive" href="contact.html">Contact</a>
            </div>
          </li><li>
            <div>
              <a title="Miscellaneous links of interest related to libvirt" class="inactive" href="relatedlinks.html">Related Links</a>
            </div>
          </li><li>
            <div>
              <a title="Overview of all content on the website" class="inactive" href="sitemap.html">Sitemap</a>
            </div>
          </li></ul>
      </div>
      <div id="content">
        <h1>Storage pool and volume XML format</h1>
        <ul><li>
            <a href="#StoragePool">Storage pool XML</a>
            <ul><li>
                <a href="#StoragePoolFirst">General metadata</a>
              </li><li>
                <a href="#StoragePoolSource">Source elements</a>
              </li><li>
                <a href="#StoragePoolTarget">Target elements</a>
              </li><li>
                <a href="#StoragePoolExtents">Device extents</a>
              </li></ul>
          </li><li>
            <a href="#StorageVol">Storage volume XML</a>
            <ul><li>
                <a href="#StorageVolFirst">General metadata</a>
              </li><li>
                <a href="#StorageVolTarget">Target elements</a>
              </li></ul>
          </li><li>
            <a href="#examples">Example configuration</a>
            <ul><li>
                <a href="#exampleFile">File based storage pool</a>
              </li><li>
                <a href="#exampleISCSI">iSCSI based storage pool</a>
              </li><li>
                <a href="#exampleVol">Storage volume</a>
              </li></ul>
          </li></ul>
        <h2>
          <a name="StoragePool" id="StoragePool">Storage pool XML</a>
        </h2>
        <p>
      Although all storage pool backends share the same public APIs and
      XML format, they have varying levels of capabilities. Some may
      allow creation of volumes, others may only allow use of pre-existing
      volumes. Some may have constraints on volume size, or placement.
    </p>
        <p>
      The is the top level tag for a storage pool document is 'pool'. It has
      a single attribute <code>type</code>, which is one of <code>dir</code>,
      <code>fs</code>,<code>netfs</code>,<code>disk</code>,<code>iscsi</code>,
      <code>logical</code>. This corresponds to the storage backend drivers
      listed further along in this document.
      The storage pool XML format is available <span class="since">since 0.4.1</span>
    </p>
        <h3>
          <a name="StoragePoolFirst" id="StoragePoolFirst">General metadata</a>
        </h3>
        <pre>
      &lt;pool type="iscsi"&gt;
        &lt;name&gt;virtimages&lt;/name&gt;
        &lt;uuid&gt;3e3fce45-4f53-4fa7-bb32-11f34168b82b&lt;/uuid&gt;
        &lt;allocation&gt;10000000&lt;/allocation&gt;
        &lt;capacity&gt;50000000&lt;/capacity&gt;
        &lt;available&gt;40000000&lt;/available&gt;
        ...</pre>
        <dl><dt><code>name</code></dt><dd>Providing a name for the pool which is unique to the host.
	This is mandatory when defining a pool. <span class="since">Since 0.4.1</span></dd><dt><code>uuid</code></dt><dd>Providing an identifier for the pool which is globally unique.
	This is optional when defining a pool, a UUID will be generated if
	omitted. <span class="since">Since 0.4.1</span></dd><dt><code>allocation</code></dt><dd>Providing the total storage allocation for the pool. This may
	be larger than the sum of the allocation of all volumes due to
	metadata overhead. This value is in bytes. This is not applicable
	when creating a pool. <span class="since">Since 0.4.1</span></dd><dt><code>capacity</code></dt><dd>Providing the total storage capacity for the pool. Due to
	underlying device constraints it may not be possible to use the
	full capacity for storage volumes. This value is in bytes. This
	is not applicable when creating a pool. <span class="since">Since 0.4.1</span></dd><dt><code>available</code></dt><dd>Providing the free space available for allocating new volumes
	in the pool. Due to underlying device constraints it may not be
	possible to allocate the entire free space to a single volume.
	This value is in bytes. This is not applicable when creating a
	pool. <span class="since">Since 0.4.1</span></dd></dl>
        <h3>
          <a name="StoragePoolSource" id="StoragePoolSource">Source elements</a>
        </h3>
        <p>
      A single <code>source</code> element is contained within the top level
      <code>pool</code> element. This tag is used to describe the source of
      the storage pool. It can contain the following child elements:
    </p>
        <pre>
        ...
        &lt;source&gt;
          &lt;host name="iscsi.example.com"/&gt;
          &lt;device path="demo-target"/&gt;
        &lt;/source&gt;
	...</pre>
        <dl><dt><code>device</code></dt><dd>Provides the source for pools backed by physical devices.
	May be repeated multiple times depending on backend driver. Contains
	a single attribute <code>path</code> which is the fully qualified
	path to the block device node. <span class="since">Since 0.4.1</span></dd><dt><code>directory</code></dt><dd>Provides the source for pools backed by directories. May
	only occur once. Contains a single attribute <code>path</code>
	which is the fully qualified path to the block device node.
	<span class="since">Since 0.4.1</span></dd><dt><code>host</code></dt><dd>Provides the source for pools backed by storage from a
	remote server. Will be used in combination with a <code>directory</code>
	or <code>device</code> element. Contains an attribute <code>name</code>
	which is the hostname or IP address of the server. May optionally
	contain a <code>port</code> attribute for the protocol specific
	port number. <span class="since">Since 0.4.1</span></dd><dt><code>name</code></dt><dd>Provides the source for pools backed by storage from a
	named element (e.g., a logical volume group name).
	remote server. Contains a string identifier.
	<span class="since">Since 0.4.5</span></dd><dt><code>format</code></dt><dd>Provides information about the format of the pool. This
	contains a single attribute <code>type</code> whose value is
	backend specific. This is typically used to indicate filesystem
	type, or network filesystem type, or partition table type, or
	LVM metadata type. All drivers are required to have a default
	value for this, so it is optional. <span class="since">Since 0.4.1</span></dd></dl>
        <h3>
          <a name="StoragePoolTarget" id="StoragePoolTarget">Target elements</a>
        </h3>
        <p>
      A single <code>target</code> element is contained within the top level
      <code>pool</code> element. This tag is used to describe the mapping of
      the storage pool into the host filesystem. It can contain the following
      child elements:
    </p>
        <pre>
        ...
        &lt;target&gt;
          &lt;path&gt;/dev/disk/by-path&lt;/path&gt;
          &lt;permissions&gt;
            &lt;owner&gt;0744&lt;/owner&gt;
            &lt;group&gt;0744&lt;/group&gt;
            &lt;mode&gt;0744&lt;/mode&gt;
            &lt;label&gt;virt_image_t&lt;/label&gt;
          &lt;/permissions&gt;
        &lt;/target&gt;
      &lt;/pool&gt;</pre>
        <dl><dt><code>path</code></dt><dd>Provides the location at which the pool will be mapped into
	the local filesystem namespace. For a filesystem/directory based
	pool it will be the name of the directory in which volumes will
	be created. For device based pools it will be the name of the directory in which
	devices nodes exist. For the latter <code>/dev/</code> may seem
	like the logical choice, however, devices nodes there are not
	guaranteed stable across reboots, since they are allocated on
	demand. It is preferable to use a stable location such as one
	of the <code>/dev/disk/by-{path,id,uuid,label</code> locations.
	<span class="since">Since 0.4.1</span>
      </dd><dt><code>permissions</code></dt><dd>Provides information about the default permissions to use
	when creating volumes. This is currently only useful for directory
	or filesystem based pools, where the volumes allocated are simple
	files. For pools where the volumes are device nodes, the hotplug
	scripts determine permissions. It contains 4 child elements. The
	<code>mode</code> element contains the octal permission set. The
	<code>owner</code> element contains the numeric user ID. The <code>group</code>
	element contains the numeric group ID. The <code>label</code> element
	contains the MAC (eg SELinux) label string.
	<span class="since">Since 0.4.1</span>
      </dd></dl>
        <h3>
          <a name="StoragePoolExtents" id="StoragePoolExtents">Device extents</a>
        </h3>
        <p>
      If a storage pool exposes information about its underlying
      placement / allocation scheme, the <code>device</code> element
      within the <code>source</code> element may contain information
      about its available extents. Some pools have a constraint that
      a volume must be allocated entirely within a single constraint
      (eg disk partition pools). Thus the extent information allows an
      application to determine the maximum possible size for a new
      volume
    </p>
        <p>
      For storage pools supporting extent information, within each
      <code>device</code> element there will be zero or more <code>freeExtent</code>
      elements. Each of these elements contains two attributes, <code>start</code>
      and <code>end</code> which provide the boundaries of the extent on the
      device, measured in bytes.  <span class="since">Since 0.4.1</span>
    </p>
        <h2>
          <a name="StorageVol" id="StorageVol">Storage volume XML</a>
        </h2>
        <p>
      A storage volume will be either a file or a device node.
      The storage volume XML format is available <span class="since">since 0.4.1</span>
    </p>
        <h3>
          <a name="StorageVolFirst" id="StorageVolFirst">General metadata</a>
        </h3>
        <pre>
      &lt;volume type="file"&gt;
	&lt;name&gt;sparse.img&lt;/name&gt;
	&lt;key&gt;/var/lib/xen/images/sparse.img&lt;/key&gt;
        &lt;allocation&gt;0&lt;/allocation&gt;
	&lt;capacity unit="T"&gt;1&lt;/capacity&gt;
        ...</pre>
        <dl><dt><code>name</code></dt><dd>Providing a name for the volume which is unique to the pool.
	This is mandatory when defining a volume.  <span class="since">Since 0.4.1</span></dd><dt><code>key</code></dt><dd>Providing an identifier for the volume which is globally unique.
	This is optional when defining a volume, a key will be generated if
	omitted. <span class="since">Since 0.4.1</span></dd><dt><code>allocation</code></dt><dd>Providing the total storage allocation for the volume. This
	may be smaller than the logical capacity if the volume is sparsely
	allocated. It may also be larger than the logical capacity if the
	volume has substantial metadata overhead. This value is in bytes.
	If omitted when creating a volume, the volume will be fully
	allocated at time of creation. If set to a value smaller than the
	capacity, the pool has the <strong>option</strong> of deciding
	to sparsely allocate a volume. It does not have to honour requests
	for sparse allocation though. <span class="since">Since 0.4.1</span></dd><dt><code>capacity</code></dt><dd>Providing the logical capacity for the volume. This value is
	in bytes. This is compulsory when creating a volume.
	<span class="since">Since 0.4.1</span></dd><dt><code>source</code></dt><dd>Provides information about the underlying storage allocation
	of the volume. This may not be available for some pool types.
	<span class="since">Since 0.4.1</span></dd><dt><code>target</code></dt><dd>Provides information about the representation of the volume
	on the local host. <span class="since">Since 0.4.1</span></dd></dl>
        <h3>
          <a name="StorageVolTarget" id="StorageVolTarget">Target elements</a>
        </h3>
        <p>
      A single <code>target</code> element is contained within the top level
      <code>volume</code> element. This tag is used to describe the mapping of
      the storage volume into the host filesystem. It can contain the following
      child elements:
    </p>
        <pre>
        ...
	&lt;target&gt;
          &lt;path&gt;/var/lib/virt/images/sparse.img&lt;/path&gt;
          &lt;permissions&gt;
            &lt;owner&gt;0744&lt;/owner&gt;
            &lt;group&gt;0744&lt;/group&gt;
            &lt;mode&gt;0744&lt;/mode&gt;
            &lt;label&gt;virt_image_t&lt;/label&gt;
          &lt;/permissions&gt;
	&lt;/target&gt;
      &lt;/volume&gt;</pre>
        <dl><dt><code>path</code></dt><dd>Provides the location at which the pool will be mapped into
	the local filesystem namespace. For a filesystem/directory based
	pool it will be the name of the directory in which volumes will
	be created. For device based pools it will be the name of the directory in which
	devices nodes exist. For the latter <code>/dev/</code> may seem
	like the logical choice, however, devices nodes there are not
	guaranteed stable across reboots, since they are allocated on
	demand. It is preferable to use a stable location such as one
	of the <code>/dev/disk/by-{path,id,uuid,label</code> locations.
	<span class="since">Since 0.4.1</span>
      </dd><dt><code>format</code></dt><dd>Provides information about the pool specific volume format.
	For disk pools it will provide the partition type. For filesystem
	or directory pools it will provide the file format type, eg cow,
	qcow, vmdk, raw. If omitted when creating a volume, the pool's
	default format will be used. The actual format is specified via
	the <code>type</code>. Consult the pool-specific docs for the
	list of valid values. <span class="since">Since 0.4.1</span></dd><dt><code>permissions</code></dt><dd>Provides information about the default permissions to use
	when creating volumes. This is currently only useful for directory
	or filesystem based pools, where the volumes allocated are simple
	files. For pools where the volumes are device nodes, the hotplug
	scripts determine permissions. It contains 4 child elements. The
	<code>mode</code> element contains the octal permission set. The
	<code>owner</code> element contains the numeric user ID. The <code>group</code>
	element contains the numeric group ID. The <code>label</code> element
	contains the MAC (eg SELinux) label string.
	<span class="since">Since 0.4.1</span>
      </dd></dl>
        <h2>
          <a name="examples" id="examples">Example configuration</a>
        </h2>
        <p>
      Here are a couple of examples, for a more complete set demonstrating
      every type of storage pool, consult the <a href="storage.html">storage driver page</a>
    </p>
        <h3>
          <a name="exampleFile" id="exampleFile">File based storage pool</a>
        </h3>
        <pre>
      &lt;pool type="dir"&gt;
        &lt;name&gt;virtimages&lt;/name&gt;
        &lt;target&gt;
          &lt;path&gt;/var/lib/virt/images&lt;/path&gt;
        &lt;/target&gt;
      &lt;/pool&gt;</pre>
        <h3>
          <a name="exampleISCSI" id="exampleISCSI">iSCSI based storage pool</a>
        </h3>
        <pre>
      &lt;pool type="iscsi"&gt;
        &lt;name&gt;virtimages&lt;/name&gt;
        &lt;source&gt;
          &lt;host name="iscsi.example.com"/&gt;
          &lt;device path="demo-target"/&gt;
        &lt;/source&gt;
        &lt;target&gt;
          &lt;path&gt;/dev/disk/by-path&lt;/path&gt;
        &lt;/target&gt;
      &lt;/pool&gt;</pre>
        <h3>
          <a name="exampleVol" id="exampleVol">Storage volume</a>
        </h3>
        <pre>
      &lt;volume type="file"&gt;
	&lt;name&gt;sparse.img&lt;/name&gt;
	&lt;allocation&gt;0&lt;/allocation&gt;
	&lt;capacity unit="T"&gt;1&lt;/capacity&gt;
	&lt;target&gt;
          &lt;path&gt;/var/lib/virt/images/sparse.img&lt;/path&gt;
          &lt;permissions&gt;
            &lt;owner&gt;0744&lt;/owner&gt;
            &lt;group&gt;0744&lt;/group&gt;
            &lt;mode&gt;0744&lt;/mode&gt;
            &lt;label&gt;virt_image_t&lt;/label&gt;
          &lt;/permissions&gt;
	&lt;/target&gt;
      &lt;/volume&gt;</pre>
      </div>
    </div>
    <div id="footer">
      <p id="sponsor">
	    Sponsored by:<br /><a href="http://et.redhat.com/"><img src="et.png" alt="Project sponsored by Red Hat Emerging Technology" /></a></p>
    </div>
  </body>
</html>