~ubuntu-branches/ubuntu/maverick/libvirt/maverick

« back to all changes in this revision

Viewing changes to docs/formatstorage.html

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2008-06-25 18:51:21 UTC
  • mto: (3.1.1 lenny) (1.2.1 upstream) (0.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 27.
  • Revision ID: james.westby@ubuntu.com-20080625185121-8dku38gpoluks1bx
Tags: upstream-0.4.4
ImportĀ upstreamĀ versionĀ 0.4.4

Show diffs side-by-side

added added

removed removed

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