Statistics
| Branch: | Tag: | Revision:

root / man / ganeti-os-interface.rst @ fdd9ac5b

History | View | Annotate | Download (8.9 kB)

1 4db3647e Iustin Pop
ganeti-os-interface(7) Ganeti | Version @GANETI_VERSION@
2 4db3647e Iustin Pop
========================================================
3 4db3647e Iustin Pop
4 4db3647e Iustin Pop
Name
5 4db3647e Iustin Pop
----
6 4db3647e Iustin Pop
7 4db3647e Iustin Pop
ganeti-os-interface - Specifications for guest OS types
8 4db3647e Iustin Pop
9 4db3647e Iustin Pop
DESCRIPTION
10 4db3647e Iustin Pop
-----------
11 4db3647e Iustin Pop
12 4db3647e Iustin Pop
The method of supporting guest operating systems in Ganeti is to
13 4db3647e Iustin Pop
have, for each guest OS type, a directory containing a number of
14 4db3647e Iustin Pop
required files.
15 4db3647e Iustin Pop
16 4db3647e Iustin Pop
REFERENCE
17 4db3647e Iustin Pop
---------
18 4db3647e Iustin Pop
19 4db3647e Iustin Pop
There are six required files: *create*, *import*, *export*, *rename*
20 4db3647e Iustin Pop
(executables), *ganeti_api_version* and *variants.list* (text files).
21 4db3647e Iustin Pop
22 4db3647e Iustin Pop
Common environment
23 4db3647e Iustin Pop
~~~~~~~~~~~~~~~~~~
24 4db3647e Iustin Pop
25 4db3647e Iustin Pop
All commands will get their input via environment variables. A
26 4db3647e Iustin Pop
common set of variables will be exported for all commands, and some
27 4db3647e Iustin Pop
of them might have extra ones. Note that all counts are
28 4db3647e Iustin Pop
zero-based.
29 4db3647e Iustin Pop
30 4db3647e Iustin Pop
31 4db3647e Iustin Pop
32 4db3647e Iustin Pop
OS_API_VERSION
33 4db3647e Iustin Pop
    The OS API version that the rest of the environment conforms to.
34 4db3647e Iustin Pop
35 4db3647e Iustin Pop
INSTANCE_NAME
36 4db3647e Iustin Pop
    The instance name the script should operate on.
37 4db3647e Iustin Pop
38 4db3647e Iustin Pop
INSTANCE_OS, OS_NAME
39 4db3647e Iustin Pop
    Both names point to the name of the instance's OS as Ganeti knows
40 4db3647e Iustin Pop
    it. This can simplify the OS scripts by providing the same scripts
41 4db3647e Iustin Pop
    under multiple names, and then the scripts can use this name to
42 4db3647e Iustin Pop
    alter their behaviour.
43 4db3647e Iustin Pop
44 4db3647e Iustin Pop
    With OS API 15 changing the script behavior based on this variable
45 4db3647e Iustin Pop
    is deprecated: OS_VARIANT should be used instead (see below).
46 4db3647e Iustin Pop
47 4db3647e Iustin Pop
OS_VARIANT
48 4db3647e Iustin Pop
    The variant of the OS which should be installed. Each OS must
49 4db3647e Iustin Pop
    support all variants listed under its variants.list file, and may
50 4db3647e Iustin Pop
    support more. Any more supported variants should be properly
51 4db3647e Iustin Pop
    documented in the per-OS documentation.
52 4db3647e Iustin Pop
53 4db3647e Iustin Pop
HYPERVISOR
54 4db3647e Iustin Pop
    The hypervisor of this instance.
55 4db3647e Iustin Pop
56 4db3647e Iustin Pop
DISK_COUNT
57 4db3647e Iustin Pop
    The number of disks the instance has. The actual disk defitions are
58 4db3647e Iustin Pop
    in a set of additional variables. The instance's disk will be
59 4db3647e Iustin Pop
    numbered from 0 to this value minus one.
60 4db3647e Iustin Pop
61 4db3647e Iustin Pop
DISK_%N_PATH
62 4db3647e Iustin Pop
    The path to the storage for disk N of the instance. This might be
63 4db3647e Iustin Pop
    either a block device or a regular file, in which case the OS
64 4db3647e Iustin Pop
    scripts should use ``losetup`` (if they need to mount it). E.g. the
65 4db3647e Iustin Pop
    first disk of the instance might be exported as
66 4db3647e Iustin Pop
    ``DISK_0_PATH=/dev/drbd0``.
67 4db3647e Iustin Pop
68 4db3647e Iustin Pop
DISK_%N_ACCESS
69 4db3647e Iustin Pop
    This is how the hypervisor will export the instance disks: either
70 4db3647e Iustin Pop
    read-write (``rw``) or read-only (``ro``).
71 4db3647e Iustin Pop
72 4db3647e Iustin Pop
DISK_%N_FRONTEND_TYPE
73 4db3647e Iustin Pop
    (Optional) If applicable to the current hypervisor type: the type
74 4db3647e Iustin Pop
    of the device exported by the hypervisor. For example, the Xen HVM
75 4db3647e Iustin Pop
    hypervisor can export disks as either ``paravirtual`` or
76 4db3647e Iustin Pop
    ``ioemu``.
77 4db3647e Iustin Pop
78 4db3647e Iustin Pop
DISK_%N_BACKEND_TYPE
79 4db3647e Iustin Pop
    How files are visible on the node side. This can be either
80 4db3647e Iustin Pop
    ``block`` (when using block devices) or ``file:type``, where
81 4db3647e Iustin Pop
    ``type`` is either ``loop`` or ``blktap`` depending on how the
82 4db3647e Iustin Pop
    hypervisor will be configured.  Note that not all backend types
83 4db3647e Iustin Pop
    apply to all hypervisors.
84 4db3647e Iustin Pop
85 4db3647e Iustin Pop
NIC_COUNT
86 4db3647e Iustin Pop
    Similar to the ``DISK_COUNT``, this represents the number of NICs
87 4db3647e Iustin Pop
    of the instance.
88 4db3647e Iustin Pop
89 4db3647e Iustin Pop
NIC_%N_MAC
90 4db3647e Iustin Pop
    The MAC address associated with this interface.
91 4db3647e Iustin Pop
92 4db3647e Iustin Pop
NIC_%N_IP
93 4db3647e Iustin Pop
    The IP address, if any, associated with the N-th NIC of the
94 4db3647e Iustin Pop
    instance.
95 4db3647e Iustin Pop
96 4db3647e Iustin Pop
NIC_%N_MODE
97 4db3647e Iustin Pop
    The NIC mode, either routed or bridged
98 4db3647e Iustin Pop
99 4db3647e Iustin Pop
NIC_%N_BRIDGE
100 4db3647e Iustin Pop
    The bridge to which this NIC will be attached. This variable is
101 4db3647e Iustin Pop
    defined only when the NIC is in bridged mode.
102 4db3647e Iustin Pop
103 4db3647e Iustin Pop
NIC_%N_LINK
104 4db3647e Iustin Pop
    If the NIC is in bridged mode, this is the same as
105 4db3647e Iustin Pop
    ``NIC_%N_BRIDGE``.  If it is in routed mode, the routing table
106 4db3647e Iustin Pop
    which will be used by the hypervisor to insert the appropriate
107 4db3647e Iustin Pop
    routes.
108 4db3647e Iustin Pop
109 4db3647e Iustin Pop
NIC_%N_FRONTEND_TYPE
110 4db3647e Iustin Pop
    (Optional) If applicable, the type of the exported NIC to the
111 4db3647e Iustin Pop
    instance, this can be one of: ``rtl8139``, ``ne2k_pci``,
112 4db3647e Iustin Pop
    ``ne2k_isa``, ``paravirtual``.
113 4db3647e Iustin Pop
114 4db3647e Iustin Pop
DEBUG_LEVEL
115 4db3647e Iustin Pop
    If non-zero, this should cause the OS script to generate verbose
116 4db3647e Iustin Pop
    logs of its execution, for troubleshooting purposes. Currently
117 4db3647e Iustin Pop
    only ``0`` and ``1`` are valid values.
118 4db3647e Iustin Pop
119 4db3647e Iustin Pop
120 4db3647e Iustin Pop
create
121 4db3647e Iustin Pop
~~~~~~
122 4db3647e Iustin Pop
123 4db3647e Iustin Pop
The **create** command is used for creating a new instance from
124 4db3647e Iustin Pop
scratch. It has no additional environment variables bside the
125 4db3647e Iustin Pop
common ones.
126 4db3647e Iustin Pop
127 4db3647e Iustin Pop
The ``INSTANCE_NAME`` variable denotes the name of the instance,
128 4db3647e Iustin Pop
which is guaranteed to resolve to an IP address. The create script
129 4db3647e Iustin Pop
should configure the instance according to this name. It can
130 4db3647e Iustin Pop
configure the IP statically or not, depending on the deployment
131 4db3647e Iustin Pop
environment.
132 4db3647e Iustin Pop
133 4db3647e Iustin Pop
The ``INSTANCE_REINSTALL`` variable is set to ``1`` when this create
134 4db3647e Iustin Pop
request is reinstalling and existing instance, rather than creating
135 4db3647e Iustin Pop
one anew. This can be used, for example, to preserve some data in the
136 4db3647e Iustin Pop
old instance in an OS-specific way.
137 4db3647e Iustin Pop
138 4db3647e Iustin Pop
export
139 4db3647e Iustin Pop
~~~~~~
140 4db3647e Iustin Pop
141 4db3647e Iustin Pop
This command is used in order to make a backup of a given disk of
142 4db3647e Iustin Pop
the instance. The command should write to stdout a dump of the
143 4db3647e Iustin Pop
given block device. The output of this program will be passed
144 4db3647e Iustin Pop
during restore to the **import** command.
145 4db3647e Iustin Pop
146 4db3647e Iustin Pop
The specific disk to backup is denoted by two additional environment
147 4db3647e Iustin Pop
variables: ``EXPORT_INDEX`` which denotes the index in the instance
148 4db3647e Iustin Pop
disks structure (and could be used for example to skip the second disk
149 4db3647e Iustin Pop
if not needed for backup) and ``EXPORT_PATH`` which has the same value
150 4db3647e Iustin Pop
as ``DISK_N_PATH`` but is duplicate here for easier usage by shell
151 4db3647e Iustin Pop
scripts (rather than parse the ``DISK_...`` variables).
152 4db3647e Iustin Pop
153 4db3647e Iustin Pop
To provide the user with an estimate on how long the export will take,
154 4db3647e Iustin Pop
a predicted size can be written to the file descriptor passed in the
155 4db3647e Iustin Pop
variable ``EXP_SIZE_FD``. The value is in bytes and must be terminated
156 4db3647e Iustin Pop
by a newline character (``\n``). Older versions of Ganeti don't
157 4db3647e Iustin Pop
support this feature, hence the variable should be checked before
158 4db3647e Iustin Pop
use. Example::
159 4db3647e Iustin Pop
160 4db3647e Iustin Pop
    if test -n "$EXP_SIZE_FD"; then
161 4db3647e Iustin Pop
      blockdev --getsize64 $blockdev >&$EXP_SIZE_FD
162 4db3647e Iustin Pop
    fi
163 4db3647e Iustin Pop
164 4db3647e Iustin Pop
import
165 4db3647e Iustin Pop
~~~~~~
166 4db3647e Iustin Pop
167 4db3647e Iustin Pop
The **import** command is used for restoring an instance from a
168 4db3647e Iustin Pop
backup as done by **export**. The arguments are the similar to
169 4db3647e Iustin Pop
those passed to **export**, whose output will be provided on
170 4db3647e Iustin Pop
stdin.
171 4db3647e Iustin Pop
172 4db3647e Iustin Pop
The difference in variables is that the current disk is called by
173 4db3647e Iustin Pop
``IMPORT_DEVICE`` and ``IMPORT_INDEX`` (instead of ``EXPORT_...``).
174 4db3647e Iustin Pop
175 4db3647e Iustin Pop
rename
176 4db3647e Iustin Pop
~~~~~~
177 4db3647e Iustin Pop
178 4db3647e Iustin Pop
This command is used in order to perform a rename at the instance
179 4db3647e Iustin Pop
OS level, after the instance has been renamed in Ganeti. The
180 4db3647e Iustin Pop
command should do whatever steps are required to ensure that the
181 4db3647e Iustin Pop
instance is updated to use the new name, if the operating system
182 4db3647e Iustin Pop
supports it.
183 4db3647e Iustin Pop
184 4db3647e Iustin Pop
Note that it is acceptable for the rename script to do nothing at
185 4db3647e Iustin Pop
all, however be warned that in this case, there will be a
186 4db3647e Iustin Pop
desynchronization between what gnt-instance list shows you and the
187 4db3647e Iustin Pop
actual hostname of the instance.
188 4db3647e Iustin Pop
189 4db3647e Iustin Pop
The script will be passed one additional environment variable
190 4db3647e Iustin Pop
called ``OLD_INSTANCE_NAME`` which holds the old instance name. The
191 4db3647e Iustin Pop
``INSTANCE_NAME`` variable holds the new instance name.
192 4db3647e Iustin Pop
193 4db3647e Iustin Pop
A very simple rename script should at least change the hostname and
194 4db3647e Iustin Pop
IP address of the instance, leaving the administrator to update the
195 4db3647e Iustin Pop
other services.
196 4db3647e Iustin Pop
197 4db3647e Iustin Pop
ganeti_api_version
198 4db3647e Iustin Pop
~~~~~~~~~~~~~~~~~~
199 4db3647e Iustin Pop
200 4db3647e Iustin Pop
The ganeti_api_version file is a plain text file containing the
201 4db3647e Iustin Pop
version(s) of the guest OS API that this OS definition complies
202 4db3647e Iustin Pop
with, one per line. The version documented by this man page is 15,
203 4db3647e Iustin Pop
so this file must contain the number 15 followed by a newline if
204 4db3647e Iustin Pop
only this version is supported. A script compatible with more than
205 4db3647e Iustin Pop
one Ganeti version should contain the most recent version first
206 4db3647e Iustin Pop
(i.e. 15), followed by the old version(s) (in this case 10 and/or
207 4db3647e Iustin Pop
5).
208 4db3647e Iustin Pop
209 4db3647e Iustin Pop
variants.list
210 4db3647e Iustin Pop
~~~~~~~~~~~~~
211 4db3647e Iustin Pop
212 4db3647e Iustin Pop
variants.list is a plain text file containing all the declared
213 4db3647e Iustin Pop
supported variants for this OS, one per line. At least one variant
214 4db3647e Iustin Pop
must be supported.
215 4db3647e Iustin Pop
216 4db3647e Iustin Pop
NOTES
217 4db3647e Iustin Pop
-----
218 4db3647e Iustin Pop
219 4db3647e Iustin Pop
Backwards compatibility
220 4db3647e Iustin Pop
~~~~~~~~~~~~~~~~~~~~~~~
221 4db3647e Iustin Pop
222 4db3647e Iustin Pop
Ganeti 2.2 is compatible with both API version 10, and 15. In API
223 4db3647e Iustin Pop
version 10 the variants.list file is ignored and no OS_VARIANT
224 4db3647e Iustin Pop
environment variable is passed.
225 4db3647e Iustin Pop
226 4db3647e Iustin Pop
Common behaviour
227 4db3647e Iustin Pop
~~~~~~~~~~~~~~~~
228 4db3647e Iustin Pop
229 4db3647e Iustin Pop
All the scripts should display an usage message when called with a
230 4db3647e Iustin Pop
wrong number of arguments or when the first argument is ``-h`` or
231 4db3647e Iustin Pop
``--help``.
232 4db3647e Iustin Pop
233 4db3647e Iustin Pop
Upgrading from old versions
234 4db3647e Iustin Pop
~~~~~~~~~~~~~~~~~~~~~~~~~~~
235 4db3647e Iustin Pop
236 4db3647e Iustin Pop
Version 10 to 15
237 4db3647e Iustin Pop
^^^^^^^^^^^^^^^^
238 4db3647e Iustin Pop
239 4db3647e Iustin Pop
The ``variants.list`` file has been added, so OSes should support at
240 4db3647e Iustin Pop
least one variant, declaring it in that file and must be prepared to
241 4db3647e Iustin Pop
parse the OS_VARIANT environment variable. OSes are free to support
242 4db3647e Iustin Pop
more variants than just the declared ones.
243 4db3647e Iustin Pop
244 4db3647e Iustin Pop
Version 5 to 10
245 4db3647e Iustin Pop
^^^^^^^^^^^^^^^
246 4db3647e Iustin Pop
247 4db3647e Iustin Pop
The method for passing data has changed from command line options
248 4db3647e Iustin Pop
to environment variables, so scripts should be modified to use
249 4db3647e Iustin Pop
these. For an example of how this can be done in a way compatible
250 4db3647e Iustin Pop
with both versions, feel free to look at the debootstrap instance's
251 4db3647e Iustin Pop
common.sh auxiliary script.
252 4db3647e Iustin Pop
253 4db3647e Iustin Pop
Also, instances can have now a variable number of disks, not only
254 4db3647e Iustin Pop
two, and a variable number of NICs (instead of fixed one), so the
255 4db3647e Iustin Pop
scripts should deal with this. The biggest change is in the
256 4db3647e Iustin Pop
import/export, which are called once per disk, instead of once per
257 4db3647e Iustin Pop
instance.
258 4db3647e Iustin Pop
259 4db3647e Iustin Pop
Version 4 to 5
260 4db3647e Iustin Pop
^^^^^^^^^^^^^^
261 4db3647e Iustin Pop
262 4db3647e Iustin Pop
The rename script has been added. If you don't want to do any
263 4db3647e Iustin Pop
changes on the instances after a rename, you can migrate the OS
264 4db3647e Iustin Pop
definition to version 5 by creating the rename script simply as::
265 4db3647e Iustin Pop
266 4db3647e Iustin Pop
    #!/bin/sh
267 4db3647e Iustin Pop
268 4db3647e Iustin Pop
    exit 0
269 4db3647e Iustin Pop
270 4db3647e Iustin Pop
Note that the script must be executable.