Statistics
| Branch: | Tag: | Revision:

root / man / ganeti-os-interface.sgml @ 231db3a5

History | View | Annotate | Download (15.2 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>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">
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
      <holder>Google Inc.</holder>
26
    </copyright>
27
    &dhdate;
28
  </refentryinfo>
29
  <refmeta>
30
    &dhucpackage;
31

    
32
    &dhsection;
33
    <refmiscinfo>ganeti 2.1</refmiscinfo>
34
  </refmeta>
35
  <refnamediv>
36
    <refname>ganeti-os-interface</refname>
37

    
38
    <refpurpose>specifications for guest OS types
39
    </refpurpose>
40

    
41
  </refnamediv>
42

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

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

    
52

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

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

    
65
    <refsect2>
66
      <title>Common environment</title>
67
      <para>
68
        All commands will get their input via environment variables. A
69
        common set of variables will be exported for all commands, and
70
        some of them might have extra ones. Note that all counts are
71
        zero-based.
72
      </para>
73
      <variablelist>
74
        <varlistentry>
75
          <term>OS_API_VERSION</term>
76
          <listitem>
77
            <simpara>The OS api version that the rest of the
78
            environment conforms to.</simpara>
79
          </listitem>
80
        </varlistentry>
81
        <varlistentry>
82
          <term>INSTANCE_NAME</term>
83
          <listitem>
84
            <simpara>The instance name the script should operate
85
            on.</simpara>
86
          </listitem>
87
        </varlistentry>
88
        <varlistentry>
89
          <term>INSTANCE_OS</term>
90
          <listitem>
91
            <simpara>The name os the instance's OS as Ganeti knows
92
            it. This can simplify the OS scripts by providing the same
93
            scripts under multiple names, and then the scripts can use
94
            this name to alter their behaviour.</simpara>
95
            <simpara>Under OS api 15 changing the script behavior based
96
            on this variable is deprecated: OS_VARIANT should be used
97
            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
    </refsect2>
262

    
263
    <refsect2>
264
      <title>import</title>
265

    
266
      <para>
267
        The <command>import</command> command is used for restoring an
268
        instance from a backup as done by
269
        <command>export</command>. The arguments are the similar to
270
        those passed to <command>export</command>, whose output will
271
        be provided on <acronym>stdin</acronym>.
272
      </para>
273

    
274
      <para>
275
        The difference in variables is that the current disk is called
276
        by <envar>IMPORT_DEVICE</envar> and <envar>IMPORT_IDX</envar>
277
        (instead of <emphasis>EXPORT_</emphasis>).
278
      </para>
279

    
280
    </refsect2>
281

    
282
    <refsect2>
283
      <title>rename</title>
284

    
285
      <para>
286
        This command is used in order to perform a rename at the
287
        instance OS level, after the instance has been renamed in
288
        Ganeti. The command should do whatever steps are required to
289
        ensure that the instance is updated to use the new name, if
290
        the operating system supports it.
291
      </para>
292

    
293
      <para>
294
        Note that it is acceptable for the rename script to do nothing
295
        at all, however be warned that in this case, there will be a
296
        desynchronization between what <computeroutput>gnt-instance
297
        list</computeroutput> shows you and the actual hostname of the
298
        instance.
299
      </para>
300

    
301
      <para>The script will be passed one additional environment
302
      variable called <envar>OLD_INSTANCE_NAME</envar> which holds the
303
      old instance name. The <envar>INSTANCE_NAME</envar> variable
304
      holds the new instance name.</para>
305

    
306
      <para>
307
        A very simple rename script should at least change the
308
        hostname and IP address of the instance, leaving the
309
        administrator to update the other services.
310
      </para>
311
    </refsect2>
312

    
313
    <refsect2>
314
      <title>ganeti_api_version</title>
315
      <para>
316
        The <filename>ganeti_api_version</filename> file is a plain
317
        text file containing the version(s) of the guest OS api that
318
        this OS definition complies with, one per line. The version
319
        documented by this man page is 15, so this file must contain
320
        the number 15 followed by a newline if only this version is
321
        supported. A script compatible more than one ganeti version
322
        should contain the most recent version first (i.e. 15),
323
        followed by the old version(s) (in this case 10 and/or 5).
324
      </para>
325
    </refsect2>
326

    
327
    <refsect2>
328
      <title>variants.list</title>
329
      <para>
330
        <filename>variants.list</filename> is a plain text file
331
        containing all the declared supported variants for this
332
        OS, one per line. At least one variant must be supported.
333
      </para>
334
    </refsect2>
335

    
336
  </refsect1>
337

    
338
  <refsect1>
339
    <title>NOTES</title>
340

    
341
    <refsect2>
342
      <title>Retrocompatibility</title>
343

    
344
      <para>
345
        Ganeti 2.1 is compatible with both api version 10, and 15.
346
        In api version 10 the <filename>variants.list</filename>
347
        file is ignored and no OS_VARIANT environment variable is
348
        passed.
349
      </para>
350
    </refsect2>
351

    
352
    <refsect2>
353
      <title>Common behaviour</title>
354

    
355
      <para>All the scripts should display an usage message when
356
      called with a wrong number of arguments or when the first
357
      argument is <option>-h</option> or
358
      <option>--help</option>.</para>
359

    
360
    </refsect2>
361

    
362
    <refsect2>
363
      <title>Upgrading from old versions</title>
364
      <refsect3>
365

    
366
        <title>Version 10 to 15</title>
367

    
368
        <para>
369
          The <filename>variants.list</filename> file has been
370
          added, so OSes should support at least one variant,
371
          declaring it in that file and must be prepared to parse
372
          the OS_VARIANT environment variable. OSes are free to
373
          support more variants than just the declared ones.
374
        </para>
375

    
376
      </refsect3>
377

    
378
      <refsect3>
379

    
380
        <title>Version 5 to 10</title>
381

    
382
        <para>
383
          The method os passing data has changed from command line
384
          options to environment variables, so scripts should be
385
          modified to use these. For an example of how this can be
386
          done in a way compatible with both versions, feel free to
387
          look at the debootstrap instance's
388
          <filename>common.sh</filename> auxiliary script.
389
        </para>
390

    
391
        <para>
392
          Also, instances can have now a variable number of disks, not
393
          only two, and a variable number of NICs (instead of fixed
394
          one), so the scripts should deal with this. The biggest
395
          change is in the import/export, which are called once per
396
          disk, instead of once per instance.
397
        </para>
398

    
399
      </refsect3>
400

    
401
      <refsect3>
402
        <title>Version 4 to 5</title>
403
        <para>
404
          The <filename>rename</filename> script has been added. If
405
          you don't want to do any changes on the instances after a
406
          rename, you can migrate the OS definition to version 5 by
407
          creating the <filename>rename</filename> script simply as:
408
          <screen>
409
#!/bin/sh
410

    
411
exit 0
412
          </screen>
413
        </para>
414

    
415
        <para>Note that the script must be executable.</para>
416
      </refsect3>
417
    </refsect2>
418

    
419
    <!--
420
    <refsect2>
421

    
422
      <title>Export/import format</title>
423

    
424
      <para>
425
        It is up to the export and import scripts to define the format
426
        they use. It is only required for these two to work
427
        together. It is not recommended that
428
      </para>
429

    
430
    </refsect2>
431
    -->
432

    
433
  </refsect1>
434

    
435
  &footer;
436

    
437
</refentry>
438

    
439
<!-- Keep this comment at the end of the file
440
Local variables:
441
mode: sgml
442
sgml-omittag:t
443
sgml-shorttag:t
444
sgml-minimize-attributes:nil
445
sgml-always-quote-attributes:t
446
sgml-indent-step:2
447
sgml-indent-data:t
448
sgml-parent-document:nil
449
sgml-default-dtd-file:nil
450
sgml-exposed-tags:nil
451
sgml-local-catalogs:nil
452
sgml-local-ecat-files:nil
453
End:
454
-->