1virt-image(5)            Virtual Machine Install Tools           virt-image(5)
2
3
4

NAME

6       virt-image - Format of the virtual image XML descriptor
7

DESCRIPTION

9       virt-image(1) relies on an XML descriptor to create virtual machines
10       from virtual machine images. In general, a virtual machine image
11       consists of the XML descriptor (usually in a file image.xml) and a
12       number of files for the virtual machine's disks.
13
14       In the following explanation of the structure of the image descriptor,
15       mandatory XML elements are marked as element, whereas optional elements
16       are marked as element.
17
18       All file names in the image descriptor are relative to the location of
19       the descriptor itself. Generally, disk files are either kept in the
20       same directory as the image descriptor, or in a subdirectory.
21

HOST MATCHING

23       The image descriptor contains information on the requirements a guest
24       has on the host platform through one or more the /image/domain/boot
25       descriptors (see section "BOOT"). The image can only be used if at
26       least one of the boot descriptors is suitable for the host platform; a
27       boot descriptor is suitable if:
28
29       ·   The CPU architecture of the boot descriptor, given by the
30           boot/guest/arch element, is supported by the host
31
32       ·   The host supports a guest with the features requested in the
33           boot/guest/features element, such as providing an APIC, or having
34           ACPI turned off
35
36       If a suitable boot descriptor is found, the guest is created and booted
37       according to the information about booting the OS from the boot/os
38       element and with the disks specified in the boot/drive element. If more
39       than one suitable boot descriptor is found, one of them is chosen based
40       on a heuristic, generally preferring paravirtualized guests over full
41       virtualized ones, though this is an implementation detail of the tool
42       creating the virtual machine.
43

STRUCTURE

45       The image descriptor consists of three sections, all contained in the
46       toplevel image element:
47
48       General metadata about the image
49           A number of elements like label, name, and description that give
50           some simple information about the image. The name must be a string
51           suitable as a name for the virtual machine, the label is a short
52           human-readable string suitable for display in graphical UI's, and
53           the description should be a longer, free-form description of the
54           purpose of the image. The name is mandatory.
55
56       Virtual machine attributes
57           The domain element contains instructions on how to boot the image,
58           and device attributes such as the number of virtual CPU's and the
59           size of the memory. (see section "DOMAIN")
60
61       Storage layout
62           The storage element lists the files to back the virtual machine's
63           disks and some information about their format and use. (see section
64           "STORAGE")
65

DOMAIN

67       The domain element contains one or more boot descriptors (see section
68       "BOOT") and a devices element. The Devices element lists the
69       recommended number of virtual CPU's in the vcpu element and the
70       recommended amount of memory in kB in the memory element. It also
71       indicates whether the virtual machine should have a network interface
72       through the interface element and whether the virtual machine has a
73       graphical interface through the graphics element.
74
75   BOOT
76       Each boot descriptor details how the virtual machine should be started
77       on a certain hypervisor. The type attribute of the boot element, which
78       can either be "xen" or "hvm", depending on whether the boot descriptor
79       is for a paravirtualized Xen(tm) guest or a fully-virtualized guest.
80
81       The boot element contains three subelements:
82
83       The platform requirements of the guest
84           The platform requirements, contained in the guest element, consist
85           of the arch element and the features element. The arch element
86           indicates the CPU architecture the guest expects, e.g. "i686",
87           "x86_64", or "ppc".
88
89           The features element indicates whether certain platform features
90           should be on or off. Currently, the platform features are pae,
91           acpi, and apic. Omitting a togglable feature tag turns it off.
92
93       The details of booting the image's operating system
94           The os element for fully-virtualized "hvm" guests contains a loader
95           element whose dev attribute indicates whether to boot off a hard
96           disk ("dev='hd'") or off a CD-ROM ("dev='cdrom'")
97
98           For paravirtualized guests, the os element either contains a
99           "<loader>pygrub</loader>" element, indicating that the guest should
100           be booted with pygrub, or kernel, initrd and cmdline elements. The
101           contents of the kernel and initrd elements are the names of the
102           kernel and initrd files, whereas the cmdline element contains the
103           command line that should be passed to the kernel on boot.
104
105       The mapping of disk files as devices into the guest
106           The mapping of disk files into the guest is performed by a list of
107           drive elements inside the boot element. Each drive element
108           references the name of a disk file from the "STORAGE" section
109           through its disk attribute and can optionally specify as what
110           device that disk file should appear in the guest through its target
111           attribute. If the target is omitted, device names are assigned in
112           the order in which the drive elements appear, skipping already
113           assigned devices.
114

STORAGE

116       The storage element lists the disk image files that are part of the
117       virtual machine image in a list of one or more disk elements. Each disk
118       element can contain the following attributes:
119
120       ·   the file attribute giving the name of the disk file
121
122       ·   an optional id attribute. The name given with that attribute is
123           used to reference the disk from the drive element of a boot
124           descriptor. If the id attribute is missing, it defaults to the file
125           attribute.
126
127       ·   the use attribute indicating whether the disk file is a "system",
128           "user", or "scratch" disk. The use attribute differentiates disk
129           files so that an update based on replacing disk files can replace
130           "system" disks, but leave "user" disks untouched.
131
132           Generally, "system" disks contain application code, "user" disks
133           contain the application's data, and "scratch" disks contain
134           temporary state that can be erased between runs of the guest.
135
136           The virtual machine image must contain files for all "system"
137           disks, and may contain files for the "user" and "scratch" disks. If
138           the latter are not part of the image, they are initialized as empty
139           files when a guest is created, with the size given by the size
140           attribute.
141
142       ·   the size attribute giving the size of the disk in MB.
143
144       ·   the format attribute giving the format of the disk file. Currently,
145           this can be one of: "raw", "iso", "qcow2", or "vmdk".
146

EXAMPLE

148       The image descriptor below can be used to create a virtual machine
149       running the System Rescue CD ("http://www.sysresccd.org/") Besides the
150       descriptor, you only need the ISO image from the System Rescue CD
151       website.
152
153           <?xml version="1.0" encoding="UTF-8"?>
154           <image>
155             <name>sysresccd</name>
156             <domain>
157               <boot type="hvm">
158                 <guest>
159                   <arch>i686</arch>
160                 </guest>
161                 <os>
162                   <loader dev="cdrom"/>
163                 </os>
164                 <drive disk="root.raw" target="hda"/>
165                 <drive disk="sysresc"/>
166               </boot>
167               <devices>
168                 <vcpu>1</vcpu>
169                 <memory>262144</memory>
170                 <interface/>
171                 <graphics/>
172               </devices>
173             </domain>
174             <storage>
175               <disk file="root.raw" use="scratch" size="100" format="raw"/>
176               <disk id="sysresc" file="isos/systemrescuecd.iso"
177                     use="system" format="iso"/>
178             </storage>
179           </image>
180
181       To create a virtual machine, save the above XML in image.xml and run:
182
183           # virt-image --vnc image.xml
184

AUTHOR

186       Written by David Lutterkort. See the AUTHORS file in the source
187       distribution for the complete list of credits.
188

BUGS

190       Please see "http://virt-manager.org/page/BugReporting"
191
193       Copyright (C) 2006-2007 Red Hat, Inc, and various contributors.  This
194       is free software. You may redistribute copies of it under the terms of
195       the GNU General Public License "http://www.gnu.org/licenses/gpl.html".
196       There is NO WARRANTY, to the extent permitted by law.
197

SEE ALSO

199       virt-image(1), virt-install(1), the project website
200       "http://virt-manager.org", the Relax-NG grammar for image XML
201       "image.rng"
202
203
204
205                                  2017-03-22                     virt-image(5)
Impressum