Statistics
| Branch: | Tag: | Revision:

root / man / ganeti-os-interface.sgml @ 69affe73

History | View | Annotate | Download (15.8 kB)

1
<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
2

    
3
  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
4
  <!-- Please adjust the date whenever revising the manpage. -->
5
  <!ENTITY dhdate      "<date>June 08, 2010</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">
11

    
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">
16
]>
17

    
18
<refentry>
19
  <refentryinfo>
20
    <copyright>
21
      <year>2006</year>
22
      <year>2007</year>
23
      <year>2008</year>
24
      <year>2009</year>
25
      <year>2010</year>
26
      <holder>Google Inc.</holder>
27
    </copyright>
28
    &dhdate;
29
  </refentryinfo>
30
  <refmeta>
31
    &dhucpackage;
32

    
33
    &dhsection;
34
    <refmiscinfo>Ganeti 2.2</refmiscinfo>
35
  </refmeta>
36
  <refnamediv>
37
    <refname>ganeti-os-interface</refname>
38

    
39
    <refpurpose>Specifications for guest OS types</refpurpose>
40
  </refnamediv>
41

    
42
  <refsect1>
43
    <title>DESCRIPTION</title>
44

    
45
    <para>
46
      The method of supporting guest operating systems in Ganeti is to
47
      have, for each guest OS type, a directory containing a number of
48
      required files.
49
    </para>
50

    
51

    
52
  </refsect1>
53
  <refsect1>
54
    <title>REFERENCE</title>
55

    
56
    <para>
57
      There are six required files: <filename>create</filename>,
58
      <filename>import</filename>, <filename>export</filename>,
59
      <filename>rename</filename> (executables),
60
      <filename>ganeti_api_version</filename> and
61
      <filename>variants.list</filename> (text file).
62
    </para>
63

    
64
    <refsect2>
65
      <title>Common environment</title>
66
      <para>
67
        All commands will get their input via environment variables. A
68
        common set of variables will be exported for all commands, and
69
        some of them might have extra ones. Note that all counts are
70
        zero-based.
71
      </para>
72
      <variablelist>
73
        <varlistentry>
74
          <term>OS_API_VERSION</term>
75
          <listitem>
76
            <simpara>The OS API version that the rest of the
77
            environment conforms to.</simpara>
78
          </listitem>
79
        </varlistentry>
80
        <varlistentry>
81
          <term>INSTANCE_NAME</term>
82
          <listitem>
83
            <simpara>The instance name the script should operate
84
            on.</simpara>
85
          </listitem>
86
        </varlistentry>
87
        <varlistentry>
88
          <term>INSTANCE_OS</term>
89
          <term>OS_NAME</term>
90
          <listitem>
91
            <simpara>Both names point to the name of the instance's OS
92
            as Ganeti knows it. This can simplify the OS scripts by
93
            providing the same scripts under multiple names, and then
94
            the scripts can use this name to alter their
95
            behaviour.</simpara> <simpara>With OS API 15 changing the
96
            script behavior based on this variable is deprecated:
97
            OS_VARIANT should be used instead (see below).</simpara>
98
          </listitem>
99
        </varlistentry>
100
        <varlistentry>
101
          <term>OS_VARIANT</term>
102
          <listitem>
103
            <simpara>The variant of the OS which should be installed. Each OS
104
            must support all variants listed under its
105
            <filename>variants.list</filename> file, and may support more.
106
            Any more supported variants should be properly documented in the
107
            per-OS  documentation.</simpara>
108
          </listitem>
109
        </varlistentry>
110
        <varlistentry>
111
          <term>HYPERVISOR</term>
112
          <listitem>
113
            <simpara>The hypervisor of this instance.</simpara>
114
          </listitem>
115
        </varlistentry>
116
        <varlistentry>
117
          <term>DISK_COUNT</term>
118
          <listitem>
119
            <simpara>The number of disks the instance has. The actual
120
            disk defitions are in a set of additional variables. The
121
            instance's disk will be numbered from 0 to this value
122
            minus one.</simpara>
123
          </listitem>
124
        </varlistentry>
125
        <varlistentry>
126
          <term>DISK_%N_PATH</term>
127
          <listitem>
128
            <simpara>The path to the storage for disk N of the
129
            instance. This might be either a block device or a regular
130
            file, in which case the OS scripts should use
131
            <emphasis>losetup</emphasis> (if they need to mount
132
            it). E.g. the first disk of the instance might be exported
133
            as <envar>DISK_0_PATH=/dev/drbd0</envar>.</simpara>
134
          </listitem>
135
        </varlistentry>
136
        <varlistentry>
137
          <term>DISK_%N_ACCESS</term>
138
          <listitem>
139
            <simpara>This is how the hypervisor will export the
140
            instance disks: either read-write (<emphasis>rw</emphasis>) or
141
            read-only (<emphasis>ro</emphasis>).</simpara>
142
          </listitem>
143
        </varlistentry>
144
        <varlistentry>
145
          <term>DISK_%N_FRONTEND_TYPE</term>
146
          <listitem>
147
            <simpara>(Optional) If applicable to the current
148
            hypervisor type: the type of the device exported by the
149
            hypervisor. For example, the Xen HVM hypervisor can export
150
            disks as either <emphasis>paravirtual</emphasis> or
151
            <emphasis>ioemu</emphasis>.</simpara>
152
          </listitem>
153
        </varlistentry>
154
        <varlistentry>
155
          <term>DISK_%N_BACKEND_TYPE</term>
156
          <listitem>
157
            <simpara>How files are visible on the node side. This can
158
            be either <emphasis>block</emphasis> (when using block
159
            devices) or <emphasis>file:type</emphasis>, where
160
            <emphasis>type</emphasis> is either
161
            <emphasis>loop</emphasis> <emphasis>blktap</emphasis>
162
            depending on how the hypervisor will be configured. Note
163
            that not all backend types apply to all
164
            hypervisors.</simpara>
165
          </listitem>
166
        </varlistentry>
167
        <varlistentry>
168
          <term>NIC_COUNT</term>
169
          <listitem>
170
            <simpara>Similar to the <envar>DISK_COUNT</envar>, this
171
            represents the number of NICs of the instance.</simpara>
172
          </listitem>
173
        </varlistentry>
174
        <varlistentry>
175
          <term>NIC_%N_MAC</term>
176
          <listitem>
177
            <simpara>The MAC address associated with this
178
            interface.</simpara>
179
          </listitem>
180
        </varlistentry>
181
        <varlistentry>
182
          <term>NIC_%N_IP</term>
183
          <listitem>
184
            <simpara>The IP address, if any, associated with the N-th
185
            NIC of the instance.</simpara>
186
          </listitem>
187
        </varlistentry>
188
        <varlistentry>
189
          <term>NIC_%N_BRIDGE</term>
190
          <listitem>
191
            <simpara>The bridge to which this NIC will be attached
192
            to.</simpara>
193
          </listitem>
194
        </varlistentry>
195
        <varlistentry>
196
          <term>NIC_%N_FRONTEND_TYPE</term>
197
          <listitem>
198
            <para>(Optional) If applicable, the type of the exported
199
            NIC to the instance, this can be one of of: <simplelist
200
            type="inline"> <member>rtl8139</member>
201
            <member>ne2k_pci</member> <member>ne2k_isa</member>
202
            <member>paravirtual</member> </simplelist>.
203
              </para>
204
          </listitem>
205
        </varlistentry>
206
        <varlistentry>
207
          <term>DEBUG_LEVEL</term>
208
          <listitem>
209
            <simpara>If non-zero, this should cause the OS script to
210
            generate verbose logs of its execution, for
211
            troubleshooting purposes. Currently only
212
            <emphasis>0</emphasis> and <emphasis>1</emphasis> are
213
            valid values.</simpara>
214
          </listitem>
215
        </varlistentry>
216
      </variablelist>
217
    </refsect2>
218

    
219
    <refsect2>
220
      <title>create</title>
221

    
222
      <para>The <command>create</command> command is used for creating
223
      a new instance from scratch. It has no additional environment
224
      variables bside the common ones.</para>
225

    
226
      <para>The <envar>INSTANCE_NAME</envar> variable denotes the name
227
      of the instance, which is guaranteed to resolve to an IP
228
      address. The create script should configure the instance
229
      according to this name. It can configure the IP statically or
230
      not, depending on the deployment environment.</para>
231

    
232
      <para>The <envar>INSTANCE_REINSTALL</envar> variable is set to '1' when
233
      this create request is reinstalling and existing instance, rather than
234
      creating one anew. This can be used, for example, to preserve some
235
      data in the old instance in an OS-specific way.</para>
236

    
237
    </refsect2>
238

    
239
    <refsect2>
240
      <title>export</title>
241

    
242
      <para>
243
        This command is used in order to make a backup of a given disk
244
        of the instance. The command should write to stdout a dump of
245
        the given block device. The output of this program will be
246
        passed during restore to the <command>import</command>
247
        command.
248
      </para>
249

    
250
      <para>
251
        The specific disk to backup is denoted by two additional
252
        environment variables: <envar>EXPORT_INDEX</envar> which
253
        denotes the index in the instance disks structure (and could
254
        be used for example to skip the second disk if not needed for
255
        backup) and <envar>EXPORT_PATH</envar> which has the same
256
        value as <emphasis>DISK_N_PATH</emphasis> but is duplicate
257
        here for easier usage by shell scripts (rather than parse the
258
        DISK_... variables).
259
      </para>
260

    
261
      <para>
262
        To provide the user with an estimate on how long the export will take,
263
        a predicted size can be written to the file descriptor passed in the
264
        variable <envar>EXP_SIZE_FD</envar>. The value is in bytes and must be
265
        terminated by a newline character (\n). Older versions of Ganeti don't
266
        support this feature, hence the variable should be checked before use.
267
        Example: <screen>
268
if test -n "$EXP_SIZE_FD"; then
269
  blockdev --getsize64 $blockdev >&amp;$EXP_SIZE_FD
270
fi
271
</screen>
272
      </para>
273

    
274
    </refsect2>
275

    
276
    <refsect2>
277
      <title>import</title>
278

    
279
      <para>
280
        The <command>import</command> command is used for restoring an
281
        instance from a backup as done by
282
        <command>export</command>. The arguments are the similar to
283
        those passed to <command>export</command>, whose output will
284
        be provided on <acronym>stdin</acronym>.
285
      </para>
286

    
287
      <para>
288
        The difference in variables is that the current disk is called
289
        by <envar>IMPORT_DEVICE</envar> and <envar>IMPORT_INDEX</envar>
290
        (instead of <emphasis>EXPORT_</emphasis>).
291
      </para>
292

    
293
    </refsect2>
294

    
295
    <refsect2>
296
      <title>rename</title>
297

    
298
      <para>
299
        This command is used in order to perform a rename at the
300
        instance OS level, after the instance has been renamed in
301
        Ganeti. The command should do whatever steps are required to
302
        ensure that the instance is updated to use the new name, if
303
        the operating system supports it.
304
      </para>
305

    
306
      <para>
307
        Note that it is acceptable for the rename script to do nothing
308
        at all, however be warned that in this case, there will be a
309
        desynchronization between what <computeroutput>gnt-instance
310
        list</computeroutput> shows you and the actual hostname of the
311
        instance.
312
      </para>
313

    
314
      <para>The script will be passed one additional environment
315
      variable called <envar>OLD_INSTANCE_NAME</envar> which holds the
316
      old instance name. The <envar>INSTANCE_NAME</envar> variable
317
      holds the new instance name.</para>
318

    
319
      <para>
320
        A very simple rename script should at least change the
321
        hostname and IP address of the instance, leaving the
322
        administrator to update the other services.
323
      </para>
324
    </refsect2>
325

    
326
    <refsect2>
327
      <title>ganeti_api_version</title>
328
      <para>
329
        The <filename>ganeti_api_version</filename> file is a plain
330
        text file containing the version(s) of the guest OS API that
331
        this OS definition complies with, one per line. The version
332
        documented by this man page is 15, so this file must contain
333
        the number 15 followed by a newline if only this version is
334
        supported. A script compatible with more than one Ganeti version
335
        should contain the most recent version first (i.e. 15),
336
        followed by the old version(s) (in this case 10 and/or 5).
337
      </para>
338
    </refsect2>
339

    
340
    <refsect2>
341
      <title>variants.list</title>
342
      <para>
343
        <filename>variants.list</filename> is a plain text file
344
        containing all the declared supported variants for this
345
        OS, one per line. At least one variant must be supported.
346
      </para>
347
    </refsect2>
348

    
349
  </refsect1>
350

    
351
  <refsect1>
352
    <title>NOTES</title>
353

    
354
    <refsect2>
355
      <title>Backwards compatibility</title>
356

    
357
      <para>
358
        Ganeti 2.2 is compatible with both API version 10, and 15.
359
        In API version 10 the <filename>variants.list</filename>
360
        file is ignored and no OS_VARIANT environment variable is
361
        passed.
362
      </para>
363
    </refsect2>
364

    
365
    <refsect2>
366
      <title>Common behaviour</title>
367

    
368
      <para>All the scripts should display an usage message when
369
      called with a wrong number of arguments or when the first
370
      argument is <option>-h</option> or
371
      <option>--help</option>.</para>
372

    
373
    </refsect2>
374

    
375
    <refsect2>
376
      <title>Upgrading from old versions</title>
377
      <refsect3>
378

    
379
        <title>Version 10 to 15</title>
380

    
381
        <para>
382
          The <filename>variants.list</filename> file has been
383
          added, so OSes should support at least one variant,
384
          declaring it in that file and must be prepared to parse
385
          the OS_VARIANT environment variable. OSes are free to
386
          support more variants than just the declared ones.
387
        </para>
388

    
389
      </refsect3>
390

    
391
      <refsect3>
392

    
393
        <title>Version 5 to 10</title>
394

    
395
        <para>
396
          The method for passing data has changed from command line
397
          options to environment variables, so scripts should be
398
          modified to use these. For an example of how this can be
399
          done in a way compatible with both versions, feel free to
400
          look at the debootstrap instance's
401
          <filename>common.sh</filename> auxiliary script.
402
        </para>
403

    
404
        <para>
405
          Also, instances can have now a variable number of disks, not
406
          only two, and a variable number of NICs (instead of fixed
407
          one), so the scripts should deal with this. The biggest
408
          change is in the import/export, which are called once per
409
          disk, instead of once per instance.
410
        </para>
411

    
412
      </refsect3>
413

    
414
      <refsect3>
415
        <title>Version 4 to 5</title>
416
        <para>
417
          The <filename>rename</filename> script has been added. If
418
          you don't want to do any changes on the instances after a
419
          rename, you can migrate the OS definition to version 5 by
420
          creating the <filename>rename</filename> script simply as:
421
          <screen>
422
#!/bin/sh
423

    
424
exit 0
425
          </screen>
426
        </para>
427

    
428
        <para>Note that the script must be executable.</para>
429
      </refsect3>
430
    </refsect2>
431

    
432
    <!--
433
    <refsect2>
434

    
435
      <title>Export/import format</title>
436

    
437
      <para>
438
        It is up to the export and import scripts to define the format
439
        they use. It is only required for these two to work
440
        together. It is not recommended that
441
      </para>
442

    
443
    </refsect2>
444
    -->
445

    
446
  </refsect1>
447

    
448
  &footer;
449

    
450
</refentry>
451

    
452
<!-- Keep this comment at the end of the file
453
Local variables:
454
mode: sgml
455
sgml-omittag:t
456
sgml-shorttag:t
457
sgml-minimize-attributes:nil
458
sgml-always-quote-attributes:t
459
sgml-indent-step:2
460
sgml-indent-data:t
461
sgml-parent-document:nil
462
sgml-default-dtd-file:nil
463
sgml-exposed-tags:nil
464
sgml-local-catalogs:nil
465
sgml-local-ecat-files:nil
466
End:
467
-->