Statistics
| Branch: | Tag: | Revision:

root / doc / hooks.rst @ 333bd799

History | View | Annotate | Download (21.3 kB)

1 4d6443f4 Iustin Pop
Ganeti customisation using hooks
2 4d6443f4 Iustin Pop
================================
3 4d6443f4 Iustin Pop
4 c7a02959 Thomas Thrainer
Documents Ganeti version 2.11
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 5cfa6c37 Dimitris Aragiorgis
            NETWORK_GATEWAY6, 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 5cfa6c37 Dimitris Aragiorgis
            NETWORK_GATEWAY6, 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 5cfa6c37 Dimitris Aragiorgis
            NETWORK_GATEWAY6, 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 5cfa6c37 Dimitris Aragiorgis
            NETWORK_GATEWAY6, 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 48616625 Dimitris Aragiorgis
INSTANCE_NICn_NETWORK,
290 d89168ff Guido Trotter
INSTANCE_NICn_NETWORK_UUID, INSTANCE_NICn_NETWORK_SUBNET,
291 d89168ff Guido Trotter
INSTANCE_NICn_NETWORK_GATEWAY, INSTANCE_NICn_NETWORK_SUBNET6,
292 d89168ff Guido Trotter
INSTANCE_NICn_NETWORK_GATEWAY6, INSTANCE_NICn_NETWORK_MAC_PREFIX,
293 5cfa6c37 Dimitris Aragiorgis
INSTANCE_DISK_COUNT, INSTANCE_DISKn_SIZE, INSTANCE_DISKn_MODE.
294 4d6443f4 Iustin Pop
295 4d6443f4 Iustin Pop
The INSTANCE_NICn_* and INSTANCE_DISKn_* variables represent the
296 4d6443f4 Iustin Pop
properties of the *n* -th NIC and disk, and are zero-indexed.
297 4d6443f4 Iustin Pop
298 950e32ec Guido Trotter
The INSTANCE_NICn_NETWORK_* variables are only passed if a NIC's network
299 950e32ec Guido Trotter
parameter is set (that is if the NIC is associated to a network defined
300 950e32ec Guido Trotter
via ``gnt-network``)
301 950e32ec Guido Trotter
302 4d6443f4 Iustin Pop
303 8ac5c5d7 Michael Hanselmann
OP_INSTANCE_CREATE
304 8ac5c5d7 Michael Hanselmann
++++++++++++++++++
305 4d6443f4 Iustin Pop
306 4d6443f4 Iustin Pop
Creates a new instance.
307 4d6443f4 Iustin Pop
308 4d6443f4 Iustin Pop
:directory: instance-add
309 4d6443f4 Iustin Pop
:env. vars: ADD_MODE, SRC_NODE, SRC_PATH, SRC_IMAGES
310 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
311 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
312 4d6443f4 Iustin Pop
313 4d6443f4 Iustin Pop
OP_INSTANCE_REINSTALL
314 4d6443f4 Iustin Pop
+++++++++++++++++++++
315 4d6443f4 Iustin Pop
316 4d6443f4 Iustin Pop
Reinstalls an instance.
317 4d6443f4 Iustin Pop
318 4d6443f4 Iustin Pop
:directory: instance-reinstall
319 4d6443f4 Iustin Pop
:env. vars: only the standard instance vars
320 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
321 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
322 4d6443f4 Iustin Pop
323 4d6443f4 Iustin Pop
OP_BACKUP_EXPORT
324 4d6443f4 Iustin Pop
++++++++++++++++
325 4d6443f4 Iustin Pop
326 4d6443f4 Iustin Pop
Exports the instance.
327 4d6443f4 Iustin Pop
328 4d6443f4 Iustin Pop
:directory: instance-export
329 49e4c837 David Knowles
:env. vars: EXPORT_MODE, EXPORT_NODE, EXPORT_DO_SHUTDOWN, REMOVE_INSTANCE
330 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
331 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
332 4d6443f4 Iustin Pop
333 dd5e7794 David Knowles
OP_INSTANCE_STARTUP
334 18009c1e Iustin Pop
+++++++++++++++++++
335 4d6443f4 Iustin Pop
336 4d6443f4 Iustin Pop
Starts an instance.
337 4d6443f4 Iustin Pop
338 4d6443f4 Iustin Pop
:directory: instance-start
339 454fe3cd Luca Bigliardi
:env. vars: FORCE
340 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
341 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
342 4d6443f4 Iustin Pop
343 4d6443f4 Iustin Pop
OP_INSTANCE_SHUTDOWN
344 4d6443f4 Iustin Pop
++++++++++++++++++++
345 4d6443f4 Iustin Pop
346 4d6443f4 Iustin Pop
Stops an instance.
347 4d6443f4 Iustin Pop
348 6c6b7f8a Michael Hanselmann
:directory: instance-stop
349 49e4c837 David Knowles
:env. vars: TIMEOUT
350 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
351 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
352 4d6443f4 Iustin Pop
353 4d6443f4 Iustin Pop
OP_INSTANCE_REBOOT
354 4d6443f4 Iustin Pop
++++++++++++++++++
355 4d6443f4 Iustin Pop
356 4d6443f4 Iustin Pop
Reboots an instance.
357 4d6443f4 Iustin Pop
358 4d6443f4 Iustin Pop
:directory: instance-reboot
359 49e4c837 David Knowles
:env. vars: IGNORE_SECONDARIES, REBOOT_TYPE, SHUTDOWN_TIMEOUT
360 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
361 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
362 4d6443f4 Iustin Pop
363 dd5e7794 David Knowles
OP_INSTANCE_SET_PARAMS
364 18009c1e Iustin Pop
++++++++++++++++++++++
365 4d6443f4 Iustin Pop
366 4d6443f4 Iustin Pop
Modifies the instance parameters.
367 4d6443f4 Iustin Pop
368 4d6443f4 Iustin Pop
:directory: instance-modify
369 2c0af7da Guido Trotter
:env. vars: NEW_DISK_TEMPLATE, RUNTIME_MEMORY
370 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
371 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
372 4d6443f4 Iustin Pop
373 4d6443f4 Iustin Pop
OP_INSTANCE_FAILOVER
374 4d6443f4 Iustin Pop
++++++++++++++++++++
375 4d6443f4 Iustin Pop
376 e73a5804 Luca Bigliardi
Failovers an instance. In the post phase INSTANCE_PRIMARY and
377 dd5e7794 David Knowles
INSTANCE_SECONDARY refer to the nodes that were repectively primary
378 e73a5804 Luca Bigliardi
and secondary before failover.
379 4d6443f4 Iustin Pop
380 4d6443f4 Iustin Pop
:directory: instance-failover
381 49e4c837 David Knowles
:env. vars: IGNORE_CONSISTENCY, SHUTDOWN_TIMEOUT, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY
382 4d6443f4 Iustin Pop
:pre-execution: master node, secondary node
383 abd8e836 Iustin Pop
:post-execution: master node, primary and secondary nodes
384 4d6443f4 Iustin Pop
385 4d6443f4 Iustin Pop
OP_INSTANCE_MIGRATE
386 4d6443f4 Iustin Pop
++++++++++++++++++++
387 4d6443f4 Iustin Pop
388 e73a5804 Luca Bigliardi
Migrates an instance. In the post phase INSTANCE_PRIMARY and
389 dd5e7794 David Knowles
INSTANCE_SECONDARY refer to the nodes that were repectively primary
390 e73a5804 Luca Bigliardi
and secondary before migration.
391 4d6443f4 Iustin Pop
392 6c6b7f8a Michael Hanselmann
:directory: instance-migrate
393 49e4c837 David Knowles
:env. vars: MIGRATE_LIVE, MIGRATE_CLEANUP, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY
394 950e32ec Guido Trotter
:pre-execution: master node, primary and secondary nodes
395 abd8e836 Iustin Pop
:post-execution: master node, primary and secondary nodes
396 4d6443f4 Iustin Pop
397 4d6443f4 Iustin Pop
398 4d6443f4 Iustin Pop
OP_INSTANCE_REMOVE
399 4d6443f4 Iustin Pop
++++++++++++++++++
400 4d6443f4 Iustin Pop
401 4d6443f4 Iustin Pop
Remove an instance.
402 4d6443f4 Iustin Pop
403 4d6443f4 Iustin Pop
:directory: instance-remove
404 49e4c837 David Knowles
:env. vars: SHUTDOWN_TIMEOUT
405 4d6443f4 Iustin Pop
:pre-execution: master node
406 abd8e836 Iustin Pop
:post-execution: master node, primary and secondary nodes
407 4d6443f4 Iustin Pop
408 4d6443f4 Iustin Pop
OP_INSTANCE_GROW_DISK
409 4d6443f4 Iustin Pop
+++++++++++++++++++++
410 4d6443f4 Iustin Pop
411 4d6443f4 Iustin Pop
Grows the disk of an instance.
412 4d6443f4 Iustin Pop
413 4d6443f4 Iustin Pop
:directory: disk-grow
414 4d6443f4 Iustin Pop
:env. vars: DISK, AMOUNT
415 abd8e836 Iustin Pop
:pre-execution: master node, primary and secondary nodes
416 abd8e836 Iustin Pop
:post-execution: master node, primary and secondary nodes
417 4d6443f4 Iustin Pop
418 4d6443f4 Iustin Pop
OP_INSTANCE_RENAME
419 4d6443f4 Iustin Pop
++++++++++++++++++
420 4d6443f4 Iustin Pop
421 4d6443f4 Iustin Pop
Renames an instance.
422 4d6443f4 Iustin Pop
423 4d6443f4 Iustin Pop
:directory: instance-rename
424 4d6443f4 Iustin Pop
:env. vars: INSTANCE_NEW_NAME
425 4d6443f4 Iustin Pop
:pre-execution: master node, primary and secondary nodes
426 4d6443f4 Iustin Pop
:post-execution: master node, primary and secondary nodes
427 4d6443f4 Iustin Pop
428 6c6b7f8a Michael Hanselmann
OP_INSTANCE_MOVE
429 6c6b7f8a Michael Hanselmann
++++++++++++++++
430 6c6b7f8a Michael Hanselmann
431 6c6b7f8a Michael Hanselmann
Move an instance by data-copying.
432 6c6b7f8a Michael Hanselmann
433 6c6b7f8a Michael Hanselmann
:directory: instance-move
434 49e4c837 David Knowles
:env. vars: TARGET_NODE, SHUTDOWN_TIMEOUT
435 6c6b7f8a Michael Hanselmann
:pre-execution: master node, primary and target nodes
436 6c6b7f8a Michael Hanselmann
:post-execution: master node, primary and target nodes
437 6c6b7f8a Michael Hanselmann
438 6c6b7f8a Michael Hanselmann
OP_INSTANCE_RECREATE_DISKS
439 6c6b7f8a Michael Hanselmann
++++++++++++++++++++++++++
440 6c6b7f8a Michael Hanselmann
441 6c6b7f8a Michael Hanselmann
Recreate an instance's missing disks.
442 6c6b7f8a Michael Hanselmann
443 6c6b7f8a Michael Hanselmann
:directory: instance-recreate-disks
444 6c6b7f8a Michael Hanselmann
:env. vars: only the standard instance vars
445 6c6b7f8a Michael Hanselmann
:pre-execution: master node, primary and secondary nodes
446 6c6b7f8a Michael Hanselmann
:post-execution: master node, primary and secondary nodes
447 6c6b7f8a Michael Hanselmann
448 6c6b7f8a Michael Hanselmann
OP_INSTANCE_REPLACE_DISKS
449 6c6b7f8a Michael Hanselmann
+++++++++++++++++++++++++
450 6c6b7f8a Michael Hanselmann
451 6c6b7f8a Michael Hanselmann
Replace the disks of an instance.
452 6c6b7f8a Michael Hanselmann
453 6c6b7f8a Michael Hanselmann
:directory: mirrors-replace
454 6c6b7f8a Michael Hanselmann
:env. vars: MODE, NEW_SECONDARY, OLD_SECONDARY
455 6c6b7f8a Michael Hanselmann
:pre-execution: master node, primary and new secondary nodes
456 6c6b7f8a Michael Hanselmann
:post-execution: master node, primary and new secondary nodes
457 6c6b7f8a Michael Hanselmann
458 1aef3df8 Michael Hanselmann
OP_INSTANCE_CHANGE_GROUP
459 1aef3df8 Michael Hanselmann
++++++++++++++++++++++++
460 1aef3df8 Michael Hanselmann
461 1aef3df8 Michael Hanselmann
Moves an instance to another group.
462 1aef3df8 Michael Hanselmann
463 1aef3df8 Michael Hanselmann
:directory: instance-change-group
464 1aef3df8 Michael Hanselmann
:env. vars: TARGET_GROUPS
465 1aef3df8 Michael Hanselmann
:pre-execution: master node
466 1aef3df8 Michael Hanselmann
:post-execution: master node
467 1aef3df8 Michael Hanselmann
468 6c6b7f8a Michael Hanselmann
469 4d6443f4 Iustin Pop
Cluster operations
470 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~
471 4d6443f4 Iustin Pop
472 8ac5c5d7 Michael Hanselmann
OP_CLUSTER_POST_INIT
473 035a7783 Luca Bigliardi
++++++++++++++++++++
474 035a7783 Luca Bigliardi
475 7faf5110 Michael Hanselmann
This hook is called via a special "empty" LU right after cluster
476 7faf5110 Michael Hanselmann
initialization.
477 035a7783 Luca Bigliardi
478 035a7783 Luca Bigliardi
:directory: cluster-init
479 035a7783 Luca Bigliardi
:env. vars: none
480 035a7783 Luca Bigliardi
:pre-execution: none
481 035a7783 Luca Bigliardi
:post-execution: master node
482 035a7783 Luca Bigliardi
483 8ac5c5d7 Michael Hanselmann
OP_CLUSTER_DESTROY
484 d87e1814 Luca Bigliardi
++++++++++++++++++
485 d87e1814 Luca Bigliardi
486 7faf5110 Michael Hanselmann
The post phase of this hook is called during the execution of destroy
487 7faf5110 Michael Hanselmann
operation and not after its completion.
488 d87e1814 Luca Bigliardi
489 d87e1814 Luca Bigliardi
:directory: cluster-destroy
490 d87e1814 Luca Bigliardi
:env. vars: none
491 d87e1814 Luca Bigliardi
:pre-execution: none
492 d87e1814 Luca Bigliardi
:post-execution: master node
493 d87e1814 Luca Bigliardi
494 56372573 Guido Trotter
OP_CLUSTER_VERIFY_GROUP
495 56372573 Guido Trotter
+++++++++++++++++++++++
496 4d6443f4 Iustin Pop
497 56372573 Guido Trotter
Verifies all nodes in a group. This is a special LU with regard to
498 4d6443f4 Iustin Pop
hooks, as the result of the opcode will be combined with the result of
499 4d6443f4 Iustin Pop
post-execution hooks, in order to allow administrators to enhance the
500 4d6443f4 Iustin Pop
cluster verification procedure.
501 4d6443f4 Iustin Pop
502 4d6443f4 Iustin Pop
:directory: cluster-verify
503 35e994e9 Iustin Pop
:env. vars: CLUSTER, MASTER, CLUSTER_TAGS, NODE_TAGS_<name>
504 4d6443f4 Iustin Pop
:pre-execution: none
505 56372573 Guido Trotter
:post-execution: all nodes in a group
506 4d6443f4 Iustin Pop
507 4d6443f4 Iustin Pop
OP_CLUSTER_RENAME
508 4d6443f4 Iustin Pop
+++++++++++++++++
509 4d6443f4 Iustin Pop
510 4d6443f4 Iustin Pop
Renames the cluster.
511 4d6443f4 Iustin Pop
512 4d6443f4 Iustin Pop
:directory: cluster-rename
513 4d6443f4 Iustin Pop
:env. vars: NEW_NAME
514 4d6443f4 Iustin Pop
:pre-execution: master-node
515 4d6443f4 Iustin Pop
:post-execution: master-node
516 4d6443f4 Iustin Pop
517 4d6443f4 Iustin Pop
OP_CLUSTER_SET_PARAMS
518 4d6443f4 Iustin Pop
+++++++++++++++++++++
519 4d6443f4 Iustin Pop
520 4d6443f4 Iustin Pop
Modifies the cluster parameters.
521 4d6443f4 Iustin Pop
522 4d6443f4 Iustin Pop
:directory: cluster-modify
523 4d6443f4 Iustin Pop
:env. vars: NEW_VG_NAME
524 4d6443f4 Iustin Pop
:pre-execution: master node
525 4d6443f4 Iustin Pop
:post-execution: master node
526 4d6443f4 Iustin Pop
527 ff779c32 Iustin Pop
Virtual operation :pyeval:`constants.FAKE_OP_MASTER_TURNUP`
528 ff779c32 Iustin Pop
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
529 769582be Andrea Spadaccini
530 ff779c32 Iustin Pop
This doesn't correspond to an actual op-code, but it is called when the
531 ff779c32 Iustin Pop
master IP is activated.
532 769582be Andrea Spadaccini
533 769582be Andrea Spadaccini
:directory: master-ip-turnup
534 3a3e4f1e Andrea Spadaccini
:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION
535 769582be Andrea Spadaccini
:pre-execution: master node
536 769582be Andrea Spadaccini
:post-execution: master node
537 769582be Andrea Spadaccini
538 ff779c32 Iustin Pop
Virtual operation :pyeval:`constants.FAKE_OP_MASTER_TURNDOWN`
539 ff779c32 Iustin Pop
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
540 769582be Andrea Spadaccini
541 ff779c32 Iustin Pop
This doesn't correspond to an actual op-code, but it is called when the
542 ff779c32 Iustin Pop
master IP is deactivated.
543 769582be Andrea Spadaccini
544 769582be Andrea Spadaccini
:directory: master-ip-turndown
545 3a3e4f1e Andrea Spadaccini
:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION
546 769582be Andrea Spadaccini
:pre-execution: master node
547 769582be Andrea Spadaccini
:post-execution: master node
548 769582be Andrea Spadaccini
549 4d6443f4 Iustin Pop
550 4d6443f4 Iustin Pop
Obsolete operations
551 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~~
552 4d6443f4 Iustin Pop
553 4d6443f4 Iustin Pop
The following operations are no longer present or don't execute hooks
554 4d6443f4 Iustin Pop
anymore in Ganeti 2.0:
555 4d6443f4 Iustin Pop
556 4d6443f4 Iustin Pop
- OP_INIT_CLUSTER
557 4d6443f4 Iustin Pop
- OP_MASTER_FAILOVER
558 4d6443f4 Iustin Pop
- OP_INSTANCE_ADD_MDDRBD
559 4d6443f4 Iustin Pop
- OP_INSTANCE_REMOVE_MDDRBD
560 4d6443f4 Iustin Pop
561 4d6443f4 Iustin Pop
562 4d6443f4 Iustin Pop
Environment variables
563 4d6443f4 Iustin Pop
---------------------
564 4d6443f4 Iustin Pop
565 dd7f6776 Michael Hanselmann
Note that all variables listed here are actually prefixed with *GANETI_*
566 dd7f6776 Michael Hanselmann
in order to provide a clear namespace. In addition, post-execution
567 dd7f6776 Michael Hanselmann
scripts receive another set of variables, prefixed with *GANETI_POST_*,
568 dd7f6776 Michael Hanselmann
representing the status after the opcode executed.
569 4d6443f4 Iustin Pop
570 4d6443f4 Iustin Pop
Common variables
571 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~
572 4d6443f4 Iustin Pop
573 4d6443f4 Iustin Pop
This is the list of environment variables supported by all operations:
574 4d6443f4 Iustin Pop
575 4d6443f4 Iustin Pop
HOOKS_VERSION
576 4d6443f4 Iustin Pop
  Documents the hooks interface version. In case this doesnt match
577 4d6443f4 Iustin Pop
  what the script expects, it should not run. The documents conforms
578 4d6443f4 Iustin Pop
  to the version 2.
579 4d6443f4 Iustin Pop
580 4d6443f4 Iustin Pop
HOOKS_PHASE
581 4d6443f4 Iustin Pop
  One of *PRE* or *POST* denoting which phase are we in.
582 4d6443f4 Iustin Pop
583 4d6443f4 Iustin Pop
CLUSTER
584 4d6443f4 Iustin Pop
  The cluster name.
585 4d6443f4 Iustin Pop
586 4d6443f4 Iustin Pop
MASTER
587 4d6443f4 Iustin Pop
  The master node.
588 4d6443f4 Iustin Pop
589 4d6443f4 Iustin Pop
OP_CODE
590 4d6443f4 Iustin Pop
  One of the *OP_* values from the list of operations.
591 4d6443f4 Iustin Pop
592 4d6443f4 Iustin Pop
OBJECT_TYPE
593 4d6443f4 Iustin Pop
  One of ``INSTANCE``, ``NODE``, ``CLUSTER``.
594 4d6443f4 Iustin Pop
595 4d6443f4 Iustin Pop
DATA_DIR
596 4d6443f4 Iustin Pop
  The path to the Ganeti configuration directory (to read, for
597 4d6443f4 Iustin Pop
  example, the *ssconf* files).
598 4d6443f4 Iustin Pop
599 4d6443f4 Iustin Pop
600 4d6443f4 Iustin Pop
Specialised variables
601 4d6443f4 Iustin Pop
~~~~~~~~~~~~~~~~~~~~~
602 4d6443f4 Iustin Pop
603 4d6443f4 Iustin Pop
This is the list of variables which are specific to one or more
604 4d6443f4 Iustin Pop
operations.
605 4d6443f4 Iustin Pop
606 3a3e4f1e Andrea Spadaccini
CLUSTER_IP_VERSION
607 3a3e4f1e Andrea Spadaccini
  IP version of the master IP (4 or 6)
608 3a3e4f1e Andrea Spadaccini
609 4d6443f4 Iustin Pop
INSTANCE_NAME
610 4d6443f4 Iustin Pop
  The name of the instance which is the target of the operation.
611 4d6443f4 Iustin Pop
612 49e4c837 David Knowles
INSTANCE_BE_x,y,z,...
613 49e4c837 David Knowles
  Instance BE params. There is one variable per BE param. For instance, GANETI_INSTANCE_BE_auto_balance
614 49e4c837 David Knowles
615 4d6443f4 Iustin Pop
INSTANCE_DISK_TEMPLATE
616 4d6443f4 Iustin Pop
  The disk type for the instance.
617 4d6443f4 Iustin Pop
618 49e4c837 David Knowles
NEW_DISK_TEMPLATE
619 49e4c837 David Knowles
  The new disk type for the instance.
620 49e4c837 David Knowles
621 4d6443f4 Iustin Pop
INSTANCE_DISK_COUNT
622 4d6443f4 Iustin Pop
  The number of disks for the instance.
623 4d6443f4 Iustin Pop
624 4d6443f4 Iustin Pop
INSTANCE_DISKn_SIZE
625 4d6443f4 Iustin Pop
  The size of disk *n* for the instance.
626 4d6443f4 Iustin Pop
627 4d6443f4 Iustin Pop
INSTANCE_DISKn_MODE
628 4d6443f4 Iustin Pop
  Either *rw* for a read-write disk or *ro* for a read-only one.
629 4d6443f4 Iustin Pop
630 49e4c837 David Knowles
INSTANCE_HV_x,y,z,...
631 49e4c837 David Knowles
  Instance hypervisor options. There is one variable per option. For instance, GANETI_INSTANCE_HV_use_bootloader
632 49e4c837 David Knowles
633 49e4c837 David Knowles
INSTANCE_HYPERVISOR
634 49e4c837 David Knowles
  The instance hypervisor.
635 49e4c837 David Knowles
636 4d6443f4 Iustin Pop
INSTANCE_NIC_COUNT
637 4d6443f4 Iustin Pop
  The number of NICs for the instance.
638 4d6443f4 Iustin Pop
639 4d6443f4 Iustin Pop
INSTANCE_NICn_BRIDGE
640 4d6443f4 Iustin Pop
  The bridge to which the *n* -th NIC of the instance is attached.
641 4d6443f4 Iustin Pop
642 4d6443f4 Iustin Pop
INSTANCE_NICn_IP
643 4d6443f4 Iustin Pop
  The IP (if any) of the *n* -th NIC of the instance.
644 4d6443f4 Iustin Pop
645 4d6443f4 Iustin Pop
INSTANCE_NICn_MAC
646 4d6443f4 Iustin Pop
  The MAC address of the *n* -th NIC of the instance.
647 4d6443f4 Iustin Pop
648 49e4c837 David Knowles
INSTANCE_NICn_MODE
649 49e4c837 David Knowles
  The mode of the *n* -th NIC of the instance.
650 49e4c837 David Knowles
651 4d6443f4 Iustin Pop
INSTANCE_OS_TYPE
652 4d6443f4 Iustin Pop
  The name of the instance OS.
653 4d6443f4 Iustin Pop
654 4d6443f4 Iustin Pop
INSTANCE_PRIMARY
655 08eec276 Iustin Pop
  The name of the node which is the primary for the instance. Note that
656 08eec276 Iustin Pop
  for migrations/failovers, you shouldn't rely on this variable since
657 08eec276 Iustin Pop
  the nodes change during the exectution, but on the
658 08eec276 Iustin Pop
  OLD_PRIMARY/NEW_PRIMARY values.
659 4d6443f4 Iustin Pop
660 dd5e7794 David Knowles
INSTANCE_SECONDARY
661 08eec276 Iustin Pop
  Space-separated list of secondary nodes for the instance. Note that
662 08eec276 Iustin Pop
  for migrations/failovers, you shouldn't rely on this variable since
663 08eec276 Iustin Pop
  the nodes change during the exectution, but on the
664 08eec276 Iustin Pop
  OLD_SECONDARY/NEW_SECONDARY values.
665 4d6443f4 Iustin Pop
666 4d6443f4 Iustin Pop
INSTANCE_MEMORY
667 4d6443f4 Iustin Pop
  The memory size (in MiBs) of the instance.
668 4d6443f4 Iustin Pop
669 4d6443f4 Iustin Pop
INSTANCE_VCPUS
670 4d6443f4 Iustin Pop
  The number of virtual CPUs for the instance.
671 4d6443f4 Iustin Pop
672 4d6443f4 Iustin Pop
INSTANCE_STATUS
673 4d6443f4 Iustin Pop
  The run status of the instance.
674 4d6443f4 Iustin Pop
675 49e4c837 David Knowles
MASTER_CAPABLE
676 49e4c837 David Knowles
  Whether a node is capable of being promoted to master.
677 49e4c837 David Knowles
678 49e4c837 David Knowles
VM_CAPABLE
679 49e4c837 David Knowles
  Whether the node can host instances.
680 49e4c837 David Knowles
681 769582be Andrea Spadaccini
MASTER_NETDEV
682 769582be Andrea Spadaccini
  Network device of the master IP
683 769582be Andrea Spadaccini
684 769582be Andrea Spadaccini
MASTER_IP
685 769582be Andrea Spadaccini
  The master IP
686 769582be Andrea Spadaccini
687 3a3e4f1e Andrea Spadaccini
MASTER_NETMASK
688 3a3e4f1e Andrea Spadaccini
  Netmask of the master IP
689 3a3e4f1e Andrea Spadaccini
690 9dfa16fc Apollon Oikonomopoulos
INSTANCE_TAGS
691 9dfa16fc Apollon Oikonomopoulos
  A space-delimited list of the instance's tags.
692 9dfa16fc Apollon Oikonomopoulos
693 4d6443f4 Iustin Pop
NODE_NAME
694 4d6443f4 Iustin Pop
  The target node of this operation (not the node on which the hook
695 4d6443f4 Iustin Pop
  runs).
696 4d6443f4 Iustin Pop
697 4d6443f4 Iustin Pop
NODE_PIP
698 4d6443f4 Iustin Pop
  The primary IP of the target node (the one over which inter-node
699 4d6443f4 Iustin Pop
  communication is done).
700 4d6443f4 Iustin Pop
701 4d6443f4 Iustin Pop
NODE_SIP
702 4d6443f4 Iustin Pop
  The secondary IP of the target node (the one over which drbd
703 4d6443f4 Iustin Pop
  replication is done). This can be equal to the primary ip, in case
704 4d6443f4 Iustin Pop
  the cluster is not dual-homed.
705 4d6443f4 Iustin Pop
706 4d6443f4 Iustin Pop
FORCE
707 4d6443f4 Iustin Pop
  This is provided by some operations when the user gave this flag.
708 4d6443f4 Iustin Pop
709 4d6443f4 Iustin Pop
IGNORE_CONSISTENCY
710 4d6443f4 Iustin Pop
  The user has specified this flag. It is used when failing over
711 4d6443f4 Iustin Pop
  instances in case the primary node is down.
712 4d6443f4 Iustin Pop
713 4d6443f4 Iustin Pop
ADD_MODE
714 4d6443f4 Iustin Pop
  The mode of the instance create: either *create* for create from
715 4d6443f4 Iustin Pop
  scratch or *import* for restoring from an exported image.
716 4d6443f4 Iustin Pop
717 4d6443f4 Iustin Pop
SRC_NODE, SRC_PATH, SRC_IMAGE
718 4d6443f4 Iustin Pop
  In case the instance has been added by import, these variables are
719 4d6443f4 Iustin Pop
  defined and point to the source node, source path (the directory
720 4d6443f4 Iustin Pop
  containing the image and the config file) and the source disk image
721 4d6443f4 Iustin Pop
  file.
722 4d6443f4 Iustin Pop
723 4d6443f4 Iustin Pop
NEW_SECONDARY
724 4d6443f4 Iustin Pop
  The name of the node on which the new mirror component is being
725 08eec276 Iustin Pop
  added (for replace disk). This can be the name of the current
726 08eec276 Iustin Pop
  secondary, if the new mirror is on the same secondary. For
727 08eec276 Iustin Pop
  migrations/failovers, this is the old primary node.
728 4d6443f4 Iustin Pop
729 4d6443f4 Iustin Pop
OLD_SECONDARY
730 08eec276 Iustin Pop
  The name of the old secondary in the replace-disks command. Note that
731 4d6443f4 Iustin Pop
  this can be equal to the new secondary if the secondary node hasn't
732 08eec276 Iustin Pop
  actually changed. For migrations/failovers, this is the new primary
733 08eec276 Iustin Pop
  node.
734 08eec276 Iustin Pop
735 08eec276 Iustin Pop
OLD_PRIMARY, NEW_PRIMARY
736 08eec276 Iustin Pop
  For migrations/failovers, the old and respectively new primary
737 08eec276 Iustin Pop
  nodes. These two mirror the NEW_SECONDARY/OLD_SECONDARY variables
738 4d6443f4 Iustin Pop
739 49e4c837 David Knowles
EXPORT_MODE
740 49e4c837 David Knowles
  The instance export mode. Either "remote" or "local".
741 49e4c837 David Knowles
742 4d6443f4 Iustin Pop
EXPORT_NODE
743 4d6443f4 Iustin Pop
  The node on which the exported image of the instance was done.
744 4d6443f4 Iustin Pop
745 4d6443f4 Iustin Pop
EXPORT_DO_SHUTDOWN
746 4d6443f4 Iustin Pop
  This variable tells if the instance has been shutdown or not while
747 4d6443f4 Iustin Pop
  doing the export. In the "was shutdown" case, it's likely that the
748 4d6443f4 Iustin Pop
  filesystem is consistent, whereas in the "did not shutdown" case,
749 4d6443f4 Iustin Pop
  the filesystem would need a check (journal replay or full fsck) in
750 4d6443f4 Iustin Pop
  order to guarantee consistency.
751 4d6443f4 Iustin Pop
752 49e4c837 David Knowles
REMOVE_INSTANCE
753 49e4c837 David Knowles
  Whether the instance was removed from the node.
754 49e4c837 David Knowles
755 49e4c837 David Knowles
SHUTDOWN_TIMEOUT
756 49e4c837 David Knowles
  Amount of time to wait for the instance to shutdown.
757 49e4c837 David Knowles
758 49e4c837 David Knowles
TIMEOUT
759 49e4c837 David Knowles
  Amount of time to wait before aborting the op.
760 49e4c837 David Knowles
761 49e4c837 David Knowles
OLD_NAME, NEW_NAME
762 49e4c837 David Knowles
  Old/new name of the node group.
763 49e4c837 David Knowles
764 49e4c837 David Knowles
GROUP_NAME
765 49e4c837 David Knowles
  The name of the node group.
766 49e4c837 David Knowles
767 49e4c837 David Knowles
NEW_ALLOC_POLICY
768 49e4c837 David Knowles
  The new allocation policy for the node group.
769 49e4c837 David Knowles
770 35e994e9 Iustin Pop
CLUSTER_TAGS
771 35e994e9 Iustin Pop
  The list of cluster tags, space separated.
772 35e994e9 Iustin Pop
773 35e994e9 Iustin Pop
NODE_TAGS_<name>
774 35e994e9 Iustin Pop
  The list of tags for node *<name>*, space separated.
775 35e994e9 Iustin Pop
776 4d6443f4 Iustin Pop
Examples
777 4d6443f4 Iustin Pop
--------
778 4d6443f4 Iustin Pop
779 4d6443f4 Iustin Pop
The startup of an instance will pass this environment to the hook
780 4d6443f4 Iustin Pop
script::
781 4d6443f4 Iustin Pop
782 4d6443f4 Iustin Pop
  GANETI_CLUSTER=cluster1.example.com
783 4d6443f4 Iustin Pop
  GANETI_DATA_DIR=/var/lib/ganeti
784 4d6443f4 Iustin Pop
  GANETI_FORCE=False
785 4d6443f4 Iustin Pop
  GANETI_HOOKS_PATH=instance-start
786 4d6443f4 Iustin Pop
  GANETI_HOOKS_PHASE=post
787 4d6443f4 Iustin Pop
  GANETI_HOOKS_VERSION=2
788 4d6443f4 Iustin Pop
  GANETI_INSTANCE_DISK0_MODE=rw
789 4d6443f4 Iustin Pop
  GANETI_INSTANCE_DISK0_SIZE=128
790 4d6443f4 Iustin Pop
  GANETI_INSTANCE_DISK_COUNT=1
791 4d6443f4 Iustin Pop
  GANETI_INSTANCE_DISK_TEMPLATE=drbd
792 4d6443f4 Iustin Pop
  GANETI_INSTANCE_MEMORY=128
793 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NAME=instance2.example.com
794 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NIC0_BRIDGE=xen-br0
795 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NIC0_IP=
796 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NIC0_MAC=aa:00:00:a5:91:58
797 4d6443f4 Iustin Pop
  GANETI_INSTANCE_NIC_COUNT=1
798 4d6443f4 Iustin Pop
  GANETI_INSTANCE_OS_TYPE=debootstrap
799 4d6443f4 Iustin Pop
  GANETI_INSTANCE_PRIMARY=node3.example.com
800 dd5e7794 David Knowles
  GANETI_INSTANCE_SECONDARY=node5.example.com
801 4d6443f4 Iustin Pop
  GANETI_INSTANCE_STATUS=down
802 4d6443f4 Iustin Pop
  GANETI_INSTANCE_VCPUS=1
803 4d6443f4 Iustin Pop
  GANETI_MASTER=node1.example.com
804 4d6443f4 Iustin Pop
  GANETI_OBJECT_TYPE=INSTANCE
805 4d6443f4 Iustin Pop
  GANETI_OP_CODE=OP_INSTANCE_STARTUP
806 4d6443f4 Iustin Pop
  GANETI_OP_TARGET=instance2.example.com
807 558fd122 Michael Hanselmann
808 558fd122 Michael Hanselmann
.. vim: set textwidth=72 :
809 08eec276 Iustin Pop
.. Local Variables:
810 08eec276 Iustin Pop
.. mode: rst
811 08eec276 Iustin Pop
.. fill-column: 72
812 08eec276 Iustin Pop
.. End: