1 ganeti-os-interface(7) Ganeti | Version @GANETI_VERSION@
2 ========================================================
7 ganeti-os-interface - Specifications for guest OS types
12 The method of supporting guest operating systems in Ganeti is to
13 have, for each guest OS type, a directory containing a number of
19 There are six required files: *create*, *import*, *export*, *rename*
20 (executables), *ganeti_api_version* and *variants.list* (text files).
25 All commands will get their input via environment variables. A
26 common set of variables will be exported for all commands, and some
27 of them might have extra ones. Note that all counts are
33 The OS API version that the rest of the environment conforms to.
36 The instance name the script should operate on.
39 Both names point to the name of the instance's OS as Ganeti knows
40 it. This can simplify the OS scripts by providing the same scripts
41 under multiple names, and then the scripts can use this name to
42 alter their behaviour.
44 With OS API 15 changing the script behavior based on this variable
45 is deprecated: OS_VARIANT should be used instead (see below).
48 The variant of the OS which should be installed. Each OS must
49 support all variants listed under its variants.list file, and may
50 support more. Any more supported variants should be properly
51 documented in the per-OS documentation.
54 The hypervisor of this instance.
57 The number of disks the instance has. The actual disk defitions are
58 in a set of additional variables. The instance's disk will be
59 numbered from 0 to this value minus one.
62 The path to the storage for disk N of the instance. This might be
63 either a block device or a regular file, in which case the OS
64 scripts should use ``losetup`` (if they need to mount it). E.g. the
65 first disk of the instance might be exported as
66 ``DISK_0_PATH=/dev/drbd0``.
69 This is how the hypervisor will export the instance disks: either
70 read-write (``rw``) or read-only (``ro``).
73 (Optional) If applicable to the current hypervisor type: the type
74 of the device exported by the hypervisor. For example, the Xen HVM
75 hypervisor can export disks as either ``paravirtual`` or
79 How files are visible on the node side. This can be either
80 ``block`` (when using block devices) or ``file:type``, where
81 ``type`` is either ``loop`` or ``blktap`` depending on how the
82 hypervisor will be configured. Note that not all backend types
83 apply to all hypervisors.
86 Similar to the ``DISK_COUNT``, this represents the number of NICs
90 The MAC address associated with this interface.
93 The IP address, if any, associated with the N-th NIC of the
97 The NIC mode, either routed or bridged
100 The bridge to which this NIC will be attached. This variable is
101 defined only when the NIC is in bridged mode.
104 If the NIC is in bridged mode, this is the same as
105 ``NIC_%N_BRIDGE``. If it is in routed mode, the routing table
106 which will be used by the hypervisor to insert the appropriate
110 (Optional) If applicable, the type of the exported NIC to the
111 instance, this can be one of: ``rtl8139``, ``ne2k_pci``,
112 ``ne2k_isa``, ``paravirtual``.
115 If non-zero, this should cause the OS script to generate verbose
116 logs of its execution, for troubleshooting purposes. Currently
117 only ``0`` and ``1`` are valid values.
123 The **create** command is used for creating a new instance from
124 scratch. It has no additional environment variables bside the
127 The ``INSTANCE_NAME`` variable denotes the name of the instance,
128 which is guaranteed to resolve to an IP address. The create script
129 should configure the instance according to this name. It can
130 configure the IP statically or not, depending on the deployment
133 The ``INSTANCE_REINSTALL`` variable is set to ``1`` when this create
134 request is reinstalling and existing instance, rather than creating
135 one anew. This can be used, for example, to preserve some data in the
136 old instance in an OS-specific way.
141 This command is used in order to make a backup of a given disk of
142 the instance. The command should write to stdout a dump of the
143 given block device. The output of this program will be passed
144 during restore to the **import** command.
146 The specific disk to backup is denoted by two additional environment
147 variables: ``EXPORT_INDEX`` which denotes the index in the instance
148 disks structure (and could be used for example to skip the second disk
149 if not needed for backup) and ``EXPORT_PATH`` which has the same value
150 as ``DISK_N_PATH`` but is duplicate here for easier usage by shell
151 scripts (rather than parse the ``DISK_...`` variables).
153 To provide the user with an estimate on how long the export will take,
154 a predicted size can be written to the file descriptor passed in the
155 variable ``EXP_SIZE_FD``. The value is in bytes and must be terminated
156 by a newline character (``\n``). Older versions of Ganeti don't
157 support this feature, hence the variable should be checked before
160 if test -n "$EXP_SIZE_FD"; then
161 blockdev --getsize64 $blockdev >&$EXP_SIZE_FD
167 The **import** command is used for restoring an instance from a
168 backup as done by **export**. The arguments are the similar to
169 those passed to **export**, whose output will be provided on
172 The difference in variables is that the current disk is called by
173 ``IMPORT_DEVICE`` and ``IMPORT_INDEX`` (instead of ``EXPORT_...``).
178 This command is used in order to perform a rename at the instance
179 OS level, after the instance has been renamed in Ganeti. The
180 command should do whatever steps are required to ensure that the
181 instance is updated to use the new name, if the operating system
184 Note that it is acceptable for the rename script to do nothing at
185 all, however be warned that in this case, there will be a
186 desynchronization between what gnt-instance list shows you and the
187 actual hostname of the instance.
189 The script will be passed one additional environment variable
190 called ``OLD_INSTANCE_NAME`` which holds the old instance name. The
191 ``INSTANCE_NAME`` variable holds the new instance name.
193 A very simple rename script should at least change the hostname and
194 IP address of the instance, leaving the administrator to update the
200 The ganeti_api_version file is a plain text file containing the
201 version(s) of the guest OS API that this OS definition complies
202 with, one per line. The version documented by this man page is 15,
203 so this file must contain the number 15 followed by a newline if
204 only this version is supported. A script compatible with more than
205 one Ganeti version should contain the most recent version first
206 (i.e. 15), followed by the old version(s) (in this case 10 and/or
212 variants.list is a plain text file containing all the declared
213 supported variants for this OS, one per line. At least one variant
219 Backwards compatibility
220 ~~~~~~~~~~~~~~~~~~~~~~~
222 Ganeti 2.2 is compatible with both API version 10, and 15. In API
223 version 10 the variants.list file is ignored and no OS_VARIANT
224 environment variable is passed.
229 All the scripts should display an usage message when called with a
230 wrong number of arguments or when the first argument is ``-h`` or
233 Upgrading from old versions
234 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
239 The ``variants.list`` file has been added, so OSes should support at
240 least one variant, declaring it in that file and must be prepared to
241 parse the OS_VARIANT environment variable. OSes are free to support
242 more variants than just the declared ones.
247 The method for passing data has changed from command line options
248 to environment variables, so scripts should be modified to use
249 these. For an example of how this can be done in a way compatible
250 with both versions, feel free to look at the debootstrap instance's
251 common.sh auxiliary script.
253 Also, instances can have now a variable number of disks, not only
254 two, and a variable number of NICs (instead of fixed one), so the
255 scripts should deal with this. The biggest change is in the
256 import/export, which are called once per disk, instead of once per
262 The rename script has been added. If you don't want to do any
263 changes on the instances after a rename, you can migrate the OS
264 definition to version 5 by creating the rename script simply as::
270 Note that the script must be executable.