root / doc / hooks.rst @ db620e95
History | View | Annotate | Download (19.9 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_EVACUATE |
152 |
++++++++++++++++ |
153 |
|
154 |
Relocate secondary instances from a node. |
155 |
|
156 |
:directory: node-evacuate |
157 |
:env. vars: NEW_SECONDARY, NODE_NAME |
158 |
:pre-execution: master node, target node |
159 |
:post-execution: master node, target node |
160 |
|
161 |
OP_NODE_MIGRATE |
162 |
++++++++++++++++ |
163 |
|
164 |
Relocate secondary instances from a node. |
165 |
|
166 |
:directory: node-migrate |
167 |
:env. vars: NODE_NAME |
168 |
:pre-execution: master node |
169 |
:post-execution: master node |
170 |
|
171 |
|
172 |
Node group operations |
173 |
~~~~~~~~~~~~~~~~~~~~~ |
174 |
|
175 |
OP_GROUP_ADD |
176 |
++++++++++++ |
177 |
|
178 |
Adds a node group to the cluster. |
179 |
|
180 |
:directory: group-add |
181 |
:env. vars: GROUP_NAME |
182 |
:pre-execution: master node |
183 |
:post-execution: master node |
184 |
|
185 |
OP_GROUP_SET_PARAMS |
186 |
+++++++++++++++++++ |
187 |
|
188 |
Changes a node group's parameters. |
189 |
|
190 |
:directory: group-modify |
191 |
:env. vars: GROUP_NAME, NEW_ALLOC_POLICY |
192 |
:pre-execution: master node |
193 |
:post-execution: master node |
194 |
|
195 |
OP_GROUP_REMOVE |
196 |
+++++++++++++++ |
197 |
|
198 |
Removes a node group from the cluster. Since the node group must be |
199 |
empty for removal to succeed, the concept of "nodes in the group" does |
200 |
not exist, and the hook is only executed in the master node. |
201 |
|
202 |
:directory: group-remove |
203 |
:env. vars: GROUP_NAME |
204 |
:pre-execution: master node |
205 |
:post-execution: master node |
206 |
|
207 |
OP_GROUP_RENAME |
208 |
+++++++++++++++ |
209 |
|
210 |
Renames a node group. |
211 |
|
212 |
:directory: group-rename |
213 |
:env. vars: OLD_NAME, NEW_NAME |
214 |
:pre-execution: master node and all nodes in the group |
215 |
:post-execution: master node and all nodes in the group |
216 |
|
217 |
OP_GROUP_EVACUATE |
218 |
+++++++++++++++++ |
219 |
|
220 |
Evacuates a node group. |
221 |
|
222 |
:directory: group-evacuate |
223 |
:env. vars: GROUP_NAME, TARGET_GROUPS |
224 |
:pre-execution: master node and all nodes in the group |
225 |
:post-execution: master node and all nodes in the group |
226 |
|
227 |
|
228 |
Instance operations |
229 |
~~~~~~~~~~~~~~~~~~~ |
230 |
|
231 |
All instance operations take at least the following variables: |
232 |
INSTANCE_NAME, INSTANCE_PRIMARY, INSTANCE_SECONDARY, |
233 |
INSTANCE_OS_TYPE, INSTANCE_DISK_TEMPLATE, INSTANCE_MEMORY, |
234 |
INSTANCE_DISK_SIZES, INSTANCE_VCPUS, INSTANCE_NIC_COUNT, |
235 |
INSTANCE_NICn_IP, INSTANCE_NICn_BRIDGE, INSTANCE_NICn_MAC, |
236 |
INSTANCE_DISK_COUNT, INSTANCE_DISKn_SIZE, INSTANCE_DISKn_MODE. |
237 |
|
238 |
The INSTANCE_NICn_* and INSTANCE_DISKn_* variables represent the |
239 |
properties of the *n* -th NIC and disk, and are zero-indexed. |
240 |
|
241 |
|
242 |
OP_INSTANCE_CREATE |
243 |
++++++++++++++++++ |
244 |
|
245 |
Creates a new instance. |
246 |
|
247 |
:directory: instance-add |
248 |
:env. vars: ADD_MODE, SRC_NODE, SRC_PATH, SRC_IMAGES |
249 |
:pre-execution: master node, primary and secondary nodes |
250 |
:post-execution: master node, primary and secondary nodes |
251 |
|
252 |
OP_INSTANCE_REINSTALL |
253 |
+++++++++++++++++++++ |
254 |
|
255 |
Reinstalls an instance. |
256 |
|
257 |
:directory: instance-reinstall |
258 |
:env. vars: only the standard instance vars |
259 |
:pre-execution: master node, primary and secondary nodes |
260 |
:post-execution: master node, primary and secondary nodes |
261 |
|
262 |
OP_BACKUP_EXPORT |
263 |
++++++++++++++++ |
264 |
|
265 |
Exports the instance. |
266 |
|
267 |
:directory: instance-export |
268 |
:env. vars: EXPORT_MODE, EXPORT_NODE, EXPORT_DO_SHUTDOWN, REMOVE_INSTANCE |
269 |
:pre-execution: master node, primary and secondary nodes |
270 |
:post-execution: master node, primary and secondary nodes |
271 |
|
272 |
OP_INSTANCE_STARTUP |
273 |
+++++++++++++++++++ |
274 |
|
275 |
Starts an instance. |
276 |
|
277 |
:directory: instance-start |
278 |
:env. vars: FORCE |
279 |
:pre-execution: master node, primary and secondary nodes |
280 |
:post-execution: master node, primary and secondary nodes |
281 |
|
282 |
OP_INSTANCE_SHUTDOWN |
283 |
++++++++++++++++++++ |
284 |
|
285 |
Stops an instance. |
286 |
|
287 |
:directory: instance-stop |
288 |
:env. vars: TIMEOUT |
289 |
:pre-execution: master node, primary and secondary nodes |
290 |
:post-execution: master node, primary and secondary nodes |
291 |
|
292 |
OP_INSTANCE_REBOOT |
293 |
++++++++++++++++++ |
294 |
|
295 |
Reboots an instance. |
296 |
|
297 |
:directory: instance-reboot |
298 |
:env. vars: IGNORE_SECONDARIES, REBOOT_TYPE, SHUTDOWN_TIMEOUT |
299 |
:pre-execution: master node, primary and secondary nodes |
300 |
:post-execution: master node, primary and secondary nodes |
301 |
|
302 |
OP_INSTANCE_SET_PARAMS |
303 |
++++++++++++++++++++++ |
304 |
|
305 |
Modifies the instance parameters. |
306 |
|
307 |
:directory: instance-modify |
308 |
:env. vars: NEW_DISK_TEMPLATE, RUNTIME_MEMORY |
309 |
:pre-execution: master node, primary and secondary nodes |
310 |
:post-execution: master node, primary and secondary nodes |
311 |
|
312 |
OP_INSTANCE_FAILOVER |
313 |
++++++++++++++++++++ |
314 |
|
315 |
Failovers an instance. In the post phase INSTANCE_PRIMARY and |
316 |
INSTANCE_SECONDARY refer to the nodes that were repectively primary |
317 |
and secondary before failover. |
318 |
|
319 |
:directory: instance-failover |
320 |
:env. vars: IGNORE_CONSISTENCY, SHUTDOWN_TIMEOUT, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY |
321 |
:pre-execution: master node, secondary node |
322 |
:post-execution: master node, primary and secondary nodes |
323 |
|
324 |
OP_INSTANCE_MIGRATE |
325 |
++++++++++++++++++++ |
326 |
|
327 |
Migrates an instance. In the post phase INSTANCE_PRIMARY and |
328 |
INSTANCE_SECONDARY refer to the nodes that were repectively primary |
329 |
and secondary before migration. |
330 |
|
331 |
:directory: instance-migrate |
332 |
:env. vars: MIGRATE_LIVE, MIGRATE_CLEANUP, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY |
333 |
:pre-execution: master node, secondary node |
334 |
:post-execution: master node, primary and secondary nodes |
335 |
|
336 |
|
337 |
OP_INSTANCE_REMOVE |
338 |
++++++++++++++++++ |
339 |
|
340 |
Remove an instance. |
341 |
|
342 |
:directory: instance-remove |
343 |
:env. vars: SHUTDOWN_TIMEOUT |
344 |
:pre-execution: master node |
345 |
:post-execution: master node, primary and secondary nodes |
346 |
|
347 |
OP_INSTANCE_REPLACE_DISKS |
348 |
+++++++++++++++++++++++++ |
349 |
|
350 |
Replace an instance's disks. |
351 |
|
352 |
:directory: mirror-replace |
353 |
:env. vars: MODE, NEW_SECONDARY, OLD_SECONDARY |
354 |
:pre-execution: master node, primary and secondary nodes |
355 |
:post-execution: master node, primary and secondary nodes |
356 |
|
357 |
OP_INSTANCE_GROW_DISK |
358 |
+++++++++++++++++++++ |
359 |
|
360 |
Grows the disk of an instance. |
361 |
|
362 |
:directory: disk-grow |
363 |
:env. vars: DISK, AMOUNT |
364 |
:pre-execution: master node, primary and secondary nodes |
365 |
:post-execution: master node, primary and secondary nodes |
366 |
|
367 |
OP_INSTANCE_RENAME |
368 |
++++++++++++++++++ |
369 |
|
370 |
Renames an instance. |
371 |
|
372 |
:directory: instance-rename |
373 |
:env. vars: INSTANCE_NEW_NAME |
374 |
:pre-execution: master node, primary and secondary nodes |
375 |
:post-execution: master node, primary and secondary nodes |
376 |
|
377 |
OP_INSTANCE_MOVE |
378 |
++++++++++++++++ |
379 |
|
380 |
Move an instance by data-copying. |
381 |
|
382 |
:directory: instance-move |
383 |
:env. vars: TARGET_NODE, SHUTDOWN_TIMEOUT |
384 |
:pre-execution: master node, primary and target nodes |
385 |
:post-execution: master node, primary and target nodes |
386 |
|
387 |
OP_INSTANCE_RECREATE_DISKS |
388 |
++++++++++++++++++++++++++ |
389 |
|
390 |
Recreate an instance's missing disks. |
391 |
|
392 |
:directory: instance-recreate-disks |
393 |
:env. vars: only the standard instance vars |
394 |
:pre-execution: master node, primary and secondary nodes |
395 |
:post-execution: master node, primary and secondary nodes |
396 |
|
397 |
OP_INSTANCE_REPLACE_DISKS |
398 |
+++++++++++++++++++++++++ |
399 |
|
400 |
Replace the disks of an instance. |
401 |
|
402 |
:directory: mirrors-replace |
403 |
:env. vars: MODE, NEW_SECONDARY, OLD_SECONDARY |
404 |
:pre-execution: master node, primary and new secondary nodes |
405 |
:post-execution: master node, primary and new secondary nodes |
406 |
|
407 |
OP_INSTANCE_CHANGE_GROUP |
408 |
++++++++++++++++++++++++ |
409 |
|
410 |
Moves an instance to another group. |
411 |
|
412 |
:directory: instance-change-group |
413 |
:env. vars: TARGET_GROUPS |
414 |
:pre-execution: master node |
415 |
:post-execution: master node |
416 |
|
417 |
|
418 |
Cluster operations |
419 |
~~~~~~~~~~~~~~~~~~ |
420 |
|
421 |
OP_CLUSTER_POST_INIT |
422 |
++++++++++++++++++++ |
423 |
|
424 |
This hook is called via a special "empty" LU right after cluster |
425 |
initialization. |
426 |
|
427 |
:directory: cluster-init |
428 |
:env. vars: none |
429 |
:pre-execution: none |
430 |
:post-execution: master node |
431 |
|
432 |
OP_CLUSTER_DESTROY |
433 |
++++++++++++++++++ |
434 |
|
435 |
The post phase of this hook is called during the execution of destroy |
436 |
operation and not after its completion. |
437 |
|
438 |
:directory: cluster-destroy |
439 |
:env. vars: none |
440 |
:pre-execution: none |
441 |
:post-execution: master node |
442 |
|
443 |
OP_CLUSTER_VERIFY_GROUP |
444 |
+++++++++++++++++++++++ |
445 |
|
446 |
Verifies all nodes in a group. This is a special LU with regard to |
447 |
hooks, as the result of the opcode will be combined with the result of |
448 |
post-execution hooks, in order to allow administrators to enhance the |
449 |
cluster verification procedure. |
450 |
|
451 |
:directory: cluster-verify |
452 |
:env. vars: CLUSTER, MASTER, CLUSTER_TAGS, NODE_TAGS_<name> |
453 |
:pre-execution: none |
454 |
:post-execution: all nodes in a group |
455 |
|
456 |
OP_CLUSTER_RENAME |
457 |
+++++++++++++++++ |
458 |
|
459 |
Renames the cluster. |
460 |
|
461 |
:directory: cluster-rename |
462 |
:env. vars: NEW_NAME |
463 |
:pre-execution: master-node |
464 |
:post-execution: master-node |
465 |
|
466 |
OP_CLUSTER_SET_PARAMS |
467 |
+++++++++++++++++++++ |
468 |
|
469 |
Modifies the cluster parameters. |
470 |
|
471 |
:directory: cluster-modify |
472 |
:env. vars: NEW_VG_NAME |
473 |
:pre-execution: master node |
474 |
:post-execution: master node |
475 |
|
476 |
Virtual operation :pyeval:`constants.FAKE_OP_MASTER_TURNUP` |
477 |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
478 |
|
479 |
This doesn't correspond to an actual op-code, but it is called when the |
480 |
master IP is activated. |
481 |
|
482 |
:directory: master-ip-turnup |
483 |
:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION |
484 |
:pre-execution: master node |
485 |
:post-execution: master node |
486 |
|
487 |
Virtual operation :pyeval:`constants.FAKE_OP_MASTER_TURNDOWN` |
488 |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
489 |
|
490 |
This doesn't correspond to an actual op-code, but it is called when the |
491 |
master IP is deactivated. |
492 |
|
493 |
:directory: master-ip-turndown |
494 |
:env. vars: MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION |
495 |
:pre-execution: master node |
496 |
:post-execution: master node |
497 |
|
498 |
|
499 |
Obsolete operations |
500 |
~~~~~~~~~~~~~~~~~~~ |
501 |
|
502 |
The following operations are no longer present or don't execute hooks |
503 |
anymore in Ganeti 2.0: |
504 |
|
505 |
- OP_INIT_CLUSTER |
506 |
- OP_MASTER_FAILOVER |
507 |
- OP_INSTANCE_ADD_MDDRBD |
508 |
- OP_INSTANCE_REMOVE_MDDRBD |
509 |
|
510 |
|
511 |
Environment variables |
512 |
--------------------- |
513 |
|
514 |
Note that all variables listed here are actually prefixed with *GANETI_* |
515 |
in order to provide a clear namespace. In addition, post-execution |
516 |
scripts receive another set of variables, prefixed with *GANETI_POST_*, |
517 |
representing the status after the opcode executed. |
518 |
|
519 |
Common variables |
520 |
~~~~~~~~~~~~~~~~ |
521 |
|
522 |
This is the list of environment variables supported by all operations: |
523 |
|
524 |
HOOKS_VERSION |
525 |
Documents the hooks interface version. In case this doesnt match |
526 |
what the script expects, it should not run. The documents conforms |
527 |
to the version 2. |
528 |
|
529 |
HOOKS_PHASE |
530 |
One of *PRE* or *POST* denoting which phase are we in. |
531 |
|
532 |
CLUSTER |
533 |
The cluster name. |
534 |
|
535 |
MASTER |
536 |
The master node. |
537 |
|
538 |
OP_CODE |
539 |
One of the *OP_* values from the list of operations. |
540 |
|
541 |
OBJECT_TYPE |
542 |
One of ``INSTANCE``, ``NODE``, ``CLUSTER``. |
543 |
|
544 |
DATA_DIR |
545 |
The path to the Ganeti configuration directory (to read, for |
546 |
example, the *ssconf* files). |
547 |
|
548 |
|
549 |
Specialised variables |
550 |
~~~~~~~~~~~~~~~~~~~~~ |
551 |
|
552 |
This is the list of variables which are specific to one or more |
553 |
operations. |
554 |
|
555 |
CLUSTER_IP_VERSION |
556 |
IP version of the master IP (4 or 6) |
557 |
|
558 |
INSTANCE_NAME |
559 |
The name of the instance which is the target of the operation. |
560 |
|
561 |
INSTANCE_BE_x,y,z,... |
562 |
Instance BE params. There is one variable per BE param. For instance, GANETI_INSTANCE_BE_auto_balance |
563 |
|
564 |
INSTANCE_DISK_TEMPLATE |
565 |
The disk type for the instance. |
566 |
|
567 |
NEW_DISK_TEMPLATE |
568 |
The new disk type for the instance. |
569 |
|
570 |
INSTANCE_DISK_COUNT |
571 |
The number of disks for the instance. |
572 |
|
573 |
INSTANCE_DISKn_SIZE |
574 |
The size of disk *n* for the instance. |
575 |
|
576 |
INSTANCE_DISKn_MODE |
577 |
Either *rw* for a read-write disk or *ro* for a read-only one. |
578 |
|
579 |
INSTANCE_HV_x,y,z,... |
580 |
Instance hypervisor options. There is one variable per option. For instance, GANETI_INSTANCE_HV_use_bootloader |
581 |
|
582 |
INSTANCE_HYPERVISOR |
583 |
The instance hypervisor. |
584 |
|
585 |
INSTANCE_NIC_COUNT |
586 |
The number of NICs for the instance. |
587 |
|
588 |
INSTANCE_NICn_BRIDGE |
589 |
The bridge to which the *n* -th NIC of the instance is attached. |
590 |
|
591 |
INSTANCE_NICn_IP |
592 |
The IP (if any) of the *n* -th NIC of the instance. |
593 |
|
594 |
INSTANCE_NICn_MAC |
595 |
The MAC address of the *n* -th NIC of the instance. |
596 |
|
597 |
INSTANCE_NICn_MODE |
598 |
The mode of the *n* -th NIC of the instance. |
599 |
|
600 |
INSTANCE_OS_TYPE |
601 |
The name of the instance OS. |
602 |
|
603 |
INSTANCE_PRIMARY |
604 |
The name of the node which is the primary for the instance. Note that |
605 |
for migrations/failovers, you shouldn't rely on this variable since |
606 |
the nodes change during the exectution, but on the |
607 |
OLD_PRIMARY/NEW_PRIMARY values. |
608 |
|
609 |
INSTANCE_SECONDARY |
610 |
Space-separated list of secondary nodes for the instance. Note that |
611 |
for migrations/failovers, you shouldn't rely on this variable since |
612 |
the nodes change during the exectution, but on the |
613 |
OLD_SECONDARY/NEW_SECONDARY values. |
614 |
|
615 |
INSTANCE_MEMORY |
616 |
The memory size (in MiBs) of the instance. |
617 |
|
618 |
INSTANCE_VCPUS |
619 |
The number of virtual CPUs for the instance. |
620 |
|
621 |
INSTANCE_STATUS |
622 |
The run status of the instance. |
623 |
|
624 |
MASTER_CAPABLE |
625 |
Whether a node is capable of being promoted to master. |
626 |
|
627 |
VM_CAPABLE |
628 |
Whether the node can host instances. |
629 |
|
630 |
MASTER_NETDEV |
631 |
Network device of the master IP |
632 |
|
633 |
MASTER_IP |
634 |
The master IP |
635 |
|
636 |
MASTER_NETMASK |
637 |
Netmask of the master IP |
638 |
|
639 |
INSTANCE_TAGS |
640 |
A space-delimited list of the instance's tags. |
641 |
|
642 |
NODE_NAME |
643 |
The target node of this operation (not the node on which the hook |
644 |
runs). |
645 |
|
646 |
NODE_PIP |
647 |
The primary IP of the target node (the one over which inter-node |
648 |
communication is done). |
649 |
|
650 |
NODE_SIP |
651 |
The secondary IP of the target node (the one over which drbd |
652 |
replication is done). This can be equal to the primary ip, in case |
653 |
the cluster is not dual-homed. |
654 |
|
655 |
FORCE |
656 |
This is provided by some operations when the user gave this flag. |
657 |
|
658 |
IGNORE_CONSISTENCY |
659 |
The user has specified this flag. It is used when failing over |
660 |
instances in case the primary node is down. |
661 |
|
662 |
ADD_MODE |
663 |
The mode of the instance create: either *create* for create from |
664 |
scratch or *import* for restoring from an exported image. |
665 |
|
666 |
SRC_NODE, SRC_PATH, SRC_IMAGE |
667 |
In case the instance has been added by import, these variables are |
668 |
defined and point to the source node, source path (the directory |
669 |
containing the image and the config file) and the source disk image |
670 |
file. |
671 |
|
672 |
NEW_SECONDARY |
673 |
The name of the node on which the new mirror component is being |
674 |
added (for replace disk). This can be the name of the current |
675 |
secondary, if the new mirror is on the same secondary. For |
676 |
migrations/failovers, this is the old primary node. |
677 |
|
678 |
OLD_SECONDARY |
679 |
The name of the old secondary in the replace-disks command. Note that |
680 |
this can be equal to the new secondary if the secondary node hasn't |
681 |
actually changed. For migrations/failovers, this is the new primary |
682 |
node. |
683 |
|
684 |
OLD_PRIMARY, NEW_PRIMARY |
685 |
For migrations/failovers, the old and respectively new primary |
686 |
nodes. These two mirror the NEW_SECONDARY/OLD_SECONDARY variables |
687 |
|
688 |
EXPORT_MODE |
689 |
The instance export mode. Either "remote" or "local". |
690 |
|
691 |
EXPORT_NODE |
692 |
The node on which the exported image of the instance was done. |
693 |
|
694 |
EXPORT_DO_SHUTDOWN |
695 |
This variable tells if the instance has been shutdown or not while |
696 |
doing the export. In the "was shutdown" case, it's likely that the |
697 |
filesystem is consistent, whereas in the "did not shutdown" case, |
698 |
the filesystem would need a check (journal replay or full fsck) in |
699 |
order to guarantee consistency. |
700 |
|
701 |
REMOVE_INSTANCE |
702 |
Whether the instance was removed from the node. |
703 |
|
704 |
SHUTDOWN_TIMEOUT |
705 |
Amount of time to wait for the instance to shutdown. |
706 |
|
707 |
TIMEOUT |
708 |
Amount of time to wait before aborting the op. |
709 |
|
710 |
OLD_NAME, NEW_NAME |
711 |
Old/new name of the node group. |
712 |
|
713 |
GROUP_NAME |
714 |
The name of the node group. |
715 |
|
716 |
NEW_ALLOC_POLICY |
717 |
The new allocation policy for the node group. |
718 |
|
719 |
CLUSTER_TAGS |
720 |
The list of cluster tags, space separated. |
721 |
|
722 |
NODE_TAGS_<name> |
723 |
The list of tags for node *<name>*, space separated. |
724 |
|
725 |
Examples |
726 |
-------- |
727 |
|
728 |
The startup of an instance will pass this environment to the hook |
729 |
script:: |
730 |
|
731 |
GANETI_CLUSTER=cluster1.example.com |
732 |
GANETI_DATA_DIR=/var/lib/ganeti |
733 |
GANETI_FORCE=False |
734 |
GANETI_HOOKS_PATH=instance-start |
735 |
GANETI_HOOKS_PHASE=post |
736 |
GANETI_HOOKS_VERSION=2 |
737 |
GANETI_INSTANCE_DISK0_MODE=rw |
738 |
GANETI_INSTANCE_DISK0_SIZE=128 |
739 |
GANETI_INSTANCE_DISK_COUNT=1 |
740 |
GANETI_INSTANCE_DISK_TEMPLATE=drbd |
741 |
GANETI_INSTANCE_MEMORY=128 |
742 |
GANETI_INSTANCE_NAME=instance2.example.com |
743 |
GANETI_INSTANCE_NIC0_BRIDGE=xen-br0 |
744 |
GANETI_INSTANCE_NIC0_IP= |
745 |
GANETI_INSTANCE_NIC0_MAC=aa:00:00:a5:91:58 |
746 |
GANETI_INSTANCE_NIC_COUNT=1 |
747 |
GANETI_INSTANCE_OS_TYPE=debootstrap |
748 |
GANETI_INSTANCE_PRIMARY=node3.example.com |
749 |
GANETI_INSTANCE_SECONDARY=node5.example.com |
750 |
GANETI_INSTANCE_STATUS=down |
751 |
GANETI_INSTANCE_VCPUS=1 |
752 |
GANETI_MASTER=node1.example.com |
753 |
GANETI_OBJECT_TYPE=INSTANCE |
754 |
GANETI_OP_CODE=OP_INSTANCE_STARTUP |
755 |
GANETI_OP_TARGET=instance2.example.com |
756 |
|
757 |
.. vim: set textwidth=72 : |
758 |
.. Local Variables: |
759 |
.. mode: rst |
760 |
.. fill-column: 72 |
761 |
.. End: |