1 <!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
3 <!-- Fill in your name for FIRSTNAME and SURNAME. -->
4 <!-- Please adjust the date whenever revising the manpage. -->
5 <!ENTITY dhdate "<date>October 02, 2009</date>">
6 <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
7 allowed: see man(7), man(1). -->
8 <!ENTITY dhsection "<manvolnum>7</manvolnum>">
9 <!ENTITY dhucpackage "<refentrytitle>ganeti-os-interface</refentrytitle>">
10 <!ENTITY dhpackage "ganeti">
12 <!ENTITY debian "<productname>Debian</productname>">
13 <!ENTITY gnu "<acronym>GNU</acronym>">
14 <!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
15 <!ENTITY footer SYSTEM "footer.sgml">
26 <holder>Google Inc.</holder>
34 <refmiscinfo>ganeti 2.1</refmiscinfo>
37 <refname>ganeti-os-interface</refname>
39 <refpurpose>specifications for guest OS types
45 <title>DESCRIPTION</title>
48 The method of supporting guest operating systems in Ganeti is to
49 have, for each guest OS type, a directory containing a number of
56 <title>REFERENCE</title>
59 There are six required files: <filename>create</filename>,
60 <filename>import</filename>, <filename>export</filename>,
61 <filename>rename</filename> (executables),
62 <filename>ganeti_api_version</filename> and
63 <filename>variants.list</filename> (text file).
67 <title>Common environment</title>
69 All commands will get their input via environment variables. A
70 common set of variables will be exported for all commands, and
71 some of them might have extra ones. Note that all counts are
76 <term>OS_API_VERSION</term>
78 <simpara>The OS api version that the rest of the
79 environment conforms to.</simpara>
83 <term>INSTANCE_NAME</term>
85 <simpara>The instance name the script should operate
90 <term>INSTANCE_OS</term>
92 <simpara>The name os the instance's OS as Ganeti knows
93 it. This can simplify the OS scripts by providing the same
94 scripts under multiple names, and then the scripts can use
95 this name to alter their behaviour.</simpara>
96 <simpara>Under OS api 15 changing the script behavior based
97 on this variable is deprecated: OS_VARIANT should be used
98 instead (see below).</simpara>
102 <term>OS_VARIANT</term>
104 <simpara>The variant of the OS which should be installed. Each OS
105 must support all variants listed under its
106 <filename>variants.list</filename> file, and may support more.
107 Any more supported variants should be properly documented in the
108 per-os documentation.</simpara>
112 <term>HYPERVISOR</term>
114 <simpara>The hypervisor of this instance.</simpara>
118 <term>DISK_COUNT</term>
120 <simpara>The number of disks the instance has. The actual
121 disk defitions are in a set of additional variables. The
122 instance's disk will be numbered from 0 to this value
127 <term>DISK_%N_PATH</term>
129 <simpara>The path to the storage for disk N of the
130 instance. This might be either a block device or a regular
131 file, in which case the OS scripts should use
132 <emphasis>losetup</emphasis> (if they need to mount
133 it). E.g. the first disk of the instance might be exported
134 as <envar>DISK_0_PATH=/dev/drbd0</envar>.</simpara>
138 <term>DISK_%N_ACCESS</term>
140 <simpara>This is how the hypervisor will export the
141 instance disks: either read-write (<emphasis>rw</emphasis>) or
142 read-only (<emphasis>ro</emphasis>).</simpara>
146 <term>DISK_%N_FRONTEND_TYPE</term>
148 <simpara>(Optional) If applicable to the current
149 hypervisor type: the type of the device exported by the
150 hypervisor. For example, the Xen HVM hypervisor can export
151 disks as either <emphasis>paravirtual</emphasis> or
152 <emphasis>ioemu</emphasis>.</simpara>
156 <term>DISK_%N_BACKEND_TYPE</term>
158 <simpara>How files are visible on the node side. This can
159 be either <emphasis>block</emphasis> (when using block
160 devices) or <emphasis>file:type</emphasis>, where
161 <emphasis>type</emphasis> is either
162 <emphasis>loop</emphasis> <emphasis>blktap</emphasis>
163 depending on how the hypervisor will be configured. Note
164 that not all backend types apply to all
165 hypervisors.</simpara>
169 <term>NIC_COUNT</term>
171 <simpara>Similar to the <envar>DISK_COUNT</envar>, this
172 represents the number of NICs of the instance.</simpara>
176 <term>NIC_%N_MAC</term>
178 <simpara>The MAC address associated with this
183 <term>NIC_%N_IP</term>
185 <simpara>The IP address, if any, associated with the N-th
186 NIC of the instance.</simpara>
190 <term>NIC_%N_BRIDGE</term>
192 <simpara>The bridge to which this NIC will be attached
197 <term>NIC_%N_FRONTEND_TYPE</term>
199 <para>(Optional) If applicable, the type of the exported
200 NIC to the instance, this can be one of of: <simplelist
201 type="inline"> <member>rtl8139</member>
202 <member>ne2k_pci</member> <member>ne2k_isa</member>
203 <member>paravirtual</member> </simplelist>.
208 <term>DEBUG_LEVEL</term>
210 <simpara>If non-zero, this should cause the OS script to
211 generate verbose logs of its execution, for
212 troubleshooting purposes. Currently only
213 <emphasis>0</emphasis> and <emphasis>1</emphasis> are
214 valid values.</simpara>
221 <title>create</title>
223 <para>The <command>create</command> command is used for creating
224 a new instance from scratch. It has no additional environment
225 variables bside the common ones.</para>
227 <para>The <envar>INSTANCE_NAME</envar> variable denotes the name
228 of the instance, which is guaranteed to resolve to an IP
229 address. The create script should configure the instance
230 according to this name. It can configure the IP statically or
231 not, depending on the deployment environment.</para>
233 <para>The <envar>INSTANCE_REINSTALL</envar> variable is set to '1' when
234 this create request is reinstalling and existing instance, rather than
235 creating one anew. This can be used, for example, to preserve some
236 data in the old instance in an os-specific way.</para>
241 <title>export</title>
244 This command is used in order to make a backup of a given disk
245 of the instance. The command should write to stdout a dump of
246 the given block device. The output of this program will be
247 passed during restore to the <command>import</command>
252 The specific disk to backup is denoted by two additional
253 environment variables: <envar>EXPORT_INDEX</envar> which
254 denotes the index in the instance disks structure (and could
255 be used for example to skip the second disk if not needed for
256 backup) and <envar>EXPORT_PATH</envar> which has the same
257 value as <emphasis>DISK_N_PATH</emphasis> but is duplicate
258 here for easier usage by shell scripts (rather than parse the
265 <title>import</title>
268 The <command>import</command> command is used for restoring an
269 instance from a backup as done by
270 <command>export</command>. The arguments are the similar to
271 those passed to <command>export</command>, whose output will
272 be provided on <acronym>stdin</acronym>.
276 The difference in variables is that the current disk is called
277 by <envar>IMPORT_DEVICE</envar> and <envar>IMPORT_INDEX</envar>
278 (instead of <emphasis>EXPORT_</emphasis>).
284 <title>rename</title>
287 This command is used in order to perform a rename at the
288 instance OS level, after the instance has been renamed in
289 Ganeti. The command should do whatever steps are required to
290 ensure that the instance is updated to use the new name, if
291 the operating system supports it.
295 Note that it is acceptable for the rename script to do nothing
296 at all, however be warned that in this case, there will be a
297 desynchronization between what <computeroutput>gnt-instance
298 list</computeroutput> shows you and the actual hostname of the
302 <para>The script will be passed one additional environment
303 variable called <envar>OLD_INSTANCE_NAME</envar> which holds the
304 old instance name. The <envar>INSTANCE_NAME</envar> variable
305 holds the new instance name.</para>
308 A very simple rename script should at least change the
309 hostname and IP address of the instance, leaving the
310 administrator to update the other services.
315 <title>ganeti_api_version</title>
317 The <filename>ganeti_api_version</filename> file is a plain
318 text file containing the version(s) of the guest OS api that
319 this OS definition complies with, one per line. The version
320 documented by this man page is 15, so this file must contain
321 the number 15 followed by a newline if only this version is
322 supported. A script compatible more than one ganeti version
323 should contain the most recent version first (i.e. 15),
324 followed by the old version(s) (in this case 10 and/or 5).
329 <title>variants.list</title>
331 <filename>variants.list</filename> is a plain text file
332 containing all the declared supported variants for this
333 OS, one per line. At least one variant must be supported.
343 <title>Retrocompatibility</title>
346 Ganeti 2.1 is compatible with both api version 10, and 15.
347 In api version 10 the <filename>variants.list</filename>
348 file is ignored and no OS_VARIANT environment variable is
354 <title>Common behaviour</title>
356 <para>All the scripts should display an usage message when
357 called with a wrong number of arguments or when the first
358 argument is <option>-h</option> or
359 <option>--help</option>.</para>
364 <title>Upgrading from old versions</title>
367 <title>Version 10 to 15</title>
370 The <filename>variants.list</filename> file has been
371 added, so OSes should support at least one variant,
372 declaring it in that file and must be prepared to parse
373 the OS_VARIANT environment variable. OSes are free to
374 support more variants than just the declared ones.
381 <title>Version 5 to 10</title>
384 The method os passing data has changed from command line
385 options to environment variables, so scripts should be
386 modified to use these. For an example of how this can be
387 done in a way compatible with both versions, feel free to
388 look at the debootstrap instance's
389 <filename>common.sh</filename> auxiliary script.
393 Also, instances can have now a variable number of disks, not
394 only two, and a variable number of NICs (instead of fixed
395 one), so the scripts should deal with this. The biggest
396 change is in the import/export, which are called once per
397 disk, instead of once per instance.
403 <title>Version 4 to 5</title>
405 The <filename>rename</filename> script has been added. If
406 you don't want to do any changes on the instances after a
407 rename, you can migrate the OS definition to version 5 by
408 creating the <filename>rename</filename> script simply as:
416 <para>Note that the script must be executable.</para>
423 <title>Export/import format</title>
426 It is up to the export and import scripts to define the format
427 they use. It is only required for these two to work
428 together. It is not recommended that
440 <!-- Keep this comment at the end of the file
445 sgml-minimize-attributes:nil
446 sgml-always-quote-attributes:t
449 sgml-parent-document:nil
450 sgml-default-dtd-file:nil
451 sgml-exposed-tags:nil
452 sgml-local-catalogs:nil
453 sgml-local-ecat-files:nil