Statistics
| Branch: | Tag: | Revision:

root / doc / hooks.rst @ 8fa74099

History | View | Annotate | Download (21 kB)

1 4d6443f4 Iustin Pop
Ganeti customisation using hooks
2 4d6443f4 Iustin Pop
================================
3 4d6443f4 Iustin Pop
4 aff49a15 Iustin Pop
Documents Ganeti version 2.6
5 4d6443f4 Iustin Pop
6 4d6443f4 Iustin Pop
.. contents::
7 4d6443f4 Iustin Pop
8 4d6443f4 Iustin Pop
Introduction
9 4d6443f4 Iustin Pop
------------
10 4d6443f4 Iustin Pop
11 db620e95 Michael Hanselmann
In order to allow customisation of operations, Ganeti runs scripts in
12 db620e95 Michael Hanselmann
sub-directories of ``@SYSCONFDIR@/ganeti/hooks``. These sub-directories
13 db620e95 Michael Hanselmann
are named ``$hook-$phase.d``, where ``$phase`` is either ``pre`` or
14 db620e95 Michael Hanselmann
``post`` and ``$hook`` matches the directory name given for a hook (e.g.
15 db620e95 Michael Hanselmann
``cluster-verify-post.d`` or ``node-add-pre.d``).
16 4d6443f4 Iustin Pop
17 4d6443f4 Iustin Pop
This is similar to the ``/etc/network/`` structure present in Debian
18 4d6443f4 Iustin Pop
for network interface handling.
19 4d6443f4 Iustin Pop
20 4d6443f4 Iustin Pop
Organisation
21 4d6443f4 Iustin Pop
------------
22 4d6443f4 Iustin Pop
23 4d6443f4 Iustin Pop
For every operation, two sets of scripts are run:
24 4d6443f4 Iustin Pop
25 4d6443f4 Iustin Pop
- pre phase (for authorization/checking)
26 4d6443f4 Iustin Pop
- post phase (for logging)
27 4d6443f4 Iustin Pop
28 4d6443f4 Iustin Pop
Also, for each operation, the scripts are run on one or more nodes,
29 4d6443f4 Iustin Pop
depending on the operation type.
30 4d6443f4 Iustin Pop
31 4d6443f4 Iustin Pop
Note that, even though we call them scripts, we are actually talking
32 4d6443f4 Iustin Pop
about any executable.
33 4d6443f4 Iustin Pop
34 4d6443f4 Iustin Pop
*pre* scripts
35 4d6443f4 Iustin Pop
~~~~~~~~~~~~~
36 4d6443f4 Iustin Pop
37 4d6443f4 Iustin Pop
The *pre* scripts have a definite target: to check that the operation
38 4d6443f4 Iustin Pop
is allowed given the site-specific constraints. You could have, for
39 4d6443f4 Iustin Pop
example, a rule that says every new instance is required to exists in
40 4d6443f4 Iustin Pop
a database; to implement this, you could write a script that checks
41 4d6443f4 Iustin Pop
the new instance parameters against your database.
42 4d6443f4 Iustin Pop
43 4d6443f4 Iustin Pop
The objective of these scripts should be their return code (zero or
44 4d6443f4 Iustin Pop
non-zero for success and failure). However, if they modify the
45 4d6443f4 Iustin Pop
environment in any way, they should be idempotent, as failed
46 4d6443f4 Iustin Pop
executions could be restarted and thus the script(s) run again with
47 4d6443f4 Iustin Pop
exactly the same parameters.
48 4d6443f4 Iustin Pop
49 4d6443f4 Iustin Pop
Note that if a node is unreachable at the time a hooks is run, this
50 4d6443f4 Iustin Pop
will not be interpreted as a deny for the execution. In other words,
51 4d6443f4 Iustin Pop
only an actual error returned from a script will cause abort, and not
52 4d6443f4 Iustin Pop
an unreachable node.
53 4d6443f4 Iustin Pop
54 4d6443f4 Iustin Pop
Therefore, if you want to guarantee that a hook script is run and
55 4d6443f4 Iustin Pop
denies an action, it's best to put it on the master node.
56 4d6443f4 Iustin Pop
57 4d6443f4 Iustin Pop
*post* scripts
58 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~
59 4d6443f4 Iustin Pop
60 4d6443f4 Iustin Pop
These scripts should do whatever you need as a reaction to the
61 4d6443f4 Iustin Pop
completion of an operation. Their return code is not checked (but
62 4d6443f4 Iustin Pop
logged), and they should not depend on the fact that the *pre* scripts
63 4d6443f4 Iustin Pop
have been run.
64 4d6443f4 Iustin Pop
65 4d6443f4 Iustin Pop
Naming
66 4d6443f4 Iustin Pop
~~~~~~
67 4d6443f4 Iustin Pop
68 dd7f6776 Michael Hanselmann
The allowed names for the scripts consist of (similar to *run-parts*)
69 4d6443f4 Iustin Pop
upper and lower case, digits, underscores and hyphens. In other words,
70 4d6443f4 Iustin Pop
the regexp ``^[a-zA-Z0-9_-]+$``. Also, non-executable scripts will be
71 4d6443f4 Iustin Pop
ignored.
72 4d6443f4 Iustin Pop
73 4d6443f4 Iustin Pop
74 4d6443f4 Iustin Pop
Order of execution
75 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~
76 4d6443f4 Iustin Pop
77 4d6443f4 Iustin Pop
On a single node, the scripts in a directory are run in lexicographic
78 4d6443f4 Iustin Pop
order (more exactly, the python string comparison order). It is
79 4d6443f4 Iustin Pop
advisable to implement the usual *NN-name* convention where *NN* is a
80 4d6443f4 Iustin Pop
two digit number.
81 4d6443f4 Iustin Pop
82 4d6443f4 Iustin Pop
For an operation whose hooks are run on multiple nodes, there is no
83 4d6443f4 Iustin Pop
specific ordering of nodes with regard to hooks execution; you should
84 4d6443f4 Iustin Pop
assume that the scripts are run in parallel on the target nodes
85 4d6443f4 Iustin Pop
(keeping on each node the above specified ordering).  If you need any
86 4d6443f4 Iustin Pop
kind of inter-node synchronisation, you have to implement it yourself
87 4d6443f4 Iustin Pop
in the scripts.
88 4d6443f4 Iustin Pop
89 4d6443f4 Iustin Pop
Execution environment
90 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~~~~
91 4d6443f4 Iustin Pop
92 4d6443f4 Iustin Pop
The scripts will be run as follows:
93 4d6443f4 Iustin Pop
94 4d6443f4 Iustin Pop
- no command line arguments
95 4d6443f4 Iustin Pop
96 4d6443f4 Iustin Pop
- no controlling *tty*
97 4d6443f4 Iustin Pop
98 4d6443f4 Iustin Pop
- stdin is actually */dev/null*
99 4d6443f4 Iustin Pop
100 4d6443f4 Iustin Pop
- stdout and stderr are directed to files
101 4d6443f4 Iustin Pop
102 fe5ca2bb Andrea Spadaccini
- PATH is reset to :pyeval:`constants.HOOKS_PATH`
103 4d6443f4 Iustin Pop
104 4d6443f4 Iustin Pop
- the environment is cleared, and only ganeti-specific variables will
105 4d6443f4 Iustin Pop
  be left
106 4d6443f4 Iustin Pop
107 4d6443f4 Iustin Pop
108 5bbd3f7f Michael Hanselmann
All information about the cluster is passed using environment
109 4d6443f4 Iustin Pop
variables. Different operations will have sligthly different
110 4d6443f4 Iustin Pop
environments, but most of the variables are common.
111 4d6443f4 Iustin Pop
112 4d6443f4 Iustin Pop
Operation list
113 4d6443f4 Iustin Pop
--------------
114 4d6443f4 Iustin Pop
115 4d6443f4 Iustin Pop
Node operations
116 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~
117 4d6443f4 Iustin Pop
118 8ac5c5d7 Michael Hanselmann
OP_NODE_ADD
119 4d6443f4 Iustin Pop
+++++++++++
120 4d6443f4 Iustin Pop
121 4d6443f4 Iustin Pop
Adds a node to the cluster.
122 4d6443f4 Iustin Pop
123 4d6443f4 Iustin Pop
:directory: node-add
124 49e4c837 David Knowles
:env. vars: NODE_NAME, NODE_PIP, NODE_SIP, MASTER_CAPABLE, VM_CAPABLE
125 4d6443f4 Iustin Pop
:pre-execution: all existing nodes
126 4d6443f4 Iustin Pop
:post-execution: all nodes plus the new node
127 4d6443f4 Iustin Pop
128 4d6443f4 Iustin Pop
129 8ac5c5d7 Michael Hanselmann
OP_NODE_REMOVE
130 4d6443f4 Iustin Pop
++++++++++++++
131 4d6443f4 Iustin Pop
132 7faf5110 Michael Hanselmann
Removes a node from the cluster. On the removed node the hooks are
133 7faf5110 Michael Hanselmann
called during the execution of the operation and not after its
134 7faf5110 Michael Hanselmann
completion.
135 4d6443f4 Iustin Pop
136 4d6443f4 Iustin Pop
:directory: node-remove
137 4d6443f4 Iustin Pop
:env. vars: NODE_NAME
138 4d6443f4 Iustin Pop
:pre-execution: all existing nodes except the removed node
139 cd46f3b4 Luca Bigliardi
:post-execution: all existing nodes
140 4d6443f4 Iustin Pop
141 4d6443f4 Iustin Pop
OP_NODE_SET_PARAMS
142 4d6443f4 Iustin Pop
++++++++++++++++++
143 4d6443f4 Iustin Pop
144 4d6443f4 Iustin Pop
Changes a node's parameters.
145 4d6443f4 Iustin Pop
146 4d6443f4 Iustin Pop
:directory: node-modify
147 49e4c837 David Knowles
:env. vars: MASTER_CANDIDATE, OFFLINE, DRAINED, MASTER_CAPABLE, VM_CAPABLE
148 4d6443f4 Iustin Pop
:pre-execution: master node, the target node
149 4d6443f4 Iustin Pop
:post-execution: master node, the target node
150 4d6443f4 Iustin Pop
151 6c6b7f8a Michael Hanselmann
OP_NODE_MIGRATE
152 6c6b7f8a Michael Hanselmann
++++++++++++++++
153 6c6b7f8a Michael Hanselmann
154 6c6b7f8a Michael Hanselmann
Relocate secondary instances from a node.
155 6c6b7f8a Michael Hanselmann
156 6c6b7f8a Michael Hanselmann
:directory: node-migrate
157 6c6b7f8a Michael Hanselmann
:env. vars: NODE_NAME
158 6c6b7f8a Michael Hanselmann
:pre-execution: master node
159 6c6b7f8a Michael Hanselmann
:post-execution: master node
160 6c6b7f8a Michael Hanselmann
161 4d6443f4 Iustin Pop
162 b1ee5610 Adeodato Simo
Node group operations
163 b1ee5610 Adeodato Simo
~~~~~~~~~~~~~~~~~~~~~
164 b1ee5610 Adeodato Simo
165 8ac5c5d7 Michael Hanselmann
OP_GROUP_ADD
166 b1ee5610 Adeodato Simo
++++++++++++
167 b1ee5610 Adeodato Simo
168 b1ee5610 Adeodato Simo
Adds a node group to the cluster.
169 b1ee5610 Adeodato Simo
170 b1ee5610 Adeodato Simo
:directory: group-add
171 b1ee5610 Adeodato Simo
:env. vars: GROUP_NAME
172 b1ee5610 Adeodato Simo
:pre-execution: master node
173 b1ee5610 Adeodato Simo
:post-execution: master node
174 b1ee5610 Adeodato Simo
175 90e99856 Adeodato Simo
OP_GROUP_SET_PARAMS
176 90e99856 Adeodato Simo
+++++++++++++++++++
177 90e99856 Adeodato Simo
178 90e99856 Adeodato Simo
Changes a node group's parameters.
179 90e99856 Adeodato Simo
180 90e99856 Adeodato Simo
:directory: group-modify
181 90e99856 Adeodato Simo
:env. vars: GROUP_NAME, NEW_ALLOC_POLICY
182 90e99856 Adeodato Simo
:pre-execution: master node
183 90e99856 Adeodato Simo
:post-execution: master node
184 90e99856 Adeodato Simo
185 8ac5c5d7 Michael Hanselmann
OP_GROUP_REMOVE
186 94bd652a Adeodato Simo
+++++++++++++++
187 94bd652a Adeodato Simo
188 94bd652a Adeodato Simo
Removes a node group from the cluster. Since the node group must be
189 94bd652a Adeodato Simo
empty for removal to succeed, the concept of "nodes in the group" does
190 94bd652a Adeodato Simo
not exist, and the hook is only executed in the master node.
191 94bd652a Adeodato Simo
192 94bd652a Adeodato Simo
:directory: group-remove
193 94bd652a Adeodato Simo
:env. vars: GROUP_NAME
194 94bd652a Adeodato Simo
:pre-execution: master node
195 94bd652a Adeodato Simo
:post-execution: master node
196 94bd652a Adeodato Simo
197 8ac5c5d7 Michael Hanselmann
OP_GROUP_RENAME
198 4fe5cf90 Adeodato Simo
+++++++++++++++
199 4fe5cf90 Adeodato Simo
200 4fe5cf90 Adeodato Simo
Renames a node group.
201 4fe5cf90 Adeodato Simo
202 4fe5cf90 Adeodato Simo
:directory: group-rename
203 4fe5cf90 Adeodato Simo
:env. vars: OLD_NAME, NEW_NAME
204 4fe5cf90 Adeodato Simo
:pre-execution: master node and all nodes in the group
205 4fe5cf90 Adeodato Simo
:post-execution: master node and all nodes in the group
206 4fe5cf90 Adeodato Simo
207 08f8c82c Michael Hanselmann
OP_GROUP_EVACUATE
208 08f8c82c Michael Hanselmann
+++++++++++++++++
209 08f8c82c Michael Hanselmann
210 08f8c82c Michael Hanselmann
Evacuates a node group.
211 08f8c82c Michael Hanselmann
212 08f8c82c Michael Hanselmann
:directory: group-evacuate
213 08f8c82c Michael Hanselmann
:env. vars: GROUP_NAME, TARGET_GROUPS
214 08f8c82c Michael Hanselmann
:pre-execution: master node and all nodes in the group
215 08f8c82c Michael Hanselmann
:post-execution: master node and all nodes in the group
216 08f8c82c Michael Hanselmann
217 6e8091f9 Dimitris Aragiorgis
Network operations
218 6e8091f9 Dimitris Aragiorgis
~~~~~~~~~~~~~~~~~~
219 6e8091f9 Dimitris Aragiorgis
220 6e8091f9 Dimitris Aragiorgis
OP_NETWORK_ADD
221 6e8091f9 Dimitris Aragiorgis
++++++++++++++
222 6e8091f9 Dimitris Aragiorgis
223 6e8091f9 Dimitris Aragiorgis
Adds a network to the cluster.
224 6e8091f9 Dimitris Aragiorgis
225 6e8091f9 Dimitris Aragiorgis
:directory: network-add
226 6e8091f9 Dimitris Aragiorgis
:env. vars: NETWORK_NAME, NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
227 6e8091f9 Dimitris Aragiorgis
            NETWORK_GATEWAY6, NETWORK_TYPE, NETWORK_MAC_PREFIX, NETWORK_TAGS
228 6e8091f9 Dimitris Aragiorgis
:pre-execution: master node
229 6e8091f9 Dimitris Aragiorgis
:post-execution: master node
230 6e8091f9 Dimitris Aragiorgis
231 6e8091f9 Dimitris Aragiorgis
OP_NETWORK_REMOVE
232 6e8091f9 Dimitris Aragiorgis
+++++++++++++++++
233 6e8091f9 Dimitris Aragiorgis
234 6e8091f9 Dimitris Aragiorgis
Removes a network from the cluster.
235 6e8091f9 Dimitris Aragiorgis
236 6e8091f9 Dimitris Aragiorgis
:directory: network-remove
237 6e8091f9 Dimitris Aragiorgis
:env. vars: NETWORK_NAME
238 6e8091f9 Dimitris Aragiorgis
:pre-execution: master node
239 6e8091f9 Dimitris Aragiorgis
:post-execution: master node
240 6e8091f9 Dimitris Aragiorgis
241 6e8091f9 Dimitris Aragiorgis
OP_NETWORK_CONNECT
242 6e8091f9 Dimitris Aragiorgis
++++++++++++++++++
243 6e8091f9 Dimitris Aragiorgis
244 6e8091f9 Dimitris Aragiorgis
Connects a network to a nodegroup.
245 6e8091f9 Dimitris Aragiorgis
246 6e8091f9 Dimitris Aragiorgis
:directory: network-connect
247 6e8091f9 Dimitris Aragiorgis
:env. vars: GROUP_NAME, NETWORK_NAME,
248 6e8091f9 Dimitris Aragiorgis
            GROUP_NETWORK_MODE, GROUP_NETWORK_LINK,
249 6e8091f9 Dimitris Aragiorgis
            NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
250 6e8091f9 Dimitris Aragiorgis
            NETWORK_GATEWAY6, NETWORK_TYPE, NETWORK_MAC_PREFIX, NETWORK_TAGS
251 6e8091f9 Dimitris Aragiorgis
:pre-execution: nodegroup nodes
252 6e8091f9 Dimitris Aragiorgis
:post-execution: nodegroup nodes
253 6e8091f9 Dimitris Aragiorgis
254 6e8091f9 Dimitris Aragiorgis
255 6e8091f9 Dimitris Aragiorgis
OP_NETWORK_DISCONNECT
256 6e8091f9 Dimitris Aragiorgis
+++++++++++++++++++++
257 6e8091f9 Dimitris Aragiorgis
258 6e8091f9 Dimitris Aragiorgis
Disconnects a network from a nodegroup.
259 6e8091f9 Dimitris Aragiorgis
260 6e8091f9 Dimitris Aragiorgis
:directory: network-disconnect
261 6e8091f9 Dimitris Aragiorgis
:env. vars: GROUP_NAME, NETWORK_NAME,
262 6e8091f9 Dimitris Aragiorgis
            GROUP_NETWORK_MODE, GROUP_NETWORK_LINK,
263 6e8091f9 Dimitris Aragiorgis
            NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
264 6e8091f9 Dimitris Aragiorgis
            NETWORK_GATEWAY6, NETWORK_TYPE, NETWORK_MAC_PREFIX, NETWORK_TAGS
265 6e8091f9 Dimitris Aragiorgis
:pre-execution: nodegroup nodes
266 6e8091f9 Dimitris Aragiorgis
:post-execution: nodegroup nodes
267 6e8091f9 Dimitris Aragiorgis
268 6e8091f9 Dimitris Aragiorgis
269 6e8091f9 Dimitris Aragiorgis
OP_NETWORK_SET_PARAMS
270 6e8091f9 Dimitris Aragiorgis
+++++++++++++++++++++
271 6e8091f9 Dimitris Aragiorgis
272 6e8091f9 Dimitris Aragiorgis
Modifies a network.
273 6e8091f9 Dimitris Aragiorgis
274 6e8091f9 Dimitris Aragiorgis
:directory: network-modify
275 6e8091f9 Dimitris Aragiorgis
:env. vars: NETWORK_NAME, NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
276 6e8091f9 Dimitris Aragiorgis
            NETWORK_GATEWAY6, NETWORK_TYPE, NETWORK_MAC_PREFIX, NETWORK_TAGS
277 6e8091f9 Dimitris Aragiorgis
:pre-execution: master node
278 6e8091f9 Dimitris Aragiorgis
:post-execution: master node
279 6e8091f9 Dimitris Aragiorgis
280 b1ee5610 Adeodato Simo
281 4d6443f4 Iustin Pop
Instance operations
282 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~~
283 4d6443f4 Iustin Pop
284 4d6443f4 Iustin Pop
All instance operations take at least the following variables:
285 dd5e7794 David Knowles
INSTANCE_NAME, INSTANCE_PRIMARY, INSTANCE_SECONDARY,
286 4d6443f4 Iustin Pop
INSTANCE_OS_TYPE, INSTANCE_DISK_TEMPLATE, INSTANCE_MEMORY,
287 4d6443f4 Iustin Pop
INSTANCE_DISK_SIZES, INSTANCE_VCPUS, INSTANCE_NIC_COUNT,
288 4d6443f4 Iustin Pop
INSTANCE_NICn_IP, INSTANCE_NICn_BRIDGE, INSTANCE_NICn_MAC,
289 4d6443f4 Iustin Pop
INSTANCE_DISK_COUNT, INSTANCE_DISKn_SIZE, INSTANCE_DISKn_MODE.
290 4d6443f4 Iustin Pop
291 4d6443f4 Iustin Pop
The INSTANCE_NICn_* and INSTANCE_DISKn_* variables represent the
292 4d6443f4 Iustin Pop
properties of the *n* -th NIC and disk, and are zero-indexed.
293 4d6443f4 Iustin Pop
294 4d6443f4 Iustin Pop
295 8ac5c5d7 Michael Hanselmann
OP_INSTANCE_CREATE
296 8ac5c5d7 Michael Hanselmann
++++++++++++++++++
297 4d6443f4 Iustin Pop
298 4d6443f4 Iustin Pop
Creates a new instance.
299 4d6443f4 Iustin Pop
300 4d6443f4 Iustin Pop
:directory: instance-add
301 4d6443f4 Iustin Pop
:env. vars: ADD_MODE, SRC_NODE, SRC_PATH, SRC_IMAGES
302 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
303 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
304 4d6443f4 Iustin Pop
305 4d6443f4 Iustin Pop
OP_INSTANCE_REINSTALL
306 4d6443f4 Iustin Pop
+++++++++++++++++++++
307 4d6443f4 Iustin Pop
308 4d6443f4 Iustin Pop
Reinstalls an instance.
309 4d6443f4 Iustin Pop
310 4d6443f4 Iustin Pop
:directory: instance-reinstall
311 4d6443f4 Iustin Pop
:env. vars: only the standard instance vars
312 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
313 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
314 4d6443f4 Iustin Pop
315 4d6443f4 Iustin Pop
OP_BACKUP_EXPORT
316 4d6443f4 Iustin Pop
++++++++++++++++
317 4d6443f4 Iustin Pop
318 4d6443f4 Iustin Pop
Exports the instance.
319 4d6443f4 Iustin Pop
320 4d6443f4 Iustin Pop
:directory: instance-export
321 49e4c837 David Knowles
:env. vars: EXPORT_MODE, EXPORT_NODE, EXPORT_DO_SHUTDOWN, REMOVE_INSTANCE
322 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
323 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
324 4d6443f4 Iustin Pop
325 dd5e7794 David Knowles
OP_INSTANCE_STARTUP
326 18009c1e Iustin Pop
+++++++++++++++++++
327 4d6443f4 Iustin Pop
328 4d6443f4 Iustin Pop
Starts an instance.
329 4d6443f4 Iustin Pop
330 4d6443f4 Iustin Pop
:directory: instance-start
331 454fe3cd Luca Bigliardi
:env. vars: FORCE
332 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
333 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
334 4d6443f4 Iustin Pop
335 4d6443f4 Iustin Pop
OP_INSTANCE_SHUTDOWN
336 4d6443f4 Iustin Pop
++++++++++++++++++++
337 4d6443f4 Iustin Pop
338 4d6443f4 Iustin Pop
Stops an instance.
339 4d6443f4 Iustin Pop
340 6c6b7f8a Michael Hanselmann
:directory: instance-stop
341 49e4c837 David Knowles
:env. vars: TIMEOUT
342 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
343 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
344 4d6443f4 Iustin Pop
345 4d6443f4 Iustin Pop
OP_INSTANCE_REBOOT
346 4d6443f4 Iustin Pop
++++++++++++++++++
347 4d6443f4 Iustin Pop
348 4d6443f4 Iustin Pop
Reboots an instance.
349 4d6443f4 Iustin Pop
350 4d6443f4 Iustin Pop
:directory: instance-reboot
351 49e4c837 David Knowles
:env. vars: IGNORE_SECONDARIES, REBOOT_TYPE, SHUTDOWN_TIMEOUT
352 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
353 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
354 4d6443f4 Iustin Pop
355 dd5e7794 David Knowles
OP_INSTANCE_SET_PARAMS
356 18009c1e Iustin Pop
++++++++++++++++++++++
357 4d6443f4 Iustin Pop
358 4d6443f4 Iustin Pop
Modifies the instance parameters.
359 4d6443f4 Iustin Pop
360 4d6443f4 Iustin Pop
:directory: instance-modify
361 2c0af7da Guido Trotter
:env. vars: NEW_DISK_TEMPLATE, RUNTIME_MEMORY
362 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
363 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
364 4d6443f4 Iustin Pop
365 4d6443f4 Iustin Pop
OP_INSTANCE_FAILOVER
366 4d6443f4 Iustin Pop
++++++++++++++++++++
367 4d6443f4 Iustin Pop
368 e73a5804 Luca Bigliardi
Failovers an instance. In the post phase INSTANCE_PRIMARY and
369 dd5e7794 David Knowles
INSTANCE_SECONDARY refer to the nodes that were repectively primary
370 e73a5804 Luca Bigliardi
and secondary before failover.
371 4d6443f4 Iustin Pop
372 4d6443f4 Iustin Pop
:directory: instance-failover
373 49e4c837 David Knowles
:env. vars: IGNORE_CONSISTENCY, SHUTDOWN_TIMEOUT, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY
374 4d6443f4 Iustin Pop
:pre-execution: master node, secondary node
375 abd8e836 Iustin Pop
:post-execution: master node, primary and secondary nodes
376 4d6443f4 Iustin Pop
377 4d6443f4 Iustin Pop
OP_INSTANCE_MIGRATE
378 4d6443f4 Iustin Pop
++++++++++++++++++++
379 4d6443f4 Iustin Pop
380 e73a5804 Luca Bigliardi
Migrates an instance. In the post phase INSTANCE_PRIMARY and
381 dd5e7794 David Knowles
INSTANCE_SECONDARY refer to the nodes that were repectively primary
382 e73a5804 Luca Bigliardi
and secondary before migration.
383 4d6443f4 Iustin Pop
384 6c6b7f8a Michael Hanselmann
:directory: instance-migrate
385 49e4c837 David Knowles
:env. vars: MIGRATE_LIVE, MIGRATE_CLEANUP, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY
386 4d6443f4 Iustin Pop
:pre-execution: master node, secondary node
387 abd8e836 Iustin Pop
:post-execution: master node, primary and secondary nodes
388 4d6443f4 Iustin Pop
389 4d6443f4 Iustin Pop
390 4d6443f4 Iustin Pop
OP_INSTANCE_REMOVE
391 4d6443f4 Iustin Pop
++++++++++++++++++
392 4d6443f4 Iustin Pop
393 4d6443f4 Iustin Pop
Remove an instance.
394 4d6443f4 Iustin Pop
395 4d6443f4 Iustin Pop
:directory: instance-remove
396 49e4c837 David Knowles
:env. vars: SHUTDOWN_TIMEOUT
397 4d6443f4 Iustin Pop
:pre-execution: master node
398 abd8e836 Iustin Pop
:post-execution: master node, primary and secondary nodes
399 4d6443f4 Iustin Pop
400 4d6443f4 Iustin Pop
OP_INSTANCE_GROW_DISK
401 4d6443f4 Iustin Pop
+++++++++++++++++++++
402 4d6443f4 Iustin Pop
403 4d6443f4 Iustin Pop
Grows the disk of an instance.
404 4d6443f4 Iustin Pop
405 4d6443f4 Iustin Pop
:directory: disk-grow
406 4d6443f4 Iustin Pop
:env. vars: DISK, AMOUNT
407 abd8e836 Iustin Pop
:pre-execution: master node, primary and secondary nodes
408 abd8e836 Iustin Pop
:post-execution: master node, primary and secondary nodes
409 4d6443f4 Iustin Pop
410 4d6443f4 Iustin Pop
OP_INSTANCE_RENAME
411 4d6443f4 Iustin Pop
++++++++++++++++++
412 4d6443f4 Iustin Pop
413 4d6443f4 Iustin Pop
Renames an instance.
414 4d6443f4 Iustin Pop
415 4d6443f4 Iustin Pop
:directory: instance-rename
416 4d6443f4 Iustin Pop
:env. vars: INSTANCE_NEW_NAME
417 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
418 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
419 4d6443f4 Iustin Pop
420 6c6b7f8a Michael Hanselmann
OP_INSTANCE_MOVE
421 6c6b7f8a Michael Hanselmann
++++++++++++++++
422 6c6b7f8a Michael Hanselmann
423 6c6b7f8a Michael Hanselmann
Move an instance by data-copying.
424 6c6b7f8a Michael Hanselmann
425 6c6b7f8a Michael Hanselmann
:directory: instance-move
426 49e4c837 David Knowles
:env. vars: TARGET_NODE, SHUTDOWN_TIMEOUT
427 6c6b7f8a Michael Hanselmann
:pre-execution: master node, primary and target nodes
428 6c6b7f8a Michael Hanselmann
:post-execution: master node, primary and target nodes
429 6c6b7f8a Michael Hanselmann
430 6c6b7f8a Michael Hanselmann
OP_INSTANCE_RECREATE_DISKS
431 6c6b7f8a Michael Hanselmann
++++++++++++++++++++++++++
432 6c6b7f8a Michael Hanselmann
433 6c6b7f8a Michael Hanselmann
Recreate an instance's missing disks.
434 6c6b7f8a Michael Hanselmann
435 6c6b7f8a Michael Hanselmann
:directory: instance-recreate-disks
436 6c6b7f8a Michael Hanselmann
:env. vars: only the standard instance vars
437 6c6b7f8a Michael Hanselmann
:pre-execution: master node, primary and secondary nodes
438 6c6b7f8a Michael Hanselmann
:post-execution: master node, primary and secondary nodes
439 6c6b7f8a Michael Hanselmann
440 6c6b7f8a Michael Hanselmann
OP_INSTANCE_REPLACE_DISKS
441 6c6b7f8a Michael Hanselmann
+++++++++++++++++++++++++
442 6c6b7f8a Michael Hanselmann
443 6c6b7f8a Michael Hanselmann
Replace the disks of an instance.
444 6c6b7f8a Michael Hanselmann
445 6c6b7f8a Michael Hanselmann
:directory: mirrors-replace
446 6c6b7f8a Michael Hanselmann
:env. vars: MODE, NEW_SECONDARY, OLD_SECONDARY
447 6c6b7f8a Michael Hanselmann
:pre-execution: master node, primary and new secondary nodes
448 6c6b7f8a Michael Hanselmann
:post-execution: master node, primary and new secondary nodes
449 6c6b7f8a Michael Hanselmann
450 1aef3df8 Michael Hanselmann
OP_INSTANCE_CHANGE_GROUP
451 1aef3df8 Michael Hanselmann
++++++++++++++++++++++++
452 1aef3df8 Michael Hanselmann
453 1aef3df8 Michael Hanselmann
Moves an instance to another group.
454 1aef3df8 Michael Hanselmann
455 1aef3df8 Michael Hanselmann
:directory: instance-change-group
456 1aef3df8 Michael Hanselmann
:env. vars: TARGET_GROUPS
457 1aef3df8 Michael Hanselmann
:pre-execution: master node
458 1aef3df8 Michael Hanselmann
:post-execution: master node
459 1aef3df8 Michael Hanselmann
460 6c6b7f8a Michael Hanselmann
461 4d6443f4 Iustin Pop
Cluster operations
462 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~
463 4d6443f4 Iustin Pop
464 8ac5c5d7 Michael Hanselmann
OP_CLUSTER_POST_INIT
465 035a7783 Luca Bigliardi
++++++++++++++++++++
466 035a7783 Luca Bigliardi
467 7faf5110 Michael Hanselmann
This hook is called via a special "empty" LU right after cluster
468 7faf5110 Michael Hanselmann
initialization.
469 035a7783 Luca Bigliardi
470 035a7783 Luca Bigliardi
:directory: cluster-init
471 035a7783 Luca Bigliardi
:env. vars: none
472 035a7783 Luca Bigliardi
:pre-execution: none
473 035a7783 Luca Bigliardi
:post-execution: master node
474 035a7783 Luca Bigliardi
475 8ac5c5d7 Michael Hanselmann
OP_CLUSTER_DESTROY
476 d87e1814 Luca Bigliardi
++++++++++++++++++
477 d87e1814 Luca Bigliardi
478 7faf5110 Michael Hanselmann
The post phase of this hook is called during the execution of destroy
479 7faf5110 Michael Hanselmann
operation and not after its completion.
480 d87e1814 Luca Bigliardi
481 d87e1814 Luca Bigliardi
:directory: cluster-destroy
482 d87e1814 Luca Bigliardi
:env. vars: none
483 d87e1814 Luca Bigliardi
:pre-execution: none
484 d87e1814 Luca Bigliardi
:post-execution: master node
485 d87e1814 Luca Bigliardi
486 56372573 Guido Trotter
OP_CLUSTER_VERIFY_GROUP
487 56372573 Guido Trotter
+++++++++++++++++++++++
488 4d6443f4 Iustin Pop
489 56372573 Guido Trotter
Verifies all nodes in a group. This is a special LU with regard to
490 4d6443f4 Iustin Pop
hooks, as the result of the opcode will be combined with the result of
491 4d6443f4 Iustin Pop
post-execution hooks, in order to allow administrators to enhance the
492 4d6443f4 Iustin Pop
cluster verification procedure.
493 4d6443f4 Iustin Pop
494 4d6443f4 Iustin Pop
:directory: cluster-verify
495 35e994e9 Iustin Pop
:env. vars: CLUSTER, MASTER, CLUSTER_TAGS, NODE_TAGS_<name>
496 4d6443f4 Iustin Pop
:pre-execution: none
497 56372573 Guido Trotter
:post-execution: all nodes in a group
498 4d6443f4 Iustin Pop
499 4d6443f4 Iustin Pop
OP_CLUSTER_RENAME
500 4d6443f4 Iustin Pop
+++++++++++++++++
501 4d6443f4 Iustin Pop
502 4d6443f4 Iustin Pop
Renames the cluster.
503 4d6443f4 Iustin Pop
504 4d6443f4 Iustin Pop
:directory: cluster-rename
505 4d6443f4 Iustin Pop
:env. vars: NEW_NAME
506 4d6443f4 Iustin Pop
:pre-execution: master-node
507 4d6443f4 Iustin Pop
:post-execution: master-node
508 4d6443f4 Iustin Pop
509 4d6443f4 Iustin Pop
OP_CLUSTER_SET_PARAMS
510 4d6443f4 Iustin Pop
+++++++++++++++++++++
511 4d6443f4 Iustin Pop
512 4d6443f4 Iustin Pop
Modifies the cluster parameters.
513 4d6443f4 Iustin Pop
514 4d6443f4 Iustin Pop
:directory: cluster-modify
515 4d6443f4 Iustin Pop
:env. vars: NEW_VG_NAME
516 4d6443f4 Iustin Pop
:pre-execution: master node
517 4d6443f4 Iustin Pop
:post-execution: master node
518 4d6443f4 Iustin Pop
519 ff779c32 Iustin Pop
Virtual operation :pyeval:`constants.FAKE_OP_MASTER_TURNUP`
520 ff779c32 Iustin Pop
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
521 769582be Andrea Spadaccini
522 ff779c32 Iustin Pop
This doesn't correspond to an actual op-code, but it is called when the
523 ff779c32 Iustin Pop
master IP is activated.
524 769582be Andrea Spadaccini
525 769582be Andrea Spadaccini
:directory: master-ip-turnup
526 3a3e4f1e Andrea Spadaccini
:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION
527 769582be Andrea Spadaccini
:pre-execution: master node
528 769582be Andrea Spadaccini
:post-execution: master node
529 769582be Andrea Spadaccini
530 ff779c32 Iustin Pop
Virtual operation :pyeval:`constants.FAKE_OP_MASTER_TURNDOWN`
531 ff779c32 Iustin Pop
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
532 769582be Andrea Spadaccini
533 ff779c32 Iustin Pop
This doesn't correspond to an actual op-code, but it is called when the
534 ff779c32 Iustin Pop
master IP is deactivated.
535 769582be Andrea Spadaccini
536 769582be Andrea Spadaccini
:directory: master-ip-turndown
537 3a3e4f1e Andrea Spadaccini
:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION
538 769582be Andrea Spadaccini
:pre-execution: master node
539 769582be Andrea Spadaccini
:post-execution: master node
540 769582be Andrea Spadaccini
541 4d6443f4 Iustin Pop
542 4d6443f4 Iustin Pop
Obsolete operations
543 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~~
544 4d6443f4 Iustin Pop
545 4d6443f4 Iustin Pop
The following operations are no longer present or don't execute hooks
546 4d6443f4 Iustin Pop
anymore in Ganeti 2.0:
547 4d6443f4 Iustin Pop
548 4d6443f4 Iustin Pop
- OP_INIT_CLUSTER
549 4d6443f4 Iustin Pop
- OP_MASTER_FAILOVER
550 4d6443f4 Iustin Pop
- OP_INSTANCE_ADD_MDDRBD
551 4d6443f4 Iustin Pop
- OP_INSTANCE_REMOVE_MDDRBD
552 4d6443f4 Iustin Pop
553 4d6443f4 Iustin Pop
554 4d6443f4 Iustin Pop
Environment variables
555 4d6443f4 Iustin Pop
---------------------
556 4d6443f4 Iustin Pop
557 dd7f6776 Michael Hanselmann
Note that all variables listed here are actually prefixed with *GANETI_*
558 dd7f6776 Michael Hanselmann
in order to provide a clear namespace. In addition, post-execution
559 dd7f6776 Michael Hanselmann
scripts receive another set of variables, prefixed with *GANETI_POST_*,
560 dd7f6776 Michael Hanselmann
representing the status after the opcode executed.
561 4d6443f4 Iustin Pop
562 4d6443f4 Iustin Pop
Common variables
563 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~
564 4d6443f4 Iustin Pop
565 4d6443f4 Iustin Pop
This is the list of environment variables supported by all operations:
566 4d6443f4 Iustin Pop
567 4d6443f4 Iustin Pop
HOOKS_VERSION
568 4d6443f4 Iustin Pop
  Documents the hooks interface version. In case this doesnt match
569 4d6443f4 Iustin Pop
  what the script expects, it should not run. The documents conforms
570 4d6443f4 Iustin Pop
  to the version 2.
571 4d6443f4 Iustin Pop
572 4d6443f4 Iustin Pop
HOOKS_PHASE
573 4d6443f4 Iustin Pop
  One of *PRE* or *POST* denoting which phase are we in.
574 4d6443f4 Iustin Pop
575 4d6443f4 Iustin Pop
CLUSTER
576 4d6443f4 Iustin Pop
  The cluster name.
577 4d6443f4 Iustin Pop
578 4d6443f4 Iustin Pop
MASTER
579 4d6443f4 Iustin Pop
  The master node.
580 4d6443f4 Iustin Pop
581 4d6443f4 Iustin Pop
OP_CODE
582 4d6443f4 Iustin Pop
  One of the *OP_* values from the list of operations.
583 4d6443f4 Iustin Pop
584 4d6443f4 Iustin Pop
OBJECT_TYPE
585 4d6443f4 Iustin Pop
  One of ``INSTANCE``, ``NODE``, ``CLUSTER``.
586 4d6443f4 Iustin Pop
587 4d6443f4 Iustin Pop
DATA_DIR
588 4d6443f4 Iustin Pop
  The path to the Ganeti configuration directory (to read, for
589 4d6443f4 Iustin Pop
  example, the *ssconf* files).
590 4d6443f4 Iustin Pop
591 4d6443f4 Iustin Pop
592 4d6443f4 Iustin Pop
Specialised variables
593 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~~~~
594 4d6443f4 Iustin Pop
595 4d6443f4 Iustin Pop
This is the list of variables which are specific to one or more
596 4d6443f4 Iustin Pop
operations.
597 4d6443f4 Iustin Pop
598 3a3e4f1e Andrea Spadaccini
CLUSTER_IP_VERSION
599 3a3e4f1e Andrea Spadaccini
  IP version of the master IP (4 or 6)
600 3a3e4f1e Andrea Spadaccini
601 4d6443f4 Iustin Pop
INSTANCE_NAME
602 4d6443f4 Iustin Pop
  The name of the instance which is the target of the operation.
603 4d6443f4 Iustin Pop
604 49e4c837 David Knowles
INSTANCE_BE_x,y,z,...
605 49e4c837 David Knowles
  Instance BE params. There is one variable per BE param. For instance, GANETI_INSTANCE_BE_auto_balance
606 49e4c837 David Knowles
607 4d6443f4 Iustin Pop
INSTANCE_DISK_TEMPLATE
608 4d6443f4 Iustin Pop
  The disk type for the instance.
609 4d6443f4 Iustin Pop
610 49e4c837 David Knowles
NEW_DISK_TEMPLATE
611 49e4c837 David Knowles
  The new disk type for the instance.
612 49e4c837 David Knowles
613 4d6443f4 Iustin Pop
INSTANCE_DISK_COUNT
614 4d6443f4 Iustin Pop
  The number of disks for the instance.
615 4d6443f4 Iustin Pop
616 4d6443f4 Iustin Pop
INSTANCE_DISKn_SIZE
617 4d6443f4 Iustin Pop
  The size of disk *n* for the instance.
618 4d6443f4 Iustin Pop
619 4d6443f4 Iustin Pop
INSTANCE_DISKn_MODE
620 4d6443f4 Iustin Pop
  Either *rw* for a read-write disk or *ro* for a read-only one.
621 4d6443f4 Iustin Pop
622 49e4c837 David Knowles
INSTANCE_HV_x,y,z,...
623 49e4c837 David Knowles
  Instance hypervisor options. There is one variable per option. For instance, GANETI_INSTANCE_HV_use_bootloader
624 49e4c837 David Knowles
625 49e4c837 David Knowles
INSTANCE_HYPERVISOR
626 49e4c837 David Knowles
  The instance hypervisor.
627 49e4c837 David Knowles
628 4d6443f4 Iustin Pop
INSTANCE_NIC_COUNT
629 4d6443f4 Iustin Pop
  The number of NICs for the instance.
630 4d6443f4 Iustin Pop
631 4d6443f4 Iustin Pop
INSTANCE_NICn_BRIDGE
632 4d6443f4 Iustin Pop
  The bridge to which the *n* -th NIC of the instance is attached.
633 4d6443f4 Iustin Pop
634 4d6443f4 Iustin Pop
INSTANCE_NICn_IP
635 4d6443f4 Iustin Pop
  The IP (if any) of the *n* -th NIC of the instance.
636 4d6443f4 Iustin Pop
637 4d6443f4 Iustin Pop
INSTANCE_NICn_MAC
638 4d6443f4 Iustin Pop
  The MAC address of the *n* -th NIC of the instance.
639 4d6443f4 Iustin Pop
640 49e4c837 David Knowles
INSTANCE_NICn_MODE
641 49e4c837 David Knowles
  The mode of the *n* -th NIC of the instance.
642 49e4c837 David Knowles
643 4d6443f4 Iustin Pop
INSTANCE_OS_TYPE
644 4d6443f4 Iustin Pop
  The name of the instance OS.
645 4d6443f4 Iustin Pop
646 4d6443f4 Iustin Pop
INSTANCE_PRIMARY
647 08eec276 Iustin Pop
  The name of the node which is the primary for the instance. Note that
648 08eec276 Iustin Pop
  for migrations/failovers, you shouldn't rely on this variable since
649 08eec276 Iustin Pop
  the nodes change during the exectution, but on the
650 08eec276 Iustin Pop
  OLD_PRIMARY/NEW_PRIMARY values.
651 4d6443f4 Iustin Pop
652 dd5e7794 David Knowles
INSTANCE_SECONDARY
653 08eec276 Iustin Pop
  Space-separated list of secondary nodes for the instance. Note that
654 08eec276 Iustin Pop
  for migrations/failovers, you shouldn't rely on this variable since
655 08eec276 Iustin Pop
  the nodes change during the exectution, but on the
656 08eec276 Iustin Pop
  OLD_SECONDARY/NEW_SECONDARY values.
657 4d6443f4 Iustin Pop
658 4d6443f4 Iustin Pop
INSTANCE_MEMORY
659 4d6443f4 Iustin Pop
  The memory size (in MiBs) of the instance.
660 4d6443f4 Iustin Pop
661 4d6443f4 Iustin Pop
INSTANCE_VCPUS
662 4d6443f4 Iustin Pop
  The number of virtual CPUs for the instance.
663 4d6443f4 Iustin Pop
664 4d6443f4 Iustin Pop
INSTANCE_STATUS
665 4d6443f4 Iustin Pop
  The run status of the instance.
666 4d6443f4 Iustin Pop
667 49e4c837 David Knowles
MASTER_CAPABLE
668 49e4c837 David Knowles
  Whether a node is capable of being promoted to master.
669 49e4c837 David Knowles
670 49e4c837 David Knowles
VM_CAPABLE
671 49e4c837 David Knowles
  Whether the node can host instances.
672 49e4c837 David Knowles
673 769582be Andrea Spadaccini
MASTER_NETDEV
674 769582be Andrea Spadaccini
  Network device of the master IP
675 769582be Andrea Spadaccini
676 769582be Andrea Spadaccini
MASTER_IP
677 769582be Andrea Spadaccini
  The master IP
678 769582be Andrea Spadaccini
679 3a3e4f1e Andrea Spadaccini
MASTER_NETMASK
680 3a3e4f1e Andrea Spadaccini
  Netmask of the master IP
681 3a3e4f1e Andrea Spadaccini
682 9dfa16fc Apollon Oikonomopoulos
INSTANCE_TAGS
683 9dfa16fc Apollon Oikonomopoulos
  A space-delimited list of the instance's tags.
684 9dfa16fc Apollon Oikonomopoulos
685 4d6443f4 Iustin Pop
NODE_NAME
686 4d6443f4 Iustin Pop
  The target node of this operation (not the node on which the hook
687 4d6443f4 Iustin Pop
  runs).
688 4d6443f4 Iustin Pop
689 4d6443f4 Iustin Pop
NODE_PIP
690 4d6443f4 Iustin Pop
  The primary IP of the target node (the one over which inter-node
691 4d6443f4 Iustin Pop
  communication is done).
692 4d6443f4 Iustin Pop
693 4d6443f4 Iustin Pop
NODE_SIP
694 4d6443f4 Iustin Pop
  The secondary IP of the target node (the one over which drbd
695 4d6443f4 Iustin Pop
  replication is done). This can be equal to the primary ip, in case
696 4d6443f4 Iustin Pop
  the cluster is not dual-homed.
697 4d6443f4 Iustin Pop
698 4d6443f4 Iustin Pop
FORCE
699 4d6443f4 Iustin Pop
  This is provided by some operations when the user gave this flag.
700 4d6443f4 Iustin Pop
701 4d6443f4 Iustin Pop
IGNORE_CONSISTENCY
702 4d6443f4 Iustin Pop
  The user has specified this flag. It is used when failing over
703 4d6443f4 Iustin Pop
  instances in case the primary node is down.
704 4d6443f4 Iustin Pop
705 4d6443f4 Iustin Pop
ADD_MODE
706 4d6443f4 Iustin Pop
  The mode of the instance create: either *create* for create from
707 4d6443f4 Iustin Pop
  scratch or *import* for restoring from an exported image.
708 4d6443f4 Iustin Pop
709 4d6443f4 Iustin Pop
SRC_NODE, SRC_PATH, SRC_IMAGE
710 4d6443f4 Iustin Pop
  In case the instance has been added by import, these variables are
711 4d6443f4 Iustin Pop
  defined and point to the source node, source path (the directory
712 4d6443f4 Iustin Pop
  containing the image and the config file) and the source disk image
713 4d6443f4 Iustin Pop
  file.
714 4d6443f4 Iustin Pop
715 4d6443f4 Iustin Pop
NEW_SECONDARY
716 4d6443f4 Iustin Pop
  The name of the node on which the new mirror component is being
717 08eec276 Iustin Pop
  added (for replace disk). This can be the name of the current
718 08eec276 Iustin Pop
  secondary, if the new mirror is on the same secondary. For
719 08eec276 Iustin Pop
  migrations/failovers, this is the old primary node.
720 4d6443f4 Iustin Pop
721 4d6443f4 Iustin Pop
OLD_SECONDARY
722 08eec276 Iustin Pop
  The name of the old secondary in the replace-disks command. Note that
723 4d6443f4 Iustin Pop
  this can be equal to the new secondary if the secondary node hasn't
724 08eec276 Iustin Pop
  actually changed. For migrations/failovers, this is the new primary
725 08eec276 Iustin Pop
  node.
726 08eec276 Iustin Pop
727 08eec276 Iustin Pop
OLD_PRIMARY, NEW_PRIMARY
728 08eec276 Iustin Pop
  For migrations/failovers, the old and respectively new primary
729 08eec276 Iustin Pop
  nodes. These two mirror the NEW_SECONDARY/OLD_SECONDARY variables
730 4d6443f4 Iustin Pop
731 49e4c837 David Knowles
EXPORT_MODE
732 49e4c837 David Knowles
  The instance export mode. Either "remote" or "local".
733 49e4c837 David Knowles
734 4d6443f4 Iustin Pop
EXPORT_NODE
735 4d6443f4 Iustin Pop
  The node on which the exported image of the instance was done.
736 4d6443f4 Iustin Pop
737 4d6443f4 Iustin Pop
EXPORT_DO_SHUTDOWN
738 4d6443f4 Iustin Pop
  This variable tells if the instance has been shutdown or not while
739 4d6443f4 Iustin Pop
  doing the export. In the "was shutdown" case, it's likely that the
740 4d6443f4 Iustin Pop
  filesystem is consistent, whereas in the "did not shutdown" case,
741 4d6443f4 Iustin Pop
  the filesystem would need a check (journal replay or full fsck) in
742 4d6443f4 Iustin Pop
  order to guarantee consistency.
743 4d6443f4 Iustin Pop
744 49e4c837 David Knowles
REMOVE_INSTANCE
745 49e4c837 David Knowles
  Whether the instance was removed from the node.
746 49e4c837 David Knowles
747 49e4c837 David Knowles
SHUTDOWN_TIMEOUT
748 49e4c837 David Knowles
  Amount of time to wait for the instance to shutdown.
749 49e4c837 David Knowles
750 49e4c837 David Knowles
TIMEOUT
751 49e4c837 David Knowles
  Amount of time to wait before aborting the op.
752 49e4c837 David Knowles
753 49e4c837 David Knowles
OLD_NAME, NEW_NAME
754 49e4c837 David Knowles
  Old/new name of the node group.
755 49e4c837 David Knowles
756 49e4c837 David Knowles
GROUP_NAME
757 49e4c837 David Knowles
  The name of the node group.
758 49e4c837 David Knowles
759 49e4c837 David Knowles
NEW_ALLOC_POLICY
760 49e4c837 David Knowles
  The new allocation policy for the node group.
761 49e4c837 David Knowles
762 35e994e9 Iustin Pop
CLUSTER_TAGS
763 35e994e9 Iustin Pop
  The list of cluster tags, space separated.
764 35e994e9 Iustin Pop
765 35e994e9 Iustin Pop
NODE_TAGS_<name>
766 35e994e9 Iustin Pop
  The list of tags for node *<name>*, space separated.
767 35e994e9 Iustin Pop
768 4d6443f4 Iustin Pop
Examples
769 4d6443f4 Iustin Pop
--------
770 4d6443f4 Iustin Pop
771 4d6443f4 Iustin Pop
The startup of an instance will pass this environment to the hook
772 4d6443f4 Iustin Pop
script::
773 4d6443f4 Iustin Pop
774 4d6443f4 Iustin Pop
  GANETI_CLUSTER=cluster1.example.com
775 4d6443f4 Iustin Pop
  GANETI_DATA_DIR=/var/lib/ganeti
776 4d6443f4 Iustin Pop
  GANETI_FORCE=False
777 4d6443f4 Iustin Pop
  GANETI_HOOKS_PATH=instance-start
778 4d6443f4 Iustin Pop
  GANETI_HOOKS_PHASE=post
779 4d6443f4 Iustin Pop
  GANETI_HOOKS_VERSION=2
780 4d6443f4 Iustin Pop
  GANETI_INSTANCE_DISK0_MODE=rw
781 4d6443f4 Iustin Pop
  GANETI_INSTANCE_DISK0_SIZE=128
782 4d6443f4 Iustin Pop
  GANETI_INSTANCE_DISK_COUNT=1
783 4d6443f4 Iustin Pop
  GANETI_INSTANCE_DISK_TEMPLATE=drbd
784 4d6443f4 Iustin Pop
  GANETI_INSTANCE_MEMORY=128
785 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NAME=instance2.example.com
786 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NIC0_BRIDGE=xen-br0
787 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NIC0_IP=
788 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NIC0_MAC=aa:00:00:a5:91:58
789 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NIC_COUNT=1
790 4d6443f4 Iustin Pop
  GANETI_INSTANCE_OS_TYPE=debootstrap
791 4d6443f4 Iustin Pop
  GANETI_INSTANCE_PRIMARY=node3.example.com
792 dd5e7794 David Knowles
  GANETI_INSTANCE_SECONDARY=node5.example.com
793 4d6443f4 Iustin Pop
  GANETI_INSTANCE_STATUS=down
794 4d6443f4 Iustin Pop
  GANETI_INSTANCE_VCPUS=1
795 4d6443f4 Iustin Pop
  GANETI_MASTER=node1.example.com
796 4d6443f4 Iustin Pop
  GANETI_OBJECT_TYPE=INSTANCE
797 4d6443f4 Iustin Pop
  GANETI_OP_CODE=OP_INSTANCE_STARTUP
798 4d6443f4 Iustin Pop
  GANETI_OP_TARGET=instance2.example.com
799 558fd122 Michael Hanselmann
800 558fd122 Michael Hanselmann
.. vim: set textwidth=72 :
801 08eec276 Iustin Pop
.. Local Variables:
802 08eec276 Iustin Pop
.. mode: rst
803 08eec276 Iustin Pop
.. fill-column: 72
804 08eec276 Iustin Pop
.. End: