1 ==============================================================
2 Ganeti Instance Import/Export using Open Virtualization Format
3 ==============================================================
8 Open Virtualization Format is an open standard for packaging
9 information regarding virtual machines. It is used, among other, by
10 VMWare, VirtualBox and XenServer. OVF allows users to migrate between
11 virtualization software without the need of reconfiguring hardware,
12 network or operating system.
14 Currently, exporting instance in Ganeti results with a configuration
15 file that is readable only for Ganeti. It disallows the users to
16 change the platform they use without loosing all the machine's
17 configuration. Import function in Ganeti is also currently limited to
18 the previously prepared instances.
20 Implementation of OVF support allows users to migrate to Ganeti from
21 other platforms, thus potentially increasing the usage. It also
22 enables virtual machine end-users to create their own machines
23 (e.g. in VirtualBox or SUSE Studio) and then add them to Ganeti
24 cluster, thus providing better personalization.
29 Open Virtualization Format description
30 --------------------------------------
32 According to the DMTF document introducing the standard: "The Open
33 Virtualization Format (OVF) Specification describes an open, secure,
34 portable, efficient and extensible format for the packaging and
35 distribution of software to be run in virtual machines." OVF supports
36 both single and multiple- configurations of VMs in one package, is
37 host- and virtualization platform-independent and optimized for
38 distribution (e.g. by allowing usage of public key infrastructure and
39 providing tools for management of basic software licensing).
41 There are no limitations regarding disk images used, as long as the
42 description is provided. Any hardware described in a proper format
43 (i.e. CIM - Common Information Model) is accepted, although there is no
44 guarantee that every virtualization software will support all types of
47 OVF package should contain exactly one file with ``.ovf`` extension,
48 which is an XML file specifying the following (per virtual machine):
52 - list of virtual hardware
53 - operating system, if any
55 Each of the elements in ``.ovf`` file may, if desired, contain a
56 human-readable description to every piece of information given.
58 Additionally, the package may have some disk image files and other
59 additional resources (e.g. ISO images).
61 In order to provide secure means of distribution for OVF packages, the
62 manifest and certificate are provided. Manifest (``.mf`` file) contains
63 checksums for all the files in OVF package, whereas certificate
64 (``.cert`` file) contains X.509 certificate and a checksum of manifest
65 file. Both files are not compulsory, but certificate requires manifest
68 Supported disk formats
69 ----------------------
71 Although OVF is claimed to support 'any disk format', what we are
72 interested in is which formats are supported by VM managers that
75 - VMWare: ``.vmdk`` (which comes in at least 3 different flavours:
76 ``sparse``, ``compressed`` and ``streamOptimized``)
77 - VirtualBox: ``.vdi`` (VirtualBox's format), ``.vmdk``, ``.vhd``
78 (Microsoft and XenServer); export disk format is always ``.vmdk``
79 - XenServer: ``.vmdk``, ``.vhd``; export disk format is always
81 - Red Hat Enterprise Virtualization: ``.raw`` (raw disk format),
82 ``.cow`` (qemu's ``QCOW2``)
83 - other: AbiCloud, OpenNode Cloud, SUSE Studio, Morfeo Claudia,
84 OpenStack: mostly ``.vmdk``
86 In our implementation of the OVF we allow a choice between raw, cow and
87 vmdk disk formats for both import and export. Other formats covertable
88 using ``qemu-img`` are allowed, but not tested.
89 The justification is the following:
91 - Raw format is supported as it is the main format of disk images used
92 in Ganeti, thus it is effortless to provide support for this format
94 - Vmdk is most commonly supported in virtualization software, it also
95 has the advantage of producing relatively small disk images, which
96 is extremely important advantage when moving instances.
98 Import and export - the closer look
99 ===================================
101 This section contains an overview of how different parts of
102 Ganeti's export info are included in ``.ovf`` configuration file.
103 It also explains how import is designed to work with incomplete
106 Ganeti's backup format vs OVF
107 -----------------------------
110 The basic structure of Ganeti ``.ovf`` file is the following::
113 <References></References>
114 <DiskSection></DiskSection>
115 <NetworkSection></NetworkSection>
118 <OperatingSystemSection></OperatingSystemSection>
119 <VirtualHardwareSection><VirtualHardwareSection>
124 <gnt:Tags></gnt:Tags>
125 <gnt:DiskTemplate</gnt:DiskTemplate>
126 <gnt:OperatingSystem>
128 <gnt:Parameters></gnt:Parameters>
129 </gnt:OperatingSystem>
132 <gnt:Parameters></gnt:Parameters>
144 Tags with ``gnt:`` prefix are Ganeti-specific and are not a part of
149 Whereas Ganeti's export info is of the following form, ``=>`` showing
150 where will the data be in OVF format::
153 disk0_dump = filename => File in References
154 disk0_ivname = name => generated automatically
155 disk0_size = size_in_mb => calculated after disk conversion
156 disk_count = number => generated automatically
157 disk_template = disk_type => gnt:DiskTemplate
158 hypervisor = hyp-name => gnt:Name in gnt:Hypervisor
159 name = inst-name => Name in VirtualSystem
160 nic0_ip = ip => gnt:IPAddress in gnt:Network
161 nic0_link = link => gnt:Link in gnt:Network
162 nic0_mac = mac => gnt:MACAddress in gnt:Network or
163 Item in VirtualHardwareSection
164 nic0_mode = mode => gnt:Mode in gnt:Network
165 nic_count = number => generated automatically
169 auto_balanced => gnt:AutoBalance
170 memory = mem_in_mb => Item in VirtualHardwareSection
171 vcpus = number => Item in VirtualHardwareSection
174 compression => ignored
175 os => gnt:Name in gnt:OperatingSystem
178 version => gnt:VersionId or
179 constants.EXPORT_VERSION
181 [os] => gnt:Parameters in gnt:OperatingSystem
183 [hypervisor] => gnt:Parameters in gnt:Hypervisor
185 In case of multiple networks/disks used by an instance, they will
186 all be saved in appropriate sections as specified above for the first
189 Import from other virtualization software
190 -----------------------------------------
191 In case of importing to Ganeti OVF package generated in other software,
192 e.g. VirtualBox, some fields required for Ganeti to properly handle
193 import may be missing. Most often it will happen that such OVF package
194 will lack the ``gnt:GanetiSection``.
196 If this happens you can specify all the missing parameters in
197 the command line. Please refer to `Command Line`_ section.
199 In the :doc:`ovfconverter` we provide examples of
200 options when converting from VirtualBox, VMWare and OpenSuseStudio.
202 Export to other virtualization software
203 ---------------------------------------
204 When exporting to other virtualization software, you may notice that
205 there is a section ``gnt:GanetiSection``, containing Ganeti-specific
206 information. This may on **rare** cases cause trouble in importing your
207 instance. If that is the case please do one of the two:
209 1. Export from Ganeti to OVF with ``--external`` option - this will
210 cause to skip the non-standard information.
212 2. Manually remove the gnt:GanetiSection from the ``.ovf`` file. You
213 will also have to recompute sha1 sum (``sha1sum`` command) of the .ovf
214 file and update your ``.mf`` file with new value.
217 Manual change option is only recommended when you have exported your
218 instance with ``-format`` option other that ``raw`` or selected
219 ``--compress``. It saves you the time of converting or compressing
225 The limitations regarding import of the OVF instances generated
226 outside Ganeti will be (in general) the same, as limitations for
227 Ganeti itself. The desired behavior in case of encountering
228 unsupported element will be to ignore this element's tag without
229 interruption of the import process.
234 There are no limitations regarding support for multiple files in
235 package or packing the OVF package into one OVA (Open Virtual
236 Appliance) file. As for certificates and licenses in the package,
237 their support will be under discussion after completion of the basic
238 features implementation.
240 Multiple Virtual Systems
241 ------------------------
243 At first only singular instances (i.e. VirtualSystem, not
244 VirtualSystemCollection) will be supported. In the future multi-tiered
245 appliances containing whole nodes (or even clusters) are considered an
251 As mentioned, Ganeti will allow export in ``raw``, ``cow`` and ``vmdk``
252 formats. This means i.e. that the appropriate ``ovf:format``
253 will be provided. It does not mean that other formats cannot be used,
254 rather that we did not test them.
255 As for import, we will support all formats that ``qemu-img`` can convert
256 to ``raw``. At this point this means ``raw``, ``cow``, ``qcow``,
257 ``qcow2``, ``vmdk`` and ``cloop``. We do not plan for now to support
258 ``vdi`` or ``vhd`` unless they become part of qemu-img supported formats.
260 We plan to support compression both for import and export - in gzip
261 format. There is also a possibility to provide virtual disk in chunks
262 of equal size. The latter will not be implemented in the first version,
263 but we do plan to support it eventually.
266 The ``ovf:format`` tag is not used in our case when importing. Instead
267 we use ``qemu-img info``, which provides enough information for our
268 purposes and is better standardized.
270 Please note, that due to security reasons we require the disk image to
271 be in the same directory as the ``.ovf`` description file.
273 In order to completely ignore disk-related information in resulting
274 config file, please use ``--disk-template=diskless`` option.
279 Ganeti provides support for routed and bridged mode for the networks.
280 Since the standard OVF format does not contain any information regarding
281 used network type, we add our own source of such information in
282 ``gnt:GanetiSection``. In case this additional information is not
283 present, we perform a simple check - if network name specified in
284 ``NetworkSection`` contains words ``bridged`` or ``routed``, we consider
285 this to be the network type. Otherwise option ``auto`` is chosen, in
286 which case the cluster's default value for that field will be used when
288 This provides a safe fallback in case of NAT networks usage, which are
289 commonly used e.g. in VirtualBox.
294 The supported hardware is limited to virtual CPUs, RAM memory, disks and
295 networks. In particular, no USB support is currently provided, as Ganeti
296 does not support them.
301 Support for different operating systems depends solely on their
302 accessibility for Ganeti instances. List of installed OSes can be
303 checked using ``gnt-os list`` command.
308 The instance name (``gnt:VirtualSystem\gnt:Name`` or command line's
309 ``--name`` option ) has to be resolvable in order for successful import
310 using ``gnt-backup import``.
316 The basic usage of the ovf tool is one of the following::
318 ovfconverter import filename
319 ovfconverter export --format=<format> filename
321 This will result in a conversion based solely on the content of provided
322 file. In case some information required to make the conversion is
323 missing, an error will occur.
325 If output directory should be different than the standard Ganeti export
326 directory (usually ``/srv/ganeti/export``), option ``--output-dir``
329 If name of resulting entity should be different than the one read from
330 the file, use ``--name`` option.
335 Import options that ``ovfconverter`` supports include options for
336 backend, disks, hypervisor, networks and operating system. If an option
337 is given, it overrides the values provided in the OVF file.
341 ``--backend=option=value`` can be used to set auto balance, number of
342 vcpus and amount of RAM memory.
344 Please note that when you do not provide full set of options, the
345 omitted ones will be set to cluster defaults (``auto``).
349 ``--disk-template=diskless`` causes the converter to ignore all other
350 disk option - both from .ovf file and the command line. Other disk
351 template options include ``plain``, ``drdb``, ``file``, ``sharedfile``
354 ``--disk=number:size=value`` causes to create disks instead of
355 converting them from OVF package; numbers should start with ``0`` and be
360 ``-H hypervisor_name`` and ``-H hypervisor_name:option=value``
361 provide options for hypervisor.
365 ``--no-nics`` option causes converter to ignore any network information
368 ``--network=number:option=value`` sets network information according to
369 provided data, ignoring the OVF package configuration.
373 ``--os-type=type`` sets os type accordingly, this option is **required**
374 when importing from OVF instance not created from Ganeti config file.
376 ``--os-parameters`` provides options for chosen operating system.
380 ``--tags=tag1,tag2,tag3`` is a means of providing tags specific for the
384 After the conversion is completed, you may use ``gnt-backup import`` to
385 import the instance into Ganeti.
389 ovfconverter import file.ovf --disk-template=diskless \
390 --os-type=lenny-image \
391 --backend=vcpus=1,memory=512,auto_balance \
393 --net=0:mode=bridged,link=xen-br0 \
396 gnt-backup import xen.i1
402 Export options include choice of disk formats to convert the disk image
403 (``--format``) and compression of the disk into gzip format
404 (``--compress``). User has also the choice of allowing to skip the
405 Ganeti-specific part of the OVF document (``--external``).
407 By default, exported OVF package will not be contained in the OVA
408 package, but this may be changed by adding ``--ova`` option.
410 Please note that in order to create an OVF package, it is first
411 required that you export your VM using ``gnt-backup export``.
415 gnt-backup export -n node1.xen xen.i1
417 ovfconverter export --format=vmdk --ova --external \
418 --output-dir=~/xen.i1 \
419 /srv/ganeti/export/xen.i1.node1.xen/config.ini
421 Implementation details
422 ======================
427 Disk conversion for both import and export is done using external tool
428 called qemu-tools. The same tool is used to determine the type of disk,
429 as well as its virtual size.
435 Import functionality is implemented using two classes - OVFReader and
438 OVFReader class is used to read the contents of the ``.ovf`` file. Every
439 action that requires ``.ovf`` file access is done through that class.
440 It also performs validation of manifest, if one is present.
442 The result of reading some part of file is typically a dictionary or a
443 string, containing options which correspond to the ones in
444 ``config.ini`` file. Only in case of disks, the resulting value is
445 different - it is then a list of disk names. The reason for that is the
448 OVFImporter class performs all the command-line-like tasks, such as
449 unpacking OVA package, removing temporary directory, converting disk
450 file to raw format or saving the configuration file on disk.
451 It also contains a set of functions that read the options provided in
455 Typical workflow for the import is very simple:
457 - read the ``.ovf`` file info memory
459 - parse each element of the configuration file: name, disk template,
460 hypervisor, operating system, backend parameters, network and disks
462 - check if option for the element can be read from command line
465 - if yes: parse options from command line
467 - otherwise: read the appropriate portion of ``.ovf`` file
469 - save gathered information in ``config.ini`` file
472 .. vim: set textwidth=72 :