Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.rst @ 81dd9bd1

History | View | Annotate | Download (51.2 kB)

1
gnt-instance(8) Ganeti | Version @GANETI_VERSION@
2
=================================================
3

    
4
Name
5
----
6

    
7
gnt-instance - Ganeti instance administration
8

    
9
Synopsis
10
--------
11

    
12
**gnt-instance** {command} [arguments...]
13

    
14
DESCRIPTION
15
-----------
16

    
17
The **gnt-instance** command is used for instance administration in
18
the Ganeti system.
19

    
20
COMMANDS
21
--------
22

    
23
Creation/removal/querying
24
~~~~~~~~~~~~~~~~~~~~~~~~~
25

    
26
ADD
27
^^^
28

    
29
| **add**
30
| {-t {diskless | file \| plain \| drbd}}
31
| {--disk=*N*: {size=*VAL* \| adopt=*LV*}[,vg=*VG*][,metavg=*VG*][,mode=*ro\|rw*]
32
|  \| -s *SIZE*}
33
| [--no-ip-check] [--no-name-check] [--no-start] [--no-install]
34
| [--net=*N* [:options...] \| --no-nics]
35
| [-B *BEPARAMS*]
36
| [-H *HYPERVISOR* [: option=*value*... ]]
37
| [-O, --os-parameters *param*=*value*... ]
38
| [--file-storage-dir *dir\_path*] [--file-driver {loop \| blktap}]
39
| {-n *node[:secondary-node]* \| --iallocator *name*}
40
| {-o *os-type*}
41
| [--submit]
42
| {*instance*}
43

    
44
Creates a new instance on the specified host. The *instance* argument
45
must be in DNS, but depending on the bridge/routing setup, need not be
46
in the same network as the nodes in the cluster.
47

    
48
The ``disk`` option specifies the parameters for the disks of the
49
instance. The numbering of disks starts at zero, and at least one disk
50
needs to be passed. For each disk, either the size or the adoption
51
source needs to be given, and optionally the access mode (read-only or
52
the default of read-write) and the LVM volume group can also be
53
specified (via the ``vg`` key). For DRBD devices, a different VG can
54
be specified for the metadata device using the ``metavg`` key.  The
55
size is interpreted (when no unit is given) in mebibytes. You can also
56
use one of the suffixes *m*, *g* or *t* to specify the exact the units
57
used; these suffixes map to mebibytes, gibibytes and tebibytes.
58

    
59
When using the ``adopt`` key in the disk definition, Ganeti will
60
reuse those volumes (instead of creating new ones) as the
61
instance's disks. Ganeti will rename these volumes to the standard
62
format, and (without installing the OS) will use them as-is for the
63
instance. This allows migrating instances from non-managed mode
64
(e.q. plain KVM with LVM) to being managed via Ganeti. Note that
65
this works only for the \`plain' disk template (see below for
66
template details).
67

    
68
Alternatively, a single-disk instance can be created via the ``-s``
69
option which takes a single argument, the size of the disk. This is
70
similar to the Ganeti 1.2 version (but will only create one disk).
71

    
72
The minimum disk specification is therefore ``--disk 0:size=20G`` (or
73
``-s 20G`` when using the ``-s`` option), and a three-disk instance
74
can be specified as ``--disk 0:size=20G --disk 1:size=4G --disk
75
2:size=100G``.
76

    
77
The ``--no-ip-check`` skips the checks that are done to see if the
78
instance's IP is not already alive (i.e. reachable from the master
79
node).
80

    
81
The ``--no-name-check`` skips the check for the instance name via
82
the resolver (e.g. in DNS or /etc/hosts, depending on your setup).
83
Since the name check is used to compute the IP address, if you pass
84
this option you must also pass the ``--no-ip-check`` option.
85

    
86
If you don't wat the instance to automatically start after
87
creation, this is possible via the ``--no-start`` option. This will
88
leave the instance down until a subsequent **gnt-instance start**
89
command.
90

    
91
The NICs of the instances can be specified via the ``--net``
92
option. By default, one NIC is created for the instance, with a
93
random MAC, and set up according the the cluster level nic
94
parameters. Each NIC can take these parameters (all optional):
95

    
96

    
97

    
98
mac
99
    either a value or 'generate' to generate a new unique MAC
100

    
101
ip
102
    specifies the IP address assigned to the instance from the Ganeti
103
    side (this is not necessarily what the instance will use, but what
104
    the node expects the instance to use)
105

    
106
mode
107
    specifies the connection mode for this nic: routed or bridged.
108

    
109
link
110
    in bridged mode specifies the bridge to attach this NIC to, in
111
    routed mode it's intended to differentiate between different
112
    routing tables/instance groups (but the meaning is dependent on the
113
    network script, see gnt-cluster(8) for more details)
114

    
115

    
116
Of these "mode" and "link" are nic parameters, and inherit their
117
default at cluster level.
118
Alternatively, if no network is desired for the instance, you can
119
prevent the default of one NIC with the ``--no-nics`` option.
120

    
121
The ``-o`` options specifies the operating system to be installed.
122
The available operating systems can be listed with **gnt-os list**.
123
Passing ``--no-install`` will however skip the OS installation,
124
allowing a manual import if so desired. Note that the
125
no-installation mode will automatically disable the start-up of the
126
instance (without an OS, it most likely won't be able to start-up
127
successfully).
128

    
129
The ``-B`` option specifies the backend parameters for the
130
instance. If no such parameters are specified, the values are
131
inherited from the cluster. Possible parameters are:
132

    
133
memory
134
    the memory size of the instance; as usual, suffixes can be used to
135
    denote the unit, otherwise the value is taken in mebibites
136

    
137
vcpus
138
    the number of VCPUs to assign to the instance (if this value makes
139
    sense for the hypervisor)
140

    
141
auto\_balance
142
    whether the instance is considered in the N+1 cluster checks
143
    (enough redundancy in the cluster to survive a node failure)
144

    
145

    
146
The ``-H`` option specified the hypervisor to use for the instance
147
(must be one of the enabled hypervisors on the cluster) and
148
optionally custom parameters for this instance. If not other
149
options are used (i.e. the invocation is just -H *NAME*) the
150
instance will inherit the cluster options. The defaults below show
151
the cluster defaults at cluster creation time.
152

    
153
The possible hypervisor options are as follows:
154

    
155
boot\_order
156
    Valid for the Xen HVM and KVM hypervisors.
157

    
158
    A string value denoting the boot order. This has different meaning
159
    for the Xen HVM hypervisor and for the KVM one.
160

    
161
    For Xen HVM, The boot order is a string of letters listing the boot
162
    devices, with valid device letters being:
163

    
164

    
165

    
166
    a
167
        floppy drive
168

    
169
    c
170
        hard disk
171

    
172
    d
173
        CDROM drive
174

    
175
    n
176
        network boot (PXE)
177

    
178

    
179
    The default is not to set an HVM boot order which is interpreted as
180
    'dc'.
181

    
182
    For KVM the boot order is either "floppy", "cdrom", "disk" or "network".
183
    Please note that older versions of KVM couldn't netboot from virtio
184
    interfaces. This has been fixed in more recent versions and is
185
    confirmed to work at least with qemu-kvm 0.11.1.
186

    
187
blockdev\_prefix
188
    Valid for the Xen HVM and PVM hypervisors.
189

    
190
    Relevant to nonpvops guest kernels, in which the disk device names are
191
    given by the host.  Allows to specify 'xvd', which helps run Red Hat based
192
    installers, driven by anaconda.
193

    
194
floppy\_image\_path
195
    Valid for the KVM hypervisor.
196

    
197
    The path to a floppy disk image to attach to the instance.
198
    This is useful to install Windows operating systems on Virt/IO disks because
199
    you can specify here the floppy for the drivers at installation time.
200

    
201
cdrom\_image\_path
202
    Valid for the Xen HVM and KVM hypervisors.
203

    
204
    The path to a CDROM image to attach to the instance.
205

    
206
cdrom2\_image\_path
207
    Valid for the KVM hypervisor.
208

    
209
    The path to a second CDROM image to attach to the instance.
210
    **NOTE**: This image can't be used to boot the system. To do that
211
    you have to use the 'cdrom\_image\_path' option.
212

    
213
nic\_type
214
    Valid for the Xen HVM and KVM hypervisors.
215

    
216
    This parameter determines the way the network cards are presented
217
    to the instance. The possible options are:
218

    
219

    
220

    
221
    rtl8139 (default for Xen HVM) (HVM & KVM)
222
    ne2k\_isa (HVM & KVM)
223
    ne2k\_pci (HVM & KVM)
224
    i82551 (KVM)
225
    i82557b (KVM)
226
    i82559er (KVM)
227
    pcnet (KVM)
228
    e1000 (KVM)
229
    paravirtual (default for KVM) (HVM & KVM)
230

    
231

    
232
disk\_type
233
    Valid for the Xen HVM and KVM hypervisors.
234

    
235
    This parameter determines the way the disks are presented to the
236
    instance. The possible options are:
237

    
238

    
239

    
240
    ioemu (default for HVM & KVM) (HVM & KVM)
241
    ide (HVM & KVM)
242
    scsi (KVM)
243
    sd (KVM)
244
    mtd (KVM)
245
    pflash (KVM)
246

    
247

    
248
cdrom\_disk\_type
249
    Valid for the KVM hypervisor.
250

    
251
    This parameter determines the way the cdroms disks are presented to the
252
    instance. The default behavior is to get the same value of the eariler
253
    parameter (disk_type). The possible options are:
254

    
255

    
256

    
257
    paravirtual
258
    ide
259
    scsi
260
    sd
261
    mtd
262
    pflash
263

    
264

    
265
vnc\_bind\_address
266
    Valid for the Xen HVM and KVM hypervisors.
267

    
268
    Specifies the address that the VNC listener for this instance
269
    should bind to. Valid values are IPv4 addresses. Use the address
270
    0.0.0.0 to bind to all available interfaces (this is the default)
271
    or specify the address of one of the interfaces on the node to
272
    restrict listening to that interface.
273

    
274
vnc\_tls
275
    Valid for the KVM hypervisor.
276

    
277
    A boolean option that controls whether the VNC connection is
278
    secured with TLS.
279

    
280
vnc\_x509\_path
281
    Valid for the KVM hypervisor.
282

    
283
    If ``vnc_tls`` is enabled, this options specifies the path to the
284
    x509 certificate to use.
285

    
286
vnc\_x509\_verify
287
    Valid for the KVM hypervisor.
288

    
289
acpi
290
    Valid for the Xen HVM and KVM hypervisors.
291

    
292
    A boolean option that specifies if the hypervisor should enable
293
    ACPI support for this instance. By default, ACPI is disabled.
294

    
295
pae
296
    Valid for the Xen HVM and KVM hypervisors.
297

    
298
    A boolean option that specifies if the hypervisor should enabled
299
    PAE support for this instance. The default is false, disabling PAE
300
    support.
301

    
302
use\_localtime
303
    Valid for the Xen HVM and KVM hypervisors.
304

    
305
    A boolean option that specifies if the instance should be started
306
    with its clock set to the localtime of the machine (when true) or
307
    to the UTC (When false). The default is false, which is useful for
308
    Linux/Unix machines; for Windows OSes, it is recommended to enable
309
    this parameter.
310

    
311
kernel\_path
312
    Valid for the Xen PVM and KVM hypervisors.
313

    
314
    This option specifies the path (on the node) to the kernel to boot
315
    the instance with. Xen PVM instances always require this, while for
316
    KVM if this option is empty, it will cause the machine to load the
317
    kernel from its disks.
318

    
319
kernel\_args
320
    Valid for the Xen PVM and KVM hypervisors.
321

    
322
    This options specifies extra arguments to the kernel that will be
323
    loaded. device. This is always used for Xen PVM, while for KVM it
324
    is only used if the ``kernel_path`` option is also specified.
325

    
326
    The default setting for this value is simply ``"ro"``, which mounts
327
    the root disk (initially) in read-only one. For example, setting
328
    this to single will cause the instance to start in single-user
329
    mode.
330

    
331
initrd\_path
332
    Valid for the Xen PVM and KVM hypervisors.
333

    
334
    This option specifies the path (on the node) to the initrd to boot
335
    the instance with. Xen PVM instances can use this always, while for
336
    KVM if this option is only used if the ``kernel_path`` option is
337
    also specified. You can pass here either an absolute filename (the
338
    path to the initrd) if you want to use an initrd, or use the format
339
    no\_initrd\_path for no initrd.
340

    
341
root\_path
342
    Valid for the Xen PVM and KVM hypervisors.
343

    
344
    This options specifies the name of the root device. This is always
345
    needed for Xen PVM, while for KVM it is only used if the
346
    ``kernel_path`` option is also specified.
347

    
348
serial\_console
349
    Valid for the KVM hypervisor.
350

    
351
    This boolean option specifies whether to emulate a serial console
352
    for the instance.
353

    
354
disk\_cache
355
    Valid for the KVM hypervisor.
356

    
357
    The disk cache mode. It can be either default to not pass any cache
358
    option to KVM, or one of the KVM cache modes: none (for direct
359
    I/O), writethrough (to use the host cache but report completion to
360
    the guest only when the host has committed the changes to disk) or
361
    writeback (to use the host cache and report completion as soon as
362
    the data is in the host cache). Note that there are special
363
    considerations for the cache mode depending on version of KVM used
364
    and disk type (always raw file under Ganeti), please refer to the
365
    KVM documentation for more details.
366

    
367
security\_model
368
    Valid for the KVM hypervisor.
369

    
370
    The security model for kvm. Currently one of "none", "user" or
371
    "pool". Under "none", the default, nothing is done and instances
372
    are run as the Ganeti daemon user (normally root).
373

    
374
    Under "user" kvm will drop privileges and become the user specified
375
    by the security\_domain parameter.
376

    
377
    Under "pool" a global cluster pool of users will be used, making
378
    sure no two instances share the same user on the same node. (this
379
    mode is not implemented yet)
380

    
381
security\_domain
382
    Valid for the KVM hypervisor.
383

    
384
    Under security model "user" the username to run the instance under.
385
    It must be a valid username existing on the host.
386

    
387
    Cannot be set under security model "none" or "pool".
388

    
389
kvm\_flag
390
    Valid for the KVM hypervisor.
391

    
392
    If "enabled" the -enable-kvm flag is passed to kvm. If "disabled"
393
    -disable-kvm is passed. If unset no flag is passed, and the default
394
    running mode for your kvm binary will be used.
395

    
396
mem\_path
397
    Valid for the KVM hypervisor.
398

    
399
    This option passes the -mem-path argument to kvm with the path (on
400
    the node) to the mount point of the hugetlbfs file system, along
401
    with the -mem-prealloc argument too.
402

    
403
use\_chroot
404
    Valid for the KVM hypervisor.
405

    
406
    This boolean option determines wether to run the KVM instance in a
407
    chroot directory.
408

    
409
    If it is set to ``true``, an empty directory is created before
410
    starting the instance and its path is passed via the -chroot flag
411
    to kvm. The directory is removed when the instance is stopped.
412

    
413
    It is set to ``false`` by default.
414

    
415
migration\_downtime
416
    Valid for the KVM hypervisor.
417

    
418
    The maximum amount of time (in ms) a KVM instance is allowed to be
419
    frozen during a live migration, in order to copy dirty memory
420
    pages. Default value is 30ms, but you may need to increase this
421
    value for busy instances.
422

    
423
    This option is only effective with kvm versions >= 87 and qemu-kvm
424
    versions >= 0.11.0.
425

    
426
cpu\_mask
427
    Valid for the LXC hypervisor.
428

    
429
    The processes belonging to the given instance are only scheduled on
430
    the specified CPUs.
431

    
432
    The parameter format is a comma-separated list of CPU IDs or CPU ID
433
    ranges. The ranges are defined by a lower and higher boundary,
434
    separated by a dash. The boundaries are inclusive.
435

    
436
usb\_mouse
437
    Valid for the KVM hypervisor.
438

    
439
    This option specifies the usb mouse type to be used. It can be
440
    "mouse" or "tablet". When using VNC it's recommended to set it to
441
    "tablet".
442

    
443

    
444
The ``-O`` (``--os-parameters``) option allows customisation of the OS
445
parameters. The actual parameter names and values depends on the OS
446
being used, but the syntax is the same key=value. For example, setting
447
a hypothetical ``dhcp`` parameter to yes can be achieved by::
448

    
449
    gnt-instance add -O dhcp=yes ...
450

    
451

    
452
The ``--iallocator`` option specifies the instance allocator plugin
453
to use. If you pass in this option the allocator will select nodes
454
for this instance automatically, so you don't need to pass them
455
with the ``-n`` option. For more information please refer to the
456
instance allocator documentation.
457

    
458
The ``-t`` options specifies the disk layout type for the instance.
459
The available choices are:
460

    
461

    
462

    
463
diskless
464
    This creates an instance with no disks. Its useful for testing only
465
    (or other special cases).
466

    
467
file
468
    Disk devices will be regular files.
469

    
470
plain
471
    Disk devices will be logical volumes.
472

    
473
drbd
474
    Disk devices will be drbd (version 8.x) on top of lvm volumes.
475

    
476

    
477
The optional second value of the ``--node`` is used for the drbd
478
template type and specifies the remote node.
479

    
480
If you do not want gnt-instance to wait for the disk mirror to be
481
synced, use the ``--no-wait-for-sync`` option.
482

    
483
The ``--file-storage-dir`` specifies the relative path under the
484
cluster-wide file storage directory to store file-based disks. It is
485
useful for having different subdirectories for different
486
instances. The full path of the directory where the disk files are
487
stored will consist of cluster-wide file storage directory + optional
488
subdirectory + instance name. Example:
489
``@RPL_FILE_STORAGE_DIR@``*/mysubdir/instance1.example.com*. This
490
option is only relevant for instances using the file storage backend.
491

    
492
The ``--file-driver`` specifies the driver to use for file-based
493
disks. Note that currently these drivers work with the xen
494
hypervisor only. This option is only relevant for instances using
495
the file storage backend. The available choices are:
496

    
497

    
498

    
499
loop
500
    Kernel loopback driver. This driver uses loopback devices to access
501
    the filesystem within the file. However, running I/O intensive
502
    applications in your instance using the loop driver might result in
503
    slowdowns. Furthermore, if you use the loopback driver consider
504
    increasing the maximum amount of loopback devices (on most systems
505
    it's 8) using the max\_loop param.
506

    
507
blktap
508
    The blktap driver (for Xen hypervisors). In order to be able to use
509
    the blktap driver you should check if the 'blktapctrl' user space
510
    disk agent is running (usually automatically started via xend).
511
    This user-level disk I/O interface has the advantage of better
512
    performance. Especially if you use a network file system (e.g. NFS)
513
    to store your instances this is the recommended choice.
514

    
515

    
516
The ``--submit`` option is used to send the job to the master
517
daemon but not wait for its completion. The job ID will be shown so
518
that it can be examined via **gnt-job info**.
519

    
520
Example::
521

    
522
    # gnt-instance add -t file --disk 0:size=30g -B memory=512 -o debian-etch \
523
      -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
524
    # gnt-instance add -t plain --disk 0:size=30g -B memory=512 -o debian-etch \
525
      -n node1.example.com instance1.example.com
526
    # gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
527
      -B memory=512 -o debian-etch -n node1.example.com instance1.example.com
528
    # gnt-instance add -t drbd --disk 0:size=30g -B memory=512 -o debian-etch \
529
      -n node1.example.com:node2.example.com instance2.example.com
530

    
531

    
532
BATCH-CREATE
533
^^^^^^^^^^^^
534

    
535
**batch-create** {instances\_file.json}
536

    
537
This command (similar to the Ganeti 1.2 **batcher** tool) submits
538
multiple instance creation jobs based on a definition file. The
539
instance configurations do not encompass all the possible options
540
for the **add** command, but only a subset.
541

    
542
The instance file should be a valid-formed JSON file, containing a
543
dictionary with instance name and instance parameters. The accepted
544
parameters are:
545

    
546

    
547

    
548
disk\_size
549
    The size of the disks of the instance.
550

    
551
disk\_template
552
    The disk template to use for the instance, the same as in the
553
    **add** command.
554

    
555
backend
556
    A dictionary of backend parameters.
557

    
558
hypervisor
559
    A dictionary with a single key (the hypervisor name), and as value
560
    the hypervisor options. If not passed, the default hypervisor and
561
    hypervisor options will be inherited.
562

    
563
mac, ip, mode, link
564
    Specifications for the one NIC that will be created for the
565
    instance. 'bridge' is also accepted as a backwards compatibile
566
    key.
567

    
568
nics
569
    List of nics that will be created for the instance. Each entry
570
    should be a dict, with mac, ip, mode and link as possible keys.
571
    Please don't provide the "mac, ip, mode, link" parent keys if you
572
    use this method for specifying nics.
573

    
574
primary\_node, secondary\_node
575
    The primary and optionally the secondary node to use for the
576
    instance (in case an iallocator script is not used).
577

    
578
iallocator
579
    Instead of specifying the nodes, an iallocator script can be used
580
    to automatically compute them.
581

    
582
start
583
    whether to start the instance
584

    
585
ip\_check
586
    Skip the check for already-in-use instance; see the description in
587
    the **add** command for details.
588

    
589
name\_check
590
    Skip the name check for instances; see the description in the
591
    **add** command for details.
592

    
593
file\_storage\_dir, file\_driver
594
    Configuration for the file disk type, see the **add** command for
595
    details.
596

    
597

    
598
A simple definition for one instance can be (with most of the
599
parameters taken from the cluster defaults)::
600

    
601
    {
602
      "instance3": {
603
        "template": "drbd",
604
        "os": "debootstrap",
605
        "disk_size": ["25G"],
606
        "iallocator": "dumb"
607
      },
608
      "instance5": {
609
        "template": "drbd",
610
        "os": "debootstrap",
611
        "disk_size": ["25G"],
612
        "iallocator": "dumb",
613
        "hypervisor": "xen-hvm",
614
        "hvparams": {"acpi": true},
615
        "backend": {"memory": 512}
616
      }
617
    }
618

    
619
The command will display the job id for each submitted instance, as
620
follows::
621

    
622
    # gnt-instance batch-create instances.json
623
    instance3: 11224
624
    instance5: 11225
625

    
626
REMOVE
627
^^^^^^
628

    
629
**remove** [--ignore-failures] [--shutdown-timeout=*N*] [--submit]
630
{*instance*}
631

    
632
Remove an instance. This will remove all data from the instance and
633
there is *no way back*. If you are not sure if you use an instance
634
again, use **shutdown** first and leave it in the shutdown state
635
for a while.
636

    
637
The ``--ignore-failures`` option will cause the removal to proceed
638
even in the presence of errors during the removal of the instance
639
(e.g. during the shutdown or the disk removal). If this option is
640
not given, the command will stop at the first error.
641

    
642
The ``--shutdown-timeout`` is used to specify how much time to wait
643
before forcing the shutdown (e.g. ``xm destroy`` in Xen, killing the
644
kvm process for KVM, etc.). By default two minutes are given to each
645
instance to stop.
646

    
647
The ``--submit`` option is used to send the job to the master
648
daemon but not wait for its completion. The job ID will be shown so
649
that it can be examined via **gnt-job info**.
650

    
651
Example::
652

    
653
    # gnt-instance remove instance1.example.com
654

    
655

    
656
LIST
657
^^^^
658

    
659
| **list**
660
| [--no-headers] [--separator=*SEPARATOR*] [--units=*UNITS*] [-v]
661
| [-o *[+]FIELD,...*] [instance...]
662

    
663
Shows the currently configured instances with memory usage, disk
664
usage, the node they are running on, and their run status.
665

    
666
The ``--no-headers`` option will skip the initial header line. The
667
``--separator`` option takes an argument which denotes what will be
668
used between the output fields. Both these options are to help
669
scripting.
670

    
671
The units used to display the numeric values in the output varies,
672
depending on the options given. By default, the values will be
673
formatted in the most appropriate unit. If the ``--separator``
674
option is given, then the values are shown in mebibytes to allow
675
parsing by scripts. In both cases, the ``--units`` option can be
676
used to enforce a given output unit.
677

    
678
The ``-v`` option activates verbose mode, which changes the display of
679
special field states (see **ganeti(7)**).
680

    
681
The ``-o`` option takes a comma-separated list of output fields.
682
The available fields and their meaning are:
683

    
684

    
685
name
686
    the instance name
687

    
688
os
689
    the OS of the instance
690

    
691
pnode
692
    the primary node of the instance
693

    
694
snodes
695
    comma-separated list of secondary nodes for the instance; usually
696
    this will be just one node
697

    
698
admin\_state
699
    the desired state of the instance (either "yes" or "no" denoting
700
    the instance should run or not)
701

    
702
disk\_template
703
    the disk template of the instance
704

    
705
oper\_state
706
    the actual state of the instance; can be one of the values
707
    "running", "stopped", "(node down)"
708

    
709
status
710
    combined form of ``admin_state`` and ``oper_stat``; this can be one of:
711
    ``ERROR_nodedown`` if the node of the instance is down, ``ERROR_down`` if
712
    the instance should run but is down, ``ERROR_up`` if the instance should be
713
    stopped but is actually running, ``ERROR_wrongnode`` if the instance is
714
    running but not on the primary, ``ADMIN_down`` if the instance has been
715
    stopped (and is stopped) and ``running`` if the instance is set to be
716
    running (and is running)
717

    
718
oper\_ram
719
    the actual memory usage of the instance as seen by the hypervisor
720

    
721
oper\_vcpus
722
    the actual number of VCPUs the instance is using as seen by the
723
    hypervisor
724

    
725
ip
726
    the ip address Ganeti recognizes as associated with the first
727
    instance interface
728

    
729
mac
730
    the first instance interface MAC address
731

    
732
nic\_mode
733
    the mode of the first instance NIC (routed or bridged)
734

    
735
nic\_link
736
    the link of the first instance NIC
737

    
738
sda\_size
739
    the size of the instance's first disk
740

    
741
sdb\_size
742
    the size of the instance's second disk, if any
743

    
744
vcpus
745
    the number of VCPUs allocated to the instance
746

    
747
tags
748
    comma-separated list of the instances's tags
749

    
750
serial\_no
751
    the so called 'serial number' of the instance; this is a numeric
752
    field that is incremented each time the instance is modified, and
753
    it can be used to track modifications
754

    
755
ctime
756
    the creation time of the instance; note that this field contains
757
    spaces and as such it's harder to parse
758

    
759
    if this attribute is not present (e.g. when upgrading from older
760
    versions), then "N/A" will be shown instead
761

    
762
mtime
763
    the last modification time of the instance; note that this field
764
    contains spaces and as such it's harder to parse
765

    
766
    if this attribute is not present (e.g. when upgrading from older
767
    versions), then "N/A" will be shown instead
768

    
769
uuid
770
    Show the UUID of the instance (generated automatically by Ganeti)
771

    
772
network\_port
773
    If the instance has a network port assigned to it (e.g. for VNC
774
    connections), this will be shown, otherwise - will be displayed.
775

    
776
beparams
777
    A text format of the entire beparams for the instance. It's more
778
    useful to select individual fields from this dictionary, see
779
    below.
780

    
781
disk.count
782
    The number of instance disks.
783

    
784
disk.size/N
785
    The size of the instance's Nth disk. This is a more generic form of
786
    the sda\_size and sdb\_size fields.
787

    
788
disk.sizes
789
    A comma-separated list of the disk sizes for this instance.
790

    
791
disk\_usage
792
    The total disk space used by this instance on each of its nodes.
793
    This is not the instance-visible disk size, but the actual disk
794
    "cost" of the instance.
795

    
796
nic.mac/N
797
    The MAC of the Nth instance NIC.
798

    
799
nic.ip/N
800
    The IP address of the Nth instance NIC.
801

    
802
nic.mode/N
803
    The mode of the Nth instance NIC
804

    
805
nic.link/N
806
    The link of the Nth instance NIC
807

    
808
nic.macs
809
    A comma-separated list of all the MACs of the instance's NICs.
810

    
811
nic.ips
812
    A comma-separated list of all the IP addresses of the instance's
813
    NICs.
814

    
815
nic.modes
816
    A comma-separated list of all the modes of the instance's NICs.
817

    
818
nic.links
819
    A comma-separated list of all the link parameters of the instance's
820
    NICs.
821

    
822
nic.count
823
    The number of instance nics.
824

    
825
hv/*NAME*
826
    The value of the hypervisor parameter called *NAME*. For details of
827
    what hypervisor parameters exist and their meaning, see the **add**
828
    command.
829

    
830
be/memory
831
    The configured memory for the instance.
832

    
833
be/vcpus
834
    The configured number of VCPUs for the instance.
835

    
836
be/auto\_balance
837
    Whether the instance is considered in N+1 checks.
838

    
839

    
840
If the value of the option starts with the character ``+``, the new
841
field(s) will be added to the default list. This allows to quickly
842
see the default list plus a few other fields, instead of retyping
843
the entire list of fields.
844

    
845
There is a subtle grouping about the available output fields: all
846
fields except for ``oper_state``, ``oper_ram``, ``oper_vcpus`` and
847
``status`` are configuration value and not run-time values. So if
848
you don't select any of the these fields, the query will be
849
satisfied instantly from the cluster configuration, without having
850
to ask the remote nodes for the data. This can be helpful for big
851
clusters when you only want some data and it makes sense to specify
852
a reduced set of output fields.
853

    
854
The default output field list is: name, os, pnode, admin\_state,
855
oper\_state, oper\_ram.
856

    
857

    
858
LIST-FIELDS
859
~~~~~~~~~~~
860

    
861
**list-fields** [field...]
862

    
863
Lists available fields for instances.
864

    
865

    
866
INFO
867
^^^^
868

    
869
**info** [-s \| --static] [--roman] {--all \| *instance*}
870

    
871
Show detailed information about the given instance(s). This is
872
different from **list** as it shows detailed data about the
873
instance's disks (especially useful for the drbd disk template).
874

    
875
If the option ``-s`` is used, only information available in the
876
configuration file is returned, without querying nodes, making the
877
operation faster.
878

    
879
Use the ``--all`` to get info about all instances, rather than
880
explicitly passing the ones you're interested in.
881

    
882
The ``--roman`` option can be used to cause envy among people who
883
like ancient cultures, but are stuck with non-latin-friendly
884
cluster virtualization technologies.
885

    
886
MODIFY
887
^^^^^^
888

    
889
| **modify**
890
| [-H *HYPERVISOR\_PARAMETERS*]
891
| [-B *BACKEND\_PARAMETERS*]
892
| [--net add*[:options]* \| --net remove \| --net *N:options*]
893
| [--disk add:size=*SIZE*[,vg=*VG*][,metavg=*VG*] \| --disk remove \|
894
|  --disk *N*:mode=*MODE*]
895
| [-t plain | -t drbd -n *new_secondary*]
896
| [--os-type=*OS* [--force-variant]]
897
| [-O, --os-parameters *param*=*value*... ]
898
| [--submit]
899
| {*instance*}
900

    
901
Modifies the memory size, number of vcpus, ip address, MAC address
902
and/or nic parameters for an instance. It can also add and remove
903
disks and NICs to/from the instance. Note that you need to give at
904
least one of the arguments, otherwise the command complains.
905

    
906
The ``-H``, ``-B`` and ``-O`` options specifies hypervisor, backend
907
and OS parameter options in the form of name=value[,...]. For details
908
which options can be specified, see the **add** command.
909

    
910
The ``-t`` option will change the disk template of the instance.
911
Currently only conversions between the plain and drbd disk templates
912
are supported, and the instance must be stopped before attempting the
913
conversion. When changing from the plain to the drbd disk template, a
914
new secondary node must be specified via the ``-n`` option.
915

    
916
The ``--disk add:size=``*SIZE* option adds a disk to the instance. The
917
optional ``vg=``*VG* option specifies LVM volume group other than
918
default vg to create the disk on. For DRBD disks, the ``metavg=``*VG*
919
option specifies the volume group for the metadata device. The
920
``--disk remove`` option will remove the last disk of the
921
instance. The ``--disk`` *N*``:mode=``*MODE* option will change the
922
mode of the Nth disk of the instance between read-only (``ro``) and
923
read-write (``rw``).
924

    
925
The ``--net add:``*options* option will add a new NIC to the
926
instance. The available options are the same as in the **add** command
927
(mac, ip, link, mode). The ``--net remove`` will remove the last NIC
928
of the instance, while the ``--net`` *N*:*options* option will
929
change the parameters of the Nth instance NIC.
930

    
931
The option ``--os-type`` will change the OS name for the instance
932
(without reinstallation). In case an OS variant is specified that
933
is not found, then by default the modification is refused, unless
934
``--force-variant`` is passed. An invalid OS will also be refused,
935
unless the ``--force`` option is given.
936

    
937
The ``--submit`` option is used to send the job to the master
938
daemon but not wait for its completion. The job ID will be shown so
939
that it can be examined via **gnt-job info**.
940

    
941
All the changes take effect at the next restart. If the instance is
942
running, there is no effect on the instance.
943

    
944
REINSTALL
945
^^^^^^^^^
946

    
947
| **reinstall** [-o *os-type*] [--select-os] [-f *force*]
948
| [--force-multiple]
949
| [--instance \| --node \| --primary \| --secondary \| --all]
950
| [-O *OS\_PARAMETERS*] [--submit] {*instance*...}
951

    
952
Reinstalls the operating system on the given instance(s). The
953
instance(s) must be stopped when running this command. If the
954
``--os-type`` is specified, the operating system is changed.
955

    
956
The ``--select-os`` option switches to an interactive OS reinstall.
957
The user is prompted to select the OS template from the list of
958
available OS templates. OS parameters can be overridden using ``-O``
959
(more documentation for this option under the **add** command).
960

    
961
Since this is a potentially dangerous command, the user will be
962
required to confirm this action, unless the ``-f`` flag is passed.
963
When multiple instances are selected (either by passing multiple
964
arguments or by using the ``--node``, ``--primary``,
965
``--secondary`` or ``--all`` options), the user must pass the
966
``--force-multiple`` options to skip the interactive confirmation.
967

    
968
The ``--submit`` option is used to send the job to the master
969
daemon but not wait for its completion. The job ID will be shown so
970
that it can be examined via **gnt-job info**.
971

    
972
RENAME
973
^^^^^^
974

    
975
| **rename** [--no-ip-check] [--no-name-check] [--submit]
976
| {*instance*} {*new\_name*}
977

    
978
Renames the given instance. The instance must be stopped when
979
running this command. The requirements for the new name are the
980
same as for adding an instance: the new name must be resolvable and
981
the IP it resolves to must not be reachable (in order to prevent
982
duplicate IPs the next time the instance is started). The IP test
983
can be skipped if the ``--no-ip-check`` option is passed.
984

    
985
The ``--no-name-check`` skips the check for the new instance name
986
via the resolver (e.g. in DNS or /etc/hosts, depending on your
987
setup). Since the name check is used to compute the IP address, if
988
you pass this option you must also pass the ``--no-ip-check``
989
option.
990

    
991
The ``--submit`` option is used to send the job to the master
992
daemon but not wait for its completion. The job ID will be shown so
993
that it can be examined via **gnt-job info**.
994

    
995
Starting/stopping/connecting to console
996
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
997

    
998
STARTUP
999
^^^^^^^
1000

    
1001
| **startup**
1002
| [--force] [--ignore-offline]
1003
| [--force-multiple]
1004
| [--instance \| --node \| --primary \| --secondary \| --all \|
1005
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
1006
| [-H ``key=value...``] [-B ``key=value...``]
1007
| [--submit]
1008
| {*name*...}
1009

    
1010
Starts one or more instances, depending on the following options.
1011
The four available modes are:
1012

    
1013

    
1014
--instance
1015
    will start the instances given as arguments (at least one argument
1016
    required); this is the default selection
1017

    
1018
--node
1019
    will start the instances who have the given node as either primary
1020
    or secondary
1021

    
1022
--primary
1023
    will start all instances whose primary node is in the list of nodes
1024
    passed as arguments (at least one node required)
1025

    
1026
--secondary
1027
    will start all instances whose secondary node is in the list of
1028
    nodes passed as arguments (at least one node required)
1029

    
1030
--all
1031
    will start all instances in the cluster (no arguments accepted)
1032

    
1033
--tags
1034
    will start all instances in the cluster with the tags given as
1035
    arguments
1036

    
1037
--node-tags
1038
    will start all instances in the cluster on nodes with the tags
1039
    given as arguments
1040

    
1041
--pri-node-tags
1042
    will start all instances in the cluster on primary nodes with the
1043
    tags given as arguments
1044

    
1045
--sec-node-tags
1046
    will start all instances in the cluster on secondary nodes with the
1047
    tags given as arguments
1048

    
1049

    
1050
Note that although you can pass more than one selection option, the
1051
last one wins, so in order to guarantee the desired result, don't
1052
pass more than one such option.
1053

    
1054
Use ``--force`` to start even if secondary disks are failing.
1055
``--ignore-offline`` can be used to ignore offline primary nodes
1056
and mark the instance as started even if the primary is not
1057
available.
1058

    
1059
The ``--force-multiple`` will skip the interactive confirmation in
1060
the case the more than one instance will be affected.
1061

    
1062
The ``-H`` and ``-B`` options specify temporary hypervisor and
1063
backend parameters that can be used to start an instance with
1064
modified parameters. They can be useful for quick testing without
1065
having to modify an instance back and forth, e.g.::
1066

    
1067
    # gnt-instance start -H root_args="single" instance1
1068
    # gnt-instance start -B memory=2048 instance2
1069

    
1070

    
1071
The first form will start the instance instance1 in single-user
1072
mode, and the instance instance2 with 2GB of RAM (this time only,
1073
unless that is the actual instance memory size already). Note that
1074
the values override the instance parameters (and not extend them):
1075
an instance with "root\_args=ro" when started with -H
1076
root\_args=single will result in "single", not "ro single".
1077
The ``--submit`` option is used to send the job to the master
1078
daemon but not wait for its completion. The job ID will be shown so
1079
that it can be examined via **gnt-job info**.
1080

    
1081
Example::
1082

    
1083
    # gnt-instance start instance1.example.com
1084
    # gnt-instance start --node node1.example.com node2.example.com
1085
    # gnt-instance start --all
1086

    
1087

    
1088
SHUTDOWN
1089
^^^^^^^^
1090

    
1091
| **shutdown**
1092
| [--timeout=*N*]
1093
| [--force-multiple] [--ignore-offline]
1094
| [--instance \| --node \| --primary \| --secondary \| --all \|
1095
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
1096
| [--submit]
1097
| {*name*...}
1098

    
1099
Stops one or more instances. If the instance cannot be cleanly
1100
stopped during a hardcoded interval (currently 2 minutes), it will
1101
forcibly stop the instance (equivalent to switching off the power
1102
on a physical machine).
1103

    
1104
The ``--timeout`` is used to specify how much time to wait before
1105
forcing the shutdown (e.g. ``xm destroy`` in Xen, killing the kvm
1106
process for KVM, etc.). By default two minutes are given to each
1107
instance to stop.
1108

    
1109
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1110
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1111
``--sec-node-tags`` options are similar as for the **startup**
1112
command and they influence the actual instances being shutdown.
1113

    
1114
The ``--submit`` option is used to send the job to the master
1115
daemon but not wait for its completion. The job ID will be shown so
1116
that it can be examined via **gnt-job info**.
1117

    
1118
``--ignore-offline`` can be used to ignore offline primary nodes
1119
and force the instance to be marked as stopped. This option should
1120
be used with care as it can lead to an inconsistent cluster state.
1121

    
1122
Example::
1123

    
1124
    # gnt-instance shutdown instance1.example.com
1125
    # gnt-instance shutdown --all
1126

    
1127

    
1128
REBOOT
1129
^^^^^^
1130

    
1131
| **reboot**
1132
| [--type=*REBOOT-TYPE*]
1133
| [--ignore-secondaries]
1134
| [--shutdown-timeout=*N*]
1135
| [--force-multiple]
1136
| [--instance \| --node \| --primary \| --secondary \| --all \|
1137
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
1138
| [--submit]
1139
| [*name*...]
1140

    
1141
Reboots one or more instances. The type of reboot depends on the
1142
value of ``--type``. A soft reboot does a hypervisor reboot, a hard
1143
reboot does a instance stop, recreates the hypervisor config for
1144
the instance and starts the instance. A full reboot does the
1145
equivalent of **gnt-instance shutdown && gnt-instance startup**.
1146
The default is hard reboot.
1147

    
1148
For the hard reboot the option ``--ignore-secondaries`` ignores
1149
errors for the secondary node while re-assembling the instance
1150
disks.
1151

    
1152
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1153
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1154
``--sec-node-tags`` options are similar as for the **startup**
1155
command and they influence the actual instances being rebooted.
1156

    
1157
The ``--shutdown-timeout`` is used to specify how much time to wait
1158
before forcing the shutdown (xm destroy in xen, killing the kvm
1159
process, for kvm). By default two minutes are given to each
1160
instance to stop.
1161

    
1162
The ``--force-multiple`` will skip the interactive confirmation in
1163
the case the more than one instance will be affected.
1164

    
1165
Example::
1166

    
1167
    # gnt-instance reboot instance1.example.com
1168
    # gnt-instance reboot --type=full instance1.example.com
1169

    
1170

    
1171
CONSOLE
1172
^^^^^^^
1173

    
1174
**console** [--show-cmd] {*instance*}
1175

    
1176
Connects to the console of the given instance. If the instance is
1177
not up, an error is returned. Use the ``--show-cmd`` option to
1178
display the command instead of executing it.
1179

    
1180
For HVM instances, this will attempt to connect to the serial
1181
console of the instance. To connect to the virtualized "physical"
1182
console of a HVM instance, use a VNC client with the connection
1183
info from the **info** command.
1184

    
1185
Example::
1186

    
1187
    # gnt-instance console instance1.example.com
1188

    
1189

    
1190
Disk management
1191
~~~~~~~~~~~~~~~
1192

    
1193
REPLACE-DISKS
1194
^^^^^^^^^^^^^
1195

    
1196
**replace-disks** [--submit] [--early-release] {-p} [--disks *idx*]
1197
{*instance*}
1198

    
1199
**replace-disks** [--submit] [--early-release] {-s} [--disks *idx*]
1200
{*instance*}
1201

    
1202
**replace-disks** [--submit] [--early-release] {--iallocator *name*
1203
\| --new-secondary *NODE*} {*instance*}
1204

    
1205
**replace-disks** [--submit] [--early-release] {--auto}
1206
{*instance*}
1207

    
1208
This command is a generalized form for replacing disks. It is
1209
currently only valid for the mirrored (DRBD) disk template.
1210

    
1211
The first form (when passing the ``-p`` option) will replace the
1212
disks on the primary, while the second form (when passing the
1213
``-s`` option will replace the disks on the secondary node. For
1214
these two cases (as the node doesn't change), it is possible to
1215
only run the replace for a subset of the disks, using the option
1216
``--disks`` which takes a list of comma-delimited disk indices
1217
(zero-based), e.g. 0,2 to replace only the first and third disks.
1218

    
1219
The third form (when passing either the ``--iallocator`` or the
1220
``--new-secondary`` option) is designed to change secondary node of
1221
the instance. Specifying ``--iallocator`` makes the new secondary
1222
be selected automatically by the specified allocator plugin,
1223
otherwise the new secondary node will be the one chosen manually
1224
via the ``--new-secondary`` option.
1225

    
1226
The fourth form (when using ``--auto``) will automatically
1227
determine which disks of an instance are faulty and replace them
1228
within the same node. The ``--auto`` option works only when an
1229
instance has only faulty disks on either the primary or secondary
1230
node; it doesn't work when both sides have faulty disks.
1231

    
1232
The ``--submit`` option is used to send the job to the master
1233
daemon but not wait for its completion. The job ID will be shown so
1234
that it can be examined via **gnt-job info**.
1235

    
1236
The ``--early-release`` changes the code so that the old storage on
1237
secondary node(s) is removed early (before the resync is completed)
1238
and the internal Ganeti locks for the current (and new, if any)
1239
secondary node are also released, thus allowing more parallelism in
1240
the cluster operation. This should be used only when recovering
1241
from a disk failure on the current secondary (thus the old storage
1242
is already broken) or when the storage on the primary node is known
1243
to be fine (thus we won't need the old storage for potential
1244
recovery).
1245

    
1246
Note that it is not possible to select an offline or drained node
1247
as a new secondary.
1248

    
1249
ACTIVATE-DISKS
1250
^^^^^^^^^^^^^^
1251

    
1252
**activate-disks** [--submit] [--ignore-size] {*instance*}
1253

    
1254
Activates the block devices of the given instance. If successful,
1255
the command will show the location and name of the block devices::
1256

    
1257
    node1.example.com:disk/0:/dev/drbd0
1258
    node1.example.com:disk/1:/dev/drbd1
1259

    
1260

    
1261
In this example, *node1.example.com* is the name of the node on
1262
which the devices have been activated. The *disk/0* and *disk/1*
1263
are the Ganeti-names of the instance disks; how they are visible
1264
inside the instance is hypervisor-specific. */dev/drbd0* and
1265
*/dev/drbd1* are the actual block devices as visible on the node.
1266
The ``--submit`` option is used to send the job to the master
1267
daemon but not wait for its completion. The job ID will be shown so
1268
that it can be examined via **gnt-job info**.
1269

    
1270
The ``--ignore-size`` option can be used to activate disks ignoring
1271
the currently configured size in Ganeti. This can be used in cases
1272
where the configuration has gotten out of sync with the real-world
1273
(e.g. after a partially-failed grow-disk operation or due to
1274
rounding in LVM devices). This should not be used in normal cases,
1275
but only when activate-disks fails without it.
1276

    
1277
Note that it is safe to run this command while the instance is
1278
already running.
1279

    
1280
DEACTIVATE-DISKS
1281
^^^^^^^^^^^^^^^^
1282

    
1283
**deactivate-disks** [-f] [--submit] {*instance*}
1284

    
1285
De-activates the block devices of the given instance. Note that if
1286
you run this command for an instance with a drbd disk template,
1287
while it is running, it will not be able to shutdown the block
1288
devices on the primary node, but it will shutdown the block devices
1289
on the secondary nodes, thus breaking the replication.
1290

    
1291
The ``-f``/``--force`` option will skip checks that the instance is
1292
down; in case the hypervisor is confused and we can't talk to it,
1293
normally Ganeti will refuse to deactivate the disks, but with this
1294
option passed it will skip this check and directly try to deactivate
1295
the disks. This can still fail due to the instance actually running or
1296
other issues.
1297

    
1298
The ``--submit`` option is used to send the job to the master
1299
daemon but not wait for its completion. The job ID will be shown so
1300
that it can be examined via **gnt-job info**.
1301

    
1302
GROW-DISK
1303
^^^^^^^^^
1304

    
1305
**grow-disk** [--no-wait-for-sync] [--submit] {*instance*} {*disk*}
1306
{*amount*}
1307

    
1308
Grows an instance's disk. This is only possible for instances
1309
having a plain or drbd disk template.
1310

    
1311
Note that this command only change the block device size; it will
1312
not grow the actual filesystems, partitions, etc. that live on that
1313
disk. Usually, you will need to:
1314

    
1315

    
1316

    
1317

    
1318
#. use **gnt-instance grow-disk**
1319

    
1320
#. reboot the instance (later, at a convenient time)
1321

    
1322
#. use a filesystem resizer, such as ext2online(8) or
1323
   xfs\_growfs(8) to resize the filesystem, or use fdisk(8) to change
1324
   the partition table on the disk
1325

    
1326

    
1327
The *disk* argument is the index of the instance disk to grow. The
1328
*amount* argument is given either as a number (and it represents
1329
the amount to increase the disk with in mebibytes) or can be given
1330
similar to the arguments in the create instance operation, with a
1331
suffix denoting the unit.
1332

    
1333
Note that the disk grow operation might complete on one node but
1334
fail on the other; this will leave the instance with
1335
different-sized LVs on the two nodes, but this will not create
1336
problems (except for unused space).
1337

    
1338
If you do not want gnt-instance to wait for the new disk region to
1339
be synced, use the ``--no-wait-for-sync`` option.
1340

    
1341
The ``--submit`` option is used to send the job to the master
1342
daemon but not wait for its completion. The job ID will be shown so
1343
that it can be examined via **gnt-job info**.
1344

    
1345
Example (increase the first disk for instance1 by 16GiB)::
1346

    
1347
    # gnt-instance grow-disk instance1.example.com 0 16g
1348

    
1349

    
1350
Also note that disk shrinking is not supported; use
1351
**gnt-backup export** and then **gnt-backup import** to reduce the
1352
disk size of an instance.
1353

    
1354
RECREATE-DISKS
1355
^^^^^^^^^^^^^^
1356

    
1357
**recreate-disks** [--submit] [--disks=``indices``] {*instance*}
1358

    
1359
Recreates the disks of the given instance, or only a subset of the
1360
disks (if the option ``disks`` is passed, which must be a
1361
comma-separated list of disk indices, starting from zero).
1362

    
1363
Note that this functionality should only be used for missing disks;
1364
if any of the given disks already exists, the operation will fail.
1365
While this is suboptimal, recreate-disks should hopefully not be
1366
needed in normal operation and as such the impact of this is low.
1367

    
1368
The ``--submit`` option is used to send the job to the master
1369
daemon but not wait for its completion. The job ID will be shown so
1370
that it can be examined via **gnt-job info**.
1371

    
1372
Recovery
1373
~~~~~~~~
1374

    
1375
FAILOVER
1376
^^^^^^^^
1377

    
1378
**failover** [-f] [--ignore-consistency] [--shutdown-timeout=*N*]
1379
[--submit] {*instance*}
1380

    
1381
Failover will fail the instance over its secondary node. This works
1382
only for instances having a drbd disk template.
1383

    
1384
Normally the failover will check the consistency of the disks
1385
before failing over the instance. If you are trying to migrate
1386
instances off a dead node, this will fail. Use the
1387
``--ignore-consistency`` option for this purpose. Note that this
1388
option can be dangerous as errors in shutting down the instance
1389
will be ignored, resulting in possibly having the instance running
1390
on two machines in parallel (on disconnected DRBD drives).
1391

    
1392
The ``--shutdown-timeout`` is used to specify how much time to wait
1393
before forcing the shutdown (xm destroy in xen, killing the kvm
1394
process, for kvm). By default two minutes are given to each
1395
instance to stop.
1396

    
1397
The ``--submit`` option is used to send the job to the master
1398
daemon but not wait for its completion. The job ID will be shown so
1399
that it can be examined via **gnt-job info**.
1400

    
1401
Example::
1402

    
1403
    # gnt-instance failover instance1.example.com
1404

    
1405

    
1406
MIGRATE
1407
^^^^^^^
1408

    
1409
**migrate** [-f] {--cleanup} {*instance*}
1410

    
1411
**migrate** [-f] [--non-live] [--migration-mode=live\|non-live]
1412
{*instance*}
1413

    
1414
Migrate will move the instance to its secondary node without
1415
shutdown. It only works for instances having the drbd8 disk
1416
template type.
1417

    
1418
The migration command needs a perfectly healthy instance, as we
1419
rely on the dual-master capability of drbd8 and the disks of the
1420
instance are not allowed to be degraded.
1421

    
1422
The ``--non-live`` and ``--migration-mode=non-live`` options will
1423
switch (for the hypervisors that support it) between a "fully live"
1424
(i.e. the interruption is as minimal as possible) migration and one
1425
in which the instance is frozen, its state saved and transported to
1426
the remote node, and then resumed there. This all depends on the
1427
hypervisor support for two different methods. In any case, it is
1428
not an error to pass this parameter (it will just be ignored if the
1429
hypervisor doesn't support it). The option
1430
``--migration-mode=live`` option will request a fully-live
1431
migration. The default, when neither option is passed, depends on
1432
the hypervisor parameters (and can be viewed with the
1433
**gnt-cluster info** command).
1434

    
1435
If the ``--cleanup`` option is passed, the operation changes from
1436
migration to attempting recovery from a failed previous migration.
1437
In this mode, Ganeti checks if the instance runs on the correct
1438
node (and updates its configuration if not) and ensures the
1439
instances's disks are configured correctly. In this mode, the
1440
``--non-live`` option is ignored.
1441

    
1442
The option ``-f`` will skip the prompting for confirmation.
1443

    
1444
Example (and expected output)::
1445

    
1446
    # gnt-instance migrate instance1
1447
    Migrate will happen to the instance instance1. Note that migration is
1448
    **experimental** in this version. This might impact the instance if
1449
    anything goes wrong. Continue?
1450
    y/[n]/?: y
1451
    * checking disk consistency between source and target
1452
    * ensuring the target is in secondary mode
1453
    * changing disks into dual-master mode
1454
     - INFO: Waiting for instance instance1 to sync disks.
1455
     - INFO: Instance instance1's disks are in sync.
1456
    * migrating instance to node2.example.com
1457
    * changing the instance's disks on source node to secondary
1458
     - INFO: Waiting for instance instance1 to sync disks.
1459
     - INFO: Instance instance1's disks are in sync.
1460
    * changing the instance's disks to single-master
1461
    #
1462

    
1463

    
1464
MOVE
1465
^^^^
1466

    
1467
**move** [-f] [-n *node*] [--shutdown-timeout=*N*] [--submit]
1468
{*instance*}
1469

    
1470
Move will move the instance to an arbitrary node in the cluster.
1471
This works only for instances having a plain or file disk
1472
template.
1473

    
1474
Note that since this operation is done via data copy, it will take
1475
a long time for big disks (similar to replace-disks for a drbd
1476
instance).
1477

    
1478
The ``--shutdown-timeout`` is used to specify how much time to wait
1479
before forcing the shutdown (e.g. ``xm destroy`` in XEN, killing the
1480
kvm process for KVM, etc.). By default two minutes are given to each
1481
instance to stop.
1482

    
1483
The ``--submit`` option is used to send the job to the master
1484
daemon but not wait for its completion. The job ID will be shown so
1485
that it can be examined via **gnt-job info**.
1486

    
1487
Example::
1488

    
1489
    # gnt-instance move -n node3.example.com instance1.example.com
1490

    
1491

    
1492
TAGS
1493
~~~~
1494

    
1495
ADD-TAGS
1496
^^^^^^^^
1497

    
1498
**add-tags** [--from *file*] {*instancename*} {*tag*...}
1499

    
1500
Add tags to the given instance. If any of the tags contains invalid
1501
characters, the entire operation will abort.
1502

    
1503
If the ``--from`` option is given, the list of tags will be
1504
extended with the contents of that file (each line becomes a tag).
1505
In this case, there is not need to pass tags on the command line
1506
(if you do, both sources will be used). A file name of ``-`` will be
1507
interpreted as stdin.
1508

    
1509
LIST-TAGS
1510
^^^^^^^^^
1511

    
1512
**list-tags** {*instancename*}
1513

    
1514
List the tags of the given instance.
1515

    
1516
REMOVE-TAGS
1517
^^^^^^^^^^^
1518

    
1519
**remove-tags** [--from *file*] {*instancename*} {*tag*...}
1520

    
1521
Remove tags from the given instance. If any of the tags are not
1522
existing on the node, the entire operation will abort.
1523

    
1524
If the ``--from`` option is given, the list of tags to be removed will
1525
be extended with the contents of that file (each line becomes a tag).
1526
In this case, there is not need to pass tags on the command line (if
1527
you do, tags from both sources will be removed). A file name of ``-``
1528
will be interpreted as stdin.