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