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