gnt-cluster(8): Quoting, small fixes
[ganeti-local] / man / gnt-node.rst
1 gnt-node(8) Ganeti | Version @GANETI_VERSION@
2 =============================================
3
4 Name
5 ----
6
7 gnt-node - Node administration
8
9 Synopsis
10 --------
11
12 **gnt-node** {command} [arguments...]
13
14 DESCRIPTION
15 -----------
16
17 The **gnt-node** is used for managing the (physical) nodes in the
18 Ganeti system.
19
20 COMMANDS
21 --------
22
23 ADD
24 ~~~
25
26 | **add** [\--readd] [{-s|\--secondary-ip} *secondary\_ip*]
27 | [{-g|\--node-group} *nodegroup*]
28 | [\--master-capable=``yes|no``] [\--vm-capable=``yes|no``]
29 | [\--node-parameters *ndparams*]
30 | [\--disk-state *diskstate*]
31 | [\--hypervisor-state *hvstate*]
32 | {*nodename*}
33
34 Adds the given node to the cluster.
35
36 This command is used to join a new node to the cluster. You will
37 have to provide the password for root of the node to be able to add
38 the node in the cluster. The command needs to be run on the Ganeti
39 master.
40
41 Note that the command is potentially destructive, as it will
42 forcibly join the specified host the cluster, not paying attention
43 to its current status (it could be already in a cluster, etc.)
44
45 The ``-s (--secondary-ip)`` is used in dual-home clusters and
46 specifies the new node's IP in the secondary network. See the
47 discussion in **gnt-cluster**(8) for more information.
48
49 In case you're readding a node after hardware failure, you can use
50 the ``--readd`` parameter. In this case, you don't need to pass the
51 secondary IP again, it will reused from the cluster. Also, the
52 drained and offline flags of the node will be cleared before
53 re-adding it.
54
55 The ``-g (--node-group)`` option is used to add the new node into a
56 specific node group, specified by UUID or name. If only one node group
57 exists you can skip this option, otherwise it's mandatory.
58
59 The ``vm_capable``, ``master_capable``, ``ndparams``, ``diskstate`` and
60 ``hvstate`` options are described in **ganeti**(7), and are used to set
61 the properties of the new node.
62
63 The command performs some operations that change the state of the master
64 and the new node, like copying certificates and starting the node daemon
65 on the new node, or updating ``/etc/hosts`` on the master node.  If the
66 command fails at a later stage, it doesn't undo such changes.  This
67 should not be a problem, as a successful run of ``gnt-node add`` will
68 bring everything back in sync.
69
70 If the node was previously part of another cluster and still has daemons
71 running, the ``node-cleanup`` tool can be run on the machine to be added
72 to clean remains of the previous cluster from the node.
73
74 Example::
75
76     # gnt-node add node5.example.com
77     # gnt-node add -s 192.0.2.5 node5.example.com
78     # gnt-node add -g group2 -s 192.0.2.9 node9.group2.example.com
79
80
81 ADD-TAGS
82 ~~~~~~~~
83
84 **add-tags** [\--from *file*] {*nodename*} {*tag*...}
85
86 Add tags to the given node. If any of the tags contains invalid
87 characters, the entire operation will abort.
88
89 If the ``--from`` option is given, the list of tags will be
90 extended with the contents of that file (each line becomes a tag).
91 In this case, there is not need to pass tags on the command line
92 (if you do, both sources will be used). A file name of - will be
93 interpreted as stdin.
94
95 EVACUATE
96 ~~~~~~~~
97
98 | **evacuate** [-f] [\--early-release] [\--submit]
99 | [{-I|\--iallocator} *NAME* \| {-n|\--new-secondary} *destination\_node*]
100 | [{-p|\--primary-only} \| {-s|\--secondary-only} ]
101 |  {*node*}
102
103 This command will move instances away from the given node. If
104 ``--primary-only`` is given, only primary instances are evacuated, with
105 ``--secondary-only`` only secondaries. If neither is given, all
106 instances are evacuated. It works only for instances having a drbd disk
107 template.
108
109 The new location for the instances can be specified in two ways:
110
111 - as a single node for all instances, via the ``-n (--new-secondary)``
112   option
113
114 - or via the ``-I (--iallocator)`` option, giving a script name as
115   parameter (or ``.`` to use the default allocator), so each instance
116   will be in turn placed on the (per the script) optimal node
117
118 The ``--early-release`` changes the code so that the old storage on
119 node being evacuated is removed early (before the resync is
120 completed) and the internal Ganeti locks are also released for both
121 the current secondary and the new secondary, thus allowing more
122 parallelism in the cluster operation. This should be used only when
123 recovering from a disk failure on the current secondary (thus the
124 old storage is already broken) or when the storage on the primary
125 node is known to be fine (thus we won't need the old storage for
126 potential recovery).
127
128 Note that this command is equivalent to using per-instance commands for
129 each affected instance individually:
130
131 - ``--primary-only`` is equivalent to ``gnt-instance
132   failover/migration`` for non-DRBD instances, but for DRBD instances
133   it's different, and usually is a slow process (it will change the
134   primary to another node while keeping the secondary, this requiring
135   data copies, whereas failover/migrate will only toggle the
136   primary/secondary roles, a fast process)
137 - ``--secondary-only`` is equivalent to ``gnt-instance replace-disks``
138   in the secondary node change mode (only valid for DRBD instances)
139 - when neither of the above is done a combination of the two cases is run
140
141 See **ganeti(7)** for a description of ``--submit`` and other common
142 options.
143
144 Example::
145
146     # gnt-node evacuate -I hail node3.example.com
147
148
149 FAILOVER
150 ~~~~~~~~
151
152 **failover** [-f] [\--ignore-consistency] {*node*}
153
154 This command will fail over all instances having the given node as
155 primary to their secondary nodes. This works only for instances having
156 a drbd disk template.
157
158 Normally the failover will check the consistency of the disks before
159 failing over the instance. If you are trying to migrate instances off
160 a dead node, this will fail. Use the ``--ignore-consistency`` option
161 for this purpose.
162
163 Example::
164
165     # gnt-node failover node1.example.com
166
167
168 INFO
169 ~~~~
170
171 **info** [*node*...]
172
173 Show detailed information about the nodes in the cluster. If you
174 don't give any arguments, all nodes will be shows, otherwise the
175 output will be restricted to the given names.
176
177 LIST
178 ~~~~
179
180 | **list**
181 | [\--no-headers] [\--separator=*SEPARATOR*]
182 | [\--units=*UNITS*] [-v] [{-o|\--output} *[+]FIELD,...*]
183 | [\--filter]
184 | [node...]
185
186 Lists the nodes in the cluster.
187
188 The ``--no-headers`` option will skip the initial header line. The
189 ``--separator`` option takes an argument which denotes what will be
190 used between the output fields. Both these options are to help
191 scripting.
192
193 The units used to display the numeric values in the output varies,
194 depending on the options given. By default, the values will be
195 formatted in the most appropriate unit. If the ``--separator``
196 option is given, then the values are shown in mebibytes to allow
197 parsing by scripts. In both cases, the ``--units`` option can be
198 used to enforce a given output unit.
199
200 Queries of nodes will be done in parallel with any running jobs. This might
201 give inconsistent results for the free disk/memory.
202
203 The ``-v`` option activates verbose mode, which changes the display of
204 special field states (see **ganeti(7)**).
205
206 The ``-o (--output)`` option takes a comma-separated list of output
207 fields. The available fields and their meaning are:
208
209 @QUERY_FIELDS_NODE@
210
211 If the value of the option starts with the character ``+``, the new
212 fields will be added to the default list. This allows one to quickly
213 see the default list plus a few other fields, instead of retyping
214 the entire list of fields.
215
216 Note that some of these fields are known from the configuration of the
217 cluster (e.g. ``name``, ``pinst``, ``sinst``, ``pip``, ``sip``) and thus
218 the master does not need to contact the node for this data (making the
219 listing fast if only fields from this set are selected), whereas the
220 other fields are "live" fields and require a query to the cluster nodes.
221
222 Depending on the virtualization type and implementation details, the
223 ``mtotal``, ``mnode`` and ``mfree`` fields may have slightly varying
224 meanings. For example, some solutions share the node memory with the
225 pool of memory used for instances (KVM), whereas others have separate
226 memory for the node and for the instances (Xen).
227
228 If exactly one argument is given and it appears to be a query filter
229 (see **ganeti(7)**), the query result is filtered accordingly. For
230 ambiguous cases (e.g. a single field name as a filter) the ``--filter``
231 (``-F``) option forces the argument to be treated as a filter (e.g.
232 ``gnt-node list -F master_candidate``).
233
234 If no node names are given, then all nodes are queried. Otherwise,
235 only the given nodes will be listed.
236
237
238 LIST-DRBD
239 ~~~~~~~~~
240
241 **list-drbd** [\--no-headers] [\--separator=*SEPARATOR*] node
242
243 Lists the mapping of DRBD minors for a given node. This outputs a static
244 list of fields (it doesn't accept the ``--output`` option), as follows:
245
246 ``Node``
247   The (full) name of the node we are querying
248 ``Minor``
249   The DRBD minor
250 ``Instance``
251   The instance the DRBD minor belongs to
252 ``Disk``
253   The disk index that the DRBD minor belongs to
254 ``Role``
255   Either ``primary`` or ``secondary``, denoting the role of the node for
256   the instance (note: this is not the live status of the DRBD device,
257   but the configuration value)
258 ``PeerNode``
259   The node that the minor is connected to on the other end
260
261 This command can be used as a reverse lookup (from node and minor) to a
262 given instance, which can be useful when debugging DRBD issues.
263
264 Note that this command queries Ganeti via :manpage:`ganeti-confd(8)`, so
265 it won't be available if support for ``confd`` has not been enabled at
266 build time; furthermore, in Ganeti 2.6 this is only available via the
267 Haskell version of confd (again selected at build time).
268
269 LIST-FIELDS
270 ~~~~~~~~~~~
271
272 **list-fields** [field...]
273
274 Lists available fields for nodes.
275
276
277 LIST-TAGS
278 ~~~~~~~~~
279
280 **list-tags** {*nodename*}
281
282 List the tags of the given node.
283
284 MIGRATE
285 ~~~~~~~
286
287 | **migrate** [-f] [\--non-live] [\--migration-mode=live\|non-live]
288 | [\--ignore-ipolicy] [\--submit] {*node*}
289
290 This command will migrate all instances having the given node as
291 primary to their secondary nodes. This works only for instances
292 having a drbd disk template.
293
294 As for the **gnt-instance migrate** command, the options
295 ``--no-live``, ``--migration-mode`` and ``--no-runtime-changes``
296 can be given to influence the migration type.
297
298 If ``--ignore-ipolicy`` is given any instance policy violations
299 occurring during this operation are ignored.
300
301 See **ganeti(7)** for a description of ``--submit`` and other common
302 options.
303
304 Example::
305
306     # gnt-node migrate node1.example.com
307
308
309 MODIFY
310 ~~~~~~
311
312 | **modify** [-f] [\--submit]
313 | [{-C|\--master-candidate} ``yes|no``]
314 | [{-D|\--drained} ``yes|no``] [{-O|\--offline} ``yes|no``]
315 | [\--master-capable=``yes|no``] [\--vm-capable=``yes|no``] [\--auto-promote]
316 | [{-s|\--secondary-ip} *secondary_ip*]
317 | [\--node-parameters *ndparams*]
318 | [\--node-powered=``yes|no``]
319 | [\--hypervisor-state *hvstate*]
320 | [\--disk-state *diskstate*]
321 | {*node*}
322
323 This command changes the role of the node. Each options takes
324 either a literal yes or no, and only one option should be given as
325 yes. The meaning of the roles and flags are described in the
326 manpage **ganeti(7)**.
327
328 The option ``--node-powered`` can be used to modify state-of-record if
329 it doesn't reflect the reality anymore.
330
331 In case a node is demoted from the master candidate role, the
332 operation will be refused unless you pass the ``--auto-promote``
333 option. This option will cause the operation to lock all cluster nodes
334 (thus it will not be able to run in parallel with most other jobs),
335 but it allows automated maintenance of the cluster candidate pool. If
336 locking all cluster node is too expensive, another option is to
337 promote manually another node to master candidate before demoting the
338 current one.
339
340 Example (setting a node offline, which will demote it from master
341 candidate role if is in that role)::
342
343     # gnt-node modify --offline=yes node1.example.com
344
345 The ``-s (--secondary-ip)`` option can be used to change the node's
346 secondary ip. No drbd instances can be running on the node, while this
347 operation is taking place. Remember that the secondary ip must be
348 reachable from the master secondary ip, when being changed, so be sure
349 that the node has the new IP already configured and active. In order to
350 convert a cluster from single homed to multi-homed or vice versa
351 ``--force`` is needed as well, and the target node for the first change
352 must be the master.
353
354 See **ganeti(7)** for a description of ``--submit`` and other common
355 options.
356
357 Example (setting the node back to online and master candidate)::
358
359     # gnt-node modify --offline=no --master-candidate=yes node1.example.com
360
361
362 REMOVE
363 ~~~~~~
364
365 **remove** {*nodename*}
366
367 Removes a node from the cluster. Instances must be removed or
368 migrated to another cluster before.
369
370 Example::
371
372     # gnt-node remove node5.example.com
373
374
375 REMOVE-TAGS
376 ~~~~~~~~~~~
377
378 **remove-tags** [\--from *file*] {*nodename*} {*tag*...}
379
380 Remove tags from the given node. If any of the tags are not
381 existing on the node, the entire operation will abort.
382
383 If the ``--from`` option is given, the list of tags to be removed will
384 be extended with the contents of that file (each line becomes a tag).
385 In this case, there is not need to pass tags on the command line (if
386 you do, tags from both sources will be removed). A file name of - will
387 be interpreted as stdin.
388
389 VOLUMES
390 ~~~~~~~
391
392 | **volumes** [\--no-headers] [\--human-readable]
393 | [\--separator=*SEPARATOR*] [{-o|\--output} *FIELDS*]
394 | [*node*...]
395
396 Lists all logical volumes and their physical disks from the node(s)
397 provided.
398
399 The ``--no-headers`` option will skip the initial header line. The
400 ``--separator`` option takes an argument which denotes what will be
401 used between the output fields. Both these options are to help
402 scripting.
403
404 The units used to display the numeric values in the output varies,
405 depending on the options given. By default, the values will be
406 formatted in the most appropriate unit. If the ``--separator``
407 option is given, then the values are shown in mebibytes to allow
408 parsing by scripts. In both cases, the ``--units`` option can be
409 used to enforce a given output unit.
410
411 The ``-o (--output)`` option takes a comma-separated list of output
412 fields. The available fields and their meaning are:
413
414 node
415     the node name on which the volume exists
416
417 phys
418     the physical drive (on which the LVM physical volume lives)
419
420 vg
421     the volume group name
422
423 name
424     the logical volume name
425
426 size
427     the logical volume size
428
429 instance
430     The name of the instance to which this volume belongs, or (in case
431     it's an orphan volume) the character "-"
432
433
434 Example::
435
436     # gnt-node volumes node5.example.com
437     Node              PhysDev   VG    Name                                 Size Instance
438     node1.example.com /dev/hdc1 xenvg instance1.example.com-sda_11000.meta 128  instance1.example.com
439     node1.example.com /dev/hdc1 xenvg instance1.example.com-sda_11001.data 256  instance1.example.com
440
441
442 LIST-STORAGE
443 ~~~~~~~~~~~~
444
445 | **list-storage** [\--no-headers] [\--human-readable]
446 | [\--separator=*SEPARATOR*] [\--storage-type=*STORAGE\_TYPE*]
447 | [{-o|\--output} *FIELDS*]
448 | [*node*...]
449
450 Lists the available storage units and their details for the given
451 node(s).
452
453 The ``--no-headers`` option will skip the initial header line. The
454 ``--separator`` option takes an argument which denotes what will be
455 used between the output fields. Both these options are to help
456 scripting.
457
458 The units used to display the numeric values in the output varies,
459 depending on the options given. By default, the values will be
460 formatted in the most appropriate unit. If the ``--separator``
461 option is given, then the values are shown in mebibytes to allow
462 parsing by scripts. In both cases, the ``--units`` option can be
463 used to enforce a given output unit.
464
465 The ``--storage-type`` option can be used to choose a storage unit
466 type. Possible choices are lvm-pv, lvm-vg or file.
467
468 The ``-o (--output)`` option takes a comma-separated list of output
469 fields. The available fields and their meaning are:
470
471 node
472     the node name on which the volume exists
473
474 type
475     the type of the storage unit (currently just what is passed in via
476     ``--storage-type``)
477
478 name
479     the path/identifier of the storage unit
480
481 size
482     total size of the unit; for the file type see a note below
483
484 used
485     used space in the unit; for the file type see a note below
486
487 free
488     available disk space
489
490 allocatable
491     whether we the unit is available for allocation (only lvm-pv can
492     change this setting, the other types always report true)
493
494
495 Note that for the "file" type, the total disk space might not equal
496 to the sum of used and free, due to the method Ganeti uses to
497 compute each of them. The total and free values are computed as the
498 total and free space values for the filesystem to which the
499 directory belongs, but the used space is computed from the used
500 space under that directory *only*, which might not be necessarily
501 the root of the filesystem, and as such there could be files
502 outside the file storage directory using disk space and causing a
503 mismatch in the values.
504
505 Example::
506
507     node1# gnt-node list-storage node2
508     Node  Type   Name        Size Used   Free Allocatable
509     node2 lvm-pv /dev/sda7 673.8G 1.5G 672.3G Y
510     node2 lvm-pv /dev/sdb1 698.6G   0M 698.6G Y
511
512
513 MODIFY-STORAGE
514 ~~~~~~~~~~~~~~
515
516 | **modify-storage** [\--allocatable={yes|no}] [\--submit]
517 | {*node*} {*storage-type*} {*volume-name*}
518
519 Modifies storage volumes on a node. Only LVM physical volumes can
520 be modified at the moment. They have a storage type of "lvm-pv".
521
522 Example::
523
524     # gnt-node modify-storage --allocatable no node5.example.com lvm-pv /dev/sdb1
525
526
527 REPAIR-STORAGE
528 ~~~~~~~~~~~~~~
529
530 | **repair-storage** [\--ignore-consistency] ]\--submit]
531 | {*node*} {*storage-type*} {*volume-name*}
532
533 Repairs a storage volume on a node. Only LVM volume groups can be
534 repaired at this time. They have the storage type "lvm-vg".
535
536 On LVM volume groups, **repair-storage** runs ``vgreduce
537 --removemissing``.
538
539
540
541 **Caution:** Running this command can lead to data loss. Use it with
542 care.
543
544 The ``--ignore-consistency`` option will ignore any inconsistent
545 disks (on the nodes paired with this one). Use of this option is
546 most likely to lead to data-loss.
547
548 Example::
549
550     # gnt-node repair-storage node5.example.com lvm-vg xenvg
551
552
553 POWERCYCLE
554 ~~~~~~~~~~
555
556 **powercycle** [\--yes] [\--force] [\--submit] {*node*}
557
558 This command (tries to) forcefully reboot a node. It is a command
559 that can be used if the node environment is broken, such that the
560 admin can no longer login over SSH, but the Ganeti node daemon is
561 still working.
562
563 Note that this command is not guaranteed to work; it depends on the
564 hypervisor how effective is the reboot attempt. For Linux, this
565 command requires the kernel option ``CONFIG_MAGIC_SYSRQ`` to be
566 enabled.
567
568 The ``--yes`` option can be used to skip confirmation, while the
569 ``--force`` option is needed if the target node is the master
570 node.
571
572 See **ganeti(7)** for a description of ``--submit`` and other common
573 options.
574
575 POWER
576 ~~~~~
577
578 **power** [``--force``] [``--ignore-status``] [``--all``]
579 [``--power-delay``] on|off|cycle|status [*nodes*]
580
581 This command calls out to out-of-band management to change the power
582 state of given node. With ``status`` you get the power status as reported
583 by the out-of-band management script.
584
585 Note that this command will only work if the out-of-band functionality
586 is configured and enabled on the cluster. If this is not the case,
587 please use the **powercycle** command above.
588
589 Using ``--force`` you skip the confirmation to do the operation.
590 Currently this only has effect on ``off`` and ``cycle``. On those two
591 you can *not* operate on the master. However, the command will provide
592 you with the command to invoke to operate on the master nerver-mind.
593 This is considered harmful and Ganeti does not support the use of it.
594
595 Providing ``--ignore-status`` will ignore the offline=N state of a node
596 and continue with power off.
597
598 ``--power-delay`` specifies the time in seconds (factions allowed)
599 waited between powering on the next node. This is by default 2 seconds
600 but can increased if needed with this option.
601
602 *nodes* are optional. If not provided it will call out for every node in
603 the cluster. Except for the ``off`` and ``cycle`` command where you've
604 to explicit use ``--all`` to select all.
605
606
607 HEALTH
608 ~~~~~~
609
610 **health** [*nodes*]
611
612 This command calls out to out-of-band management to ask for the health status
613 of all or given nodes. The health contains the node name and then the items
614 element with their status in a ``item=status`` manner. Where ``item`` is script
615 specific and ``status`` can be one of ``OK``, ``WARNING``, ``CRITICAL`` or
616 ``UNKNOWN``. Items with status ``WARNING`` or ``CRITICAL`` are logged and
617 annotated in the command line output.
618
619
620 RESTRICTED-COMMAND
621 ~~~~~~~~~~~~~~~~~~
622
623 | **restricted-command** [-M] [--sync]
624 | { -g *group* *command* | *command* *nodes*... }
625
626 Executes a restricted command on the specified nodes. Restricted commands are
627 not arbitrary, but must reside in
628 ``@SYSCONFDIR@/ganeti/restricted-commands`` on a node, either as a regular
629 file or as a symlink. The directory must be owned by root and not be
630 world- or group-writable. If a command fails verification or otherwise
631 fails to start, the node daemon log must be consulted for more detailed
632 information.
633
634 Example for running a command on two nodes::
635
636     # gnt-node restricted-command mycommand \
637       node1.example.com node2.example.com
638
639 The ``-g`` option can be used to run a command only on a specific node
640 group, e.g.::
641
642     # gnt-node restricted-command -g default mycommand
643
644 The ``-M`` option can be used to prepend the node name to all command
645 output lines. ``--sync`` forces the opcode to acquire the node lock(s)
646 in exclusive mode.
647
648 .. vim: set textwidth=72 :
649 .. Local Variables:
650 .. mode: rst
651 .. fill-column: 72
652 .. End: