gnt-instance.rst 56.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
gnt-instance(8) Ganeti | Version @GANETI_VERSION@
=================================================

Name
----

gnt-instance - Ganeti instance administration

Synopsis
--------

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

DESCRIPTION
-----------

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

COMMANDS
--------

Creation/removal/querying
~~~~~~~~~~~~~~~~~~~~~~~~~

ADD
^^^

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

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

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

When using the ``adopt`` key in the disk definition, Ganeti will
reuse those volumes (instead of creating new ones) as the
instance's disks. Ganeti will rename these volumes to the standard
format, and (without installing the OS) will use them as-is for the
instance. This allows migrating instances from non-managed mode
64
(e.g. plain KVM with LVM) to being managed via Ganeti. Please note that
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
this works only for the \`plain' disk template (see below for
template details).

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

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

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

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

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

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

mac
    either a value or 'generate' to generate a new unique MAC

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

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

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


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

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

Iustin Pop's avatar
Iustin Pop committed
127
128
129
The ``-B (--backend-parameters)`` option specifies the backend
parameters for the instance. If no such parameters are specified, the
values are inherited from the cluster. Possible parameters are:
130

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

minmem
    the minimum memory size of the instance; as usual, suffixes can be
137
    used to denote the unit, otherwise the value is taken in mebibytes
138
139
140
141
142
143
144
145
146

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

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

147
148
149
150
151
always\_failover
    ``True`` or ``False``, whether the instance must be failed over
    (shut down and rebooted) always or it may be migrated (briefly
    suspended)

152
153
154
155
156
Note that before 2.6 Ganeti had a ``memory`` parameter, which was the
only value of memory an instance could have. With the
``maxmem``/``minmem`` change Ganeti guarantees that at least the minimum
memory is always available for an instance, but allows more memory to be
used (up to the maximum memory) should it be free.
157

Iustin Pop's avatar
Iustin Pop committed
158
159
160
161
162
163
The ``-H (--hypervisor-parameters)`` option specified the hypervisor
to use for the instance (must be one of the enabled hypervisors on the
cluster) and optionally custom parameters for this instance. If not
other options are used (i.e. the invocation is just -H *NAME*) the
instance will inherit the cluster options. The defaults below show the
cluster defaults at cluster creation time.
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187

The possible hypervisor options are as follows:

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

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

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

    a
        floppy drive

    c
        hard disk

    d
        CDROM drive

    n
        network boot (PXE)

188
    The default is not to set an HVM boot order, which is interpreted
189
    as 'dc'.
190

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

196
197
198
blockdev\_prefix
    Valid for the Xen HVM and PVM hypervisors.

Iustin Pop's avatar
Iustin Pop committed
199
200
    Relevant to non-pvops guest kernels, in which the disk device names
    are given by the host.  Allows one to specify 'xvd', which helps run
201
    Red Hat based installers, driven by anaconda.
202

203
204
205
floppy\_image\_path
    Valid for the KVM hypervisor.

206
207
208
209
    The path to a floppy disk image to attach to the instance.  This
    is useful to install Windows operating systems on Virt/IO disks
    because you can specify here the floppy for the drivers at
    installation time.
210

211
212
213
214
215
cdrom\_image\_path
    Valid for the Xen HVM and KVM hypervisors.

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

216
217
218
219
220
221
222
cdrom2\_image\_path
    Valid for the KVM hypervisor.

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

223
224
225
226
227
228
nic\_type
    Valid for the Xen HVM and KVM hypervisors.

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

Iustin Pop's avatar
Iustin Pop committed
229
230
231
232
233
234
235
236
237
    - rtl8139 (default for Xen HVM) (HVM & KVM)
    - ne2k\_isa (HVM & KVM)
    - ne2k\_pci (HVM & KVM)
    - i82551 (KVM)
    - i82557b (KVM)
    - i82559er (KVM)
    - pcnet (KVM)
    - e1000 (KVM)
    - paravirtual (default for KVM) (HVM & KVM)
238
239
240
241
242
243
244

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

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

245
246
247
248
249
250
    - ioemu [default] (HVM & KVM)
    - ide (HVM & KVM)
    - scsi (KVM)
    - sd (KVM)
    - mtd (KVM)
    - pflash (KVM)
251
252


253
254
cdrom\_disk\_type
    Valid for the KVM hypervisor.
255

256
257
258
    This parameter determines the way the cdroms disks are presented
    to the instance. The default behavior is to get the same value of
    the eariler parameter (disk_type). The possible options are:
259

260
261
262
263
264
265
    - paravirtual
    - ide
    - scsi
    - sd
    - mtd
    - pflash
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291


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

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

vnc\_tls
    Valid for the KVM hypervisor.

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

vnc\_x509\_path
    Valid for the KVM hypervisor.

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

vnc\_x509\_verify
    Valid for the KVM hypervisor.

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
spice\_bind
    Valid for the KVM hypervisor.

    Specifies the address or interface on which the SPICE server will
    listen. Valid values are:

    - IPv4 addresses, including 0.0.0.0 and 127.0.0.1
    - IPv6 addresses, including :: and ::1
    - names of network interfaces

    If a network interface is specified, the SPICE server will be bound
    to one of the addresses of that interface.

spice\_ip\_version
    Valid for the KVM hypervisor.

    Specifies which version of the IP protocol should be used by the
    SPICE server.

    It is mainly intended to be used for specifying what kind of IP
    addresses should be used if a network interface with both IPv4 and
    IPv6 addresses is specified via the ``spice_bind`` parameter. In
    this case, if the ``spice_ip_version`` parameter is not used, the
    default IP version of the cluster will be used.

317
318
319
320
321
322
323
spice\_password\_file
    Valid for the KVM hypervisor.

    Specifies a file containing the password that must be used when
    connecting via the SPICE protocol. If the option is not specified,
    passwordless connections are allowed.

324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
spice\_image\_compression
    Valid for the KVM hypervisor.

    Configures the SPICE lossless image compression. Valid values are:

    - auto_glz
    - auto_lz
    - quic
    - glz
    - lz
    - off

spice\_jpeg\_wan\_compression
    Valid for the KVM hypervisor.

    Configures how SPICE should use the jpeg algorithm for lossy image
    compression on slow links. Valid values are:

    - auto
    - never
    - always

spice\_zlib\_glz\_wan\_compression
    Valid for the KVM hypervisor.

    Configures how SPICE should use the zlib-glz algorithm for lossy image
    compression on slow links. Valid values are:

    - auto
    - never
    - always

spice\_streaming\_video
    Valid for the KVM hypervisor.

    Configures how SPICE should detect video streams. Valid values are:

    - off
    - all
    - filter

spice\_playback\_compression
    Valid for the KVM hypervisor.

    Configures whether SPICE should compress audio streams or not.

370
371
372
373
374
375
spice\_use\_tls
    Valid for the KVM hypervisor.

    Specifies that the SPICE server must use TLS to encrypt all the
    traffic with the client.

376
377
378
379
380
381
382
383
384
385
386
spice\_tls\_ciphers
    Valid for the KVM hypervisor.

    Specifies a list of comma-separated ciphers that SPICE should use
    for TLS connections. For the format, see man cipher(1).

spice\_use\_vdagent
    Valid for the KVM hypervisor.

    Enables or disables passing mouse events via SPICE vdagent.

387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
acpi
    Valid for the Xen HVM and KVM hypervisors.

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

pae
    Valid for the Xen HVM and KVM hypervisors.

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

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

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

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

    This option specifies the path (on the node) to the kernel to boot
413
414
415
    the instance with. Xen PVM instances always require this, while
    for KVM if this option is empty, it will cause the machine to load
    the kernel from its disks.
416
417
418
419
420
421
422
423

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

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

424
425
426
427
    The default setting for this value is simply ``"ro"``, which
    mounts the root disk (initially) in read-only one. For example,
    setting this to single will cause the instance to start in
    single-user mode.
428
429
430
431
432

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

    This option specifies the path (on the node) to the initrd to boot
433
434
435
436
437
    the instance with. Xen PVM instances can use this always, while
    for KVM if this option is only used if the ``kernel_path`` option
    is also specified. You can pass here either an absolute filename
    (the path to the initrd) if you want to use an initrd, or use the
    format no\_initrd\_path for no initrd.
438
439
440
441
442
443
444
445

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

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

446
447
448
449
    Please note, that if this setting is an empty string and the
    hypervisor is Xen it will not be written to the Xen configuration
    file

450
451
452
453
454
455
456
457
458
serial\_console
    Valid for the KVM hypervisor.

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

disk\_cache
    Valid for the KVM hypervisor.

459
460
461
462
463
464
465
466
467
    The disk cache mode. It can be either default to not pass any
    cache option to KVM, or one of the KVM cache modes: none (for
    direct I/O), writethrough (to use the host cache but report
    completion to the guest only when the host has committed the
    changes to disk) or writeback (to use the host cache and report
    completion as soon as the data is in the host cache). Note that
    there are special considerations for the cache mode depending on
    version of KVM used and disk type (always raw file under Ganeti),
    please refer to the KVM documentation for more details.
468
469
470
471

security\_model
    Valid for the KVM hypervisor.

472
473
    The security model for kvm. Currently one of *none*, *user* or
    *pool*. Under *none*, the default, nothing is done and instances
474
475
    are run as the Ganeti daemon user (normally root).

476
477
    Under *user* kvm will drop privileges and become the user
    specified by the security\_domain parameter.
478

479
    Under *pool* a global cluster pool of users will be used, making
480
481
482
483
484
485
    sure no two instances share the same user on the same node. (this
    mode is not implemented yet)

security\_domain
    Valid for the KVM hypervisor.

486
487
    Under security model *user* the username to run the instance
    under.  It must be a valid username existing on the host.
488

489
    Cannot be set under security model *none* or *pool*.
490
491
492
493

kvm\_flag
    Valid for the KVM hypervisor.

494
495
496
    If *enabled* the -enable-kvm flag is passed to kvm. If *disabled*
    -disable-kvm is passed. If unset no flag is passed, and the
    default running mode for your kvm binary will be used.
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530

mem\_path
    Valid for the KVM hypervisor.

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

use\_chroot
    Valid for the KVM hypervisor.

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

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

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

migration\_downtime
    Valid for the KVM hypervisor.

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

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

cpu\_mask
    Valid for the LXC hypervisor.

531
532
    The processes belonging to the given instance are only scheduled
    on the specified CPUs.
533

534
535
    The parameter format is a comma-separated list of CPU IDs or CPU
    ID ranges. The ranges are defined by a lower and higher boundary,
536
537
538
539
540
541
542
543
544
    separated by a dash. The boundaries are inclusive.

usb\_mouse
    Valid for the KVM hypervisor.

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

545
546
547
548
549
550
keymap
    Valid for the KVM hypervisor.

    This option specifies the keyboard mapping to be used. It is only
    needed when using the VNC console. For example: "fr" or "en-gb".

551
552
553
554
555
556
557
558
559
reboot\_behavior
    Valid for Xen PVM, Xen HVM and KVM hypervisors.

    Normally if an instance reboots, the hypervisor will restart it. If
    this option is set to ``exit``, the hypervisor will treat a reboot
    as a shutdown instead.

    It is set to ``reboot`` by default.

560

Iustin Pop's avatar
Iustin Pop committed
561
The ``-O (--os-parameters)`` option allows customisation of the OS
562
563
564
565
566
567
parameters. The actual parameter names and values depends on the OS
being used, but the syntax is the same key=value. For example, setting
a hypothetical ``dhcp`` parameter to yes can be achieved by::

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

Iustin Pop's avatar
Iustin Pop committed
568
569
570
The ``-I (--iallocator)`` option specifies the instance allocator
plugin to use. If you pass in this option the allocator will select
nodes for this instance automatically, so you don't need to pass them
571
572
573
with the ``-n`` option. For more information please refer to the
instance allocator documentation.

Iustin Pop's avatar
Iustin Pop committed
574
575
The ``-t (--disk-template)`` options specifies the disk layout type
for the instance.  The available choices are:
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590

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

file
    Disk devices will be regular files.

plain
    Disk devices will be logical volumes.

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


Iustin Pop's avatar
Iustin Pop committed
591
The optional second value of the ``-n (--node)`` is used for the drbd
592
593
594
595
596
597
template type and specifies the remote node.

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

The ``--file-storage-dir`` specifies the relative path under the
Iustin Pop's avatar
Iustin Pop committed
598
599
cluster-wide file storage directory to store file-based disks. It is
useful for having different subdirectories for different
600
instances. The full path of the directory where the disk files are
Iustin Pop's avatar
Iustin Pop committed
601
602
603
604
stored will consist of cluster-wide file storage directory + optional
subdirectory + instance name. Example:
``@RPL_FILE_STORAGE_DIR@``*/mysubdir/instance1.example.com*. This
option is only relevant for instances using the file storage backend.
605
606

The ``--file-driver`` specifies the driver to use for file-based
607
608
609
disks. Note that currently these drivers work with the xen hypervisor
only. This option is only relevant for instances using the file
storage backend. The available choices are:
610
611

loop
612
613
614
615
616
617
    Kernel loopback driver. This driver uses loopback devices to
    access the filesystem within the file. However, running I/O
    intensive applications in your instance using the loop driver
    might result in slowdowns. Furthermore, if you use the loopback
    driver consider increasing the maximum amount of loopback devices
    (on most systems it's 8) using the max\_loop param.
618
619

blktap
620
621
622
623
624
625
    The blktap driver (for Xen hypervisors). In order to be able to
    use the blktap driver you should check if the 'blktapctrl' user
    space disk agent is running (usually automatically started via
    xend).  This user-level disk I/O interface has the advantage of
    better performance. Especially if you use a network file system
    (e.g. NFS) to store your instances this is the recommended choice.
626
627


628
629
630
The ``--submit`` option is used to send the job to the master daemon
but not wait for its completion. The job ID will be shown so that it
can be examined via **gnt-job info**.
631
632
633

Example::

634
    # gnt-instance add -t file --disk 0:size=30g -B maxmem=512 -o debian-etch \
635
      -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
636
637
    # gnt-instance add -t plain --disk 0:size=30g -B maxmem=1024,minmem=512 \
      -o debian-etch -n node1.example.com instance1.example.com
638
    # gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
639
640
      -B maxmem=512 -o debian-etch -n node1.example.com instance1.example.com
    # gnt-instance add -t drbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
641
642
643
644
645
646
647
648
649
650
      -n node1.example.com:node2.example.com instance2.example.com


BATCH-CREATE
^^^^^^^^^^^^

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

This command (similar to the Ganeti 1.2 **batcher** tool) submits
multiple instance creation jobs based on a definition file. The
651
652
instance configurations do not encompass all the possible options for
the **add** command, but only a subset.
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724

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

disk\_size
    The size of the disks of the instance.

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

backend
    A dictionary of backend parameters.

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

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

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

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

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

start
    whether to start the instance

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

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

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


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

    {
      "instance3": {
        "template": "drbd",
        "os": "debootstrap",
        "disk_size": ["25G"],
        "iallocator": "dumb"
      },
      "instance5": {
        "template": "drbd",
        "os": "debootstrap",
        "disk_size": ["25G"],
        "iallocator": "dumb",
        "hypervisor": "xen-hvm",
        "hvparams": {"acpi": true},
725
        "backend": {"maxmem": 512, "minmem": 256}
726
727
728
729
730
731
732
733
734
735
736
737
738
739
      }
    }

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

    # gnt-instance batch-create instances.json
    instance3: 11224
    instance5: 11225

REMOVE
^^^^^^

**remove** [--ignore-failures] [--shutdown-timeout=*N*] [--submit]
740
[--force] {*instance*}
741
742
743

Remove an instance. This will remove all data from the instance and
there is *no way back*. If you are not sure if you use an instance
744
745
again, use **shutdown** first and leave it in the shutdown state for a
while.
746
747
748

The ``--ignore-failures`` option will cause the removal to proceed
even in the presence of errors during the removal of the instance
749
750
(e.g. during the shutdown or the disk removal). If this option is not
given, the command will stop at the first error.
751
752
753
754
755
756

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

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

761
762
The ``--force`` option is used to skip the interactive confirmation.

763
764
765
766
767
768
769
770
771
Example::

    # gnt-instance remove instance1.example.com


LIST
^^^^

| **list**
772
| [--no-headers] [--separator=*SEPARATOR*] [--units=*UNITS*] [-v]
Guido Trotter's avatar
Guido Trotter committed
773
| [{-o|--output} *[+]FIELD,...*] [--filter] [instance...]
774
775
776
777
778
779
780
781
782
783
784

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

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

The units used to display the numeric values in the output varies,
depending on the options given. By default, the values will be
785
786
787
788
formatted in the most appropriate unit. If the ``--separator`` option
is given, then the values are shown in mebibytes to allow parsing by
scripts. In both cases, the ``--units`` option can be used to enforce
a given output unit.
789

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

Iustin Pop's avatar
Iustin Pop committed
793
794
The ``-o (--output)`` option takes a comma-separated list of output
fields. The available fields and their meaning are:
795

796
@QUERY_FIELDS_INSTANCE@
797
798

If the value of the option starts with the character ``+``, the new
Iustin Pop's avatar
Iustin Pop committed
799
800
field(s) will be added to the default list. This allows one to quickly
see the default list plus a few other fields, instead of retyping the
801
entire list of fields.
802
803
804

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

812
813
814
815
816
817
818
819
If exactly one argument is given and it appears to be a query filter
(see **ganeti(7)**), the query result is filtered accordingly. For
ambiguous cases (e.g. a single field name as a filter) the ``--filter``
(``-F``) option forces the argument to be treated as a filter (e.g.
``gnt-instance list -F admin_state``).

The default output field list is: ``name``, ``os``, ``pnode``,
``admin_state``, ``oper_state``, ``oper_ram``.
820

821
822

LIST-FIELDS
823
~~~~~~~~~~~
824
825
826
827
828
829

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

Lists available fields for instances.


830
831
832
833
834
835
INFO
^^^^

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

Show detailed information about the given instance(s). This is
836
837
different from **list** as it shows detailed data about the instance's
disks (especially useful for the drbd disk template).
838
839
840
841
842
843
844
845

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

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

846
847
848
The ``--roman`` option can be used to cause envy among people who like
ancient cultures, but are stuck with non-latin-friendly cluster
virtualization technologies.
849
850
851
852
853

MODIFY
^^^^^^

| **modify**
Iustin Pop's avatar
Iustin Pop committed
854
855
| [{-H|--hypervisor-parameters} *HYPERVISOR\_PARAMETERS*]
| [{-B|--backend-parameters} *BACKEND\_PARAMETERS*]
856
| [--net add*[:options]* \| --net remove \| --net *N:options*]
857
| [--disk add:size=*SIZE*[,vg=*VG*][,metavg=*VG*] \| --disk remove \|
858
|  --disk *N*:mode=*MODE*]
Iustin Pop's avatar
Iustin Pop committed
859
| [{-t|--disk-template} plain | {-t|--disk-template} drbd -n *new_secondary*] [--no-wait-for-sync]
Michael Hanselmann's avatar
Michael Hanselmann committed
860
| [--os-type=*OS* [--force-variant]]
Iustin Pop's avatar
Iustin Pop committed
861
| [{-O|--os-parameters} *param*=*value*... ]
862
| [--offline \| --online]
863
| [--submit]
864
| [--ignore-ipolicy]
865
866
867
868
869
870
871
| {*instance*}

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

Iustin Pop's avatar
Iustin Pop committed
872
873
874
The ``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``
and ``-O (--os-parameters)`` options specifies hypervisor, backend and
OS parameter options in the form of name=value[,...]. For details
875
which options can be specified, see the **add** command.
876

Iustin Pop's avatar
Iustin Pop committed
877
878
879
880
881
882
883
884
The ``-t (--disk-template)`` option will change the disk template of
the instance.  Currently only conversions between the plain and drbd
disk templates are supported, and the instance must be stopped before
attempting the conversion. When changing from the plain to the drbd
disk template, a new secondary node must be specified via the ``-n``
option. The option ``--no-wait-for-sync`` can be used when converting
to the ``drbd`` template in order to make the instance available for
startup before DRBD has finished resyncing.
885
886

The ``--disk add:size=``*SIZE* option adds a disk to the instance. The
887
888
889
890
891
892
optional ``vg=``*VG* option specifies LVM volume group other than
default vg to create the disk on. For DRBD disks, the ``metavg=``*VG*
option specifies the volume group for the metadata device. The
``--disk remove`` option will remove the last disk of the
instance. The ``--disk`` *N*``:mode=``*MODE* option will change the
mode of the Nth disk of the instance between read-only (``ro``) and
893
894
895
896
897
read-write (``rw``).

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

Iustin Pop's avatar
Iustin Pop committed
901
The option ``-o (--os-type)`` will change the OS name for the instance
902
903
(without reinstallation). In case an OS variant is specified that is
not found, then by default the modification is refused, unless
904
905
906
``--force-variant`` is passed. An invalid OS will also be refused,
unless the ``--force`` option is given.

907
908
909
910
911
912
913
The ``--online`` and ``--offline`` options are used to transition an
instance into and out of the ``offline`` state. An instance can be
turned offline only if it was previously down. The ``--online`` option
fails if the instance was not in the ``offline`` state, otherwise it
changes instance's state to ``down``. These modifications take effect
immediately.

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

918
919
920
If ``--ignore-ipolicy`` is given any instance policy violations occuring
during this operation are ignored.

921
Most of the changes take effect at the next restart. If the instance is
922
923
924
925
926
running, there is no effect on the instance.

REINSTALL
^^^^^^^^^

Iustin Pop's avatar
Iustin Pop committed
927
| **reinstall** [{-o|--os-type} *os-type*] [--select-os] [-f *force*]
928
929
| [--force-multiple]
| [--instance \| --node \| --primary \| --secondary \| --all]
Iustin Pop's avatar
Iustin Pop committed
930
| [{-O|--os-parameters} *OS\_PARAMETERS*] [--submit] {*instance*...}
931
932

Reinstalls the operating system on the given instance(s). The
Iustin Pop's avatar
Iustin Pop committed
933
934
instance(s) must be stopped when running this command. If the ``-o
(--os-type)`` is specified, the operating system is changed.
935
936
937

The ``--select-os`` option switches to an interactive OS reinstall.
The user is prompted to select the OS template from the list of
Iustin Pop's avatar
Iustin Pop committed
938
939
940
available OS templates. OS parameters can be overridden using ``-O
(--os-parameters)`` (more documentation for this option under the
**add** command).
941
942
943
944

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

949
950
951
The ``--submit`` option is used to send the job to the master daemon
but not wait for its completion. The job ID will be shown so that it
can be examined via **gnt-job info**.
952
953
954
955
956
957
958

RENAME
^^^^^^

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

959
960
961
962
963
964
Renames the given instance. The instance must be stopped when running
this command. The requirements for the new name are the same as for
adding an instance: the new name must be resolvable and the IP it
resolves to must not be reachable (in order to prevent duplicate IPs
the next time the instance is started). The IP test can be skipped if
the ``--no-ip-check`` option is passed.
965

966
967
968
969
970
The ``--no-name-check`` skips the check for the new instance name via
the resolver (e.g. in DNS or /etc/hosts, depending on your setup) and
that the resolved name matches the provided name. Since the name check
is used to compute the IP address, if you pass this option you must also
pass the ``--no-ip-check`` option.
971

972
973
974
The ``--submit`` option is used to send the job to the master daemon
but not wait for its completion. The job ID will be shown so that it
can be examined via **gnt-job info**.
975
976
977
978
979
980
981
982
983

Starting/stopping/connecting to console
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STARTUP
^^^^^^^

| **startup**
| [--force] [--ignore-offline]
984
| [--force-multiple] [--no-remember]
985
986
| [--instance \| --node \| --primary \| --secondary \| --all \|
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
Iustin Pop's avatar
Iustin Pop committed
987
988
| [{-H|--hypervisor-parameters} ``key=value...``]
| [{-B|--backend-parameters} ``key=value...``]
989
| [--submit] [--paused]
990
991
| {*name*...}

992
993
Starts one or more instances, depending on the following options.  The
four available modes are:
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030

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

--node
    will start the instances who have the given node as either primary
    or secondary

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

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

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

--tags
    will start all instances in the cluster with the tags given as
    arguments

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

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

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

Note that although you can pass more than one selection option, the
1031
1032
last one wins, so in order to guarantee the desired result, don't pass
more than one such option.
1033
1034

Use ``--force`` to start even if secondary disks are failing.
1035
1036
``--ignore-offline`` can be used to ignore offline primary nodes and
mark the instance as started even if the primary is not available.
1037

1038
1039
The ``--force-multiple`` will skip the interactive confirmation in the
case the more than one instance will be affected.
1040

1041
1042
1043
1044
1045
1046
The ``--no-remember`` option will perform the startup but not change
the state of the instance in the configuration file (if it was stopped
before, Ganeti will still thinks it needs to be stopped). This can be
used for testing, or for a one shot-start where you don't want the
watcher to restart the instance if it crashes.

Iustin Pop's avatar
Iustin Pop committed
1047
1048
1049
1050
1051
The ``-H (--hypervisor-parameters)`` and ``-B (--backend-parameters)``
options specify temporary hypervisor and backend parameters that can
be used to start an instance with modified parameters. They can be
useful for quick testing without having to modify an instance back and
forth, e.g.::
1052

Stephen Shirley's avatar
Stephen Shirley committed
1053
    # gnt-instance start -H kernel_args="single" instance1
1054
    # gnt-instance start -B maxmem=2048 instance2
1055
1056


1057
1058
1059
1060
The first form will start the instance instance1 in single-user mode,
and the instance instance2 with 2GB of RAM (this time only, unless
that is the actual instance memory size already). Note that the values
override the instance parameters (and not extend them): an instance
Stephen Shirley's avatar
Stephen Shirley committed
1061
with "kernel\_args=ro" when started with -H kernel\_args=single will
1062
1063
1064
1065
result in "single", not "ro single".  The ``--submit`` option is used
to send the job to the master daemon but not wait for its
completion. The job ID will be shown so that it can be examined via
**gnt-job info**.
1066

1067
1068
1069
1070
1071
The ``--paused`` option is only valid for Xen and kvm hypervisors.  This
pauses the instance at the start of bootup, awaiting ``gnt-instance
console`` to unpause it, allowing the entire boot process to be
monitored for debugging.

1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
Example::

    # gnt-instance start instance1.example.com
    # gnt-instance start --node node1.example.com node2.example.com
    # gnt-instance start --all


SHUTDOWN
^^^^^^^^

| **shutdown**
| [--timeout=*N*]
1084
| [--force-multiple] [--ignore-offline] [--no-remember]
1085
1086
1087
1088
1089
| [--instance \| --node \| --primary \| --secondary \| --all \|
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
| [--submit]
| {*name*...}

1090
1091
1092
1093
Stops one or more instances. If the instance cannot be cleanly stopped
during a hardcoded interval (currently 2 minutes), it will forcibly
stop the instance (equivalent to switching off the power on a physical
machine).
1094
1095
1096
1097
1098
1099
1100
1101

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

The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1102
1103
``--sec-node-tags`` options are similar as for the **startup** command
and they influence the actual instances being shutdown.
1104

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

1109
1110
1111
``--ignore-offline`` can be used to ignore offline primary nodes and
force the instance to be marked as stopped. This option should be used
with care as it can lead to an inconsistent cluster state.
1112

1113
1114
1115
1116
1117
1118
1119
1120
1121
The ``--no-remember`` option will perform the shutdown but not change
the state of the instance in the configuration file (if it was running
before, Ganeti will still thinks it needs to be running). This can be
useful for a cluster-wide shutdown, where some instances are marked as
up and some as down, and you don't want to change the running state:
you just need to disable the watcher, shutdown all instances with
``--no-remember``, and when the watcher is activated again it will
restore the correct runtime state for all instances.

1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
Example::

    # gnt-instance shutdown instance1.example.com
    # gnt-instance shutdown --all


REBOOT
^^^^^^

| **reboot**
Iustin Pop's avatar
Iustin Pop committed
1132
| [{-t|--type} *REBOOT-TYPE*]
1133
1134
1135
1136
1137
1138
1139
1140
| [--ignore-secondaries]
| [--shutdown-timeout=*N*]
| [--force-multiple]
| [--instance \| --node \| --primary \| --secondary \| --all \|
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
| [--submit]
| [*name*...]

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

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

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

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

1161
1162
The ``--force-multiple`` will skip the interactive confirmation in the
case the more than one instance will be affected.
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174

Example::

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


CONSOLE
^^^^^^^

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

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

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

1184
1185
1186
1187
For Xen/kvm instances, if the instance is paused, this attempts to
unpause the instance after waiting a few seconds for the connection to
the console to be made.

1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
Example::

    # gnt-instance console instance1.example.com


Disk management
~~~~~~~~~~~~~~~

REPLACE-DISKS
^^^^^^^^^^^^^

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

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

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

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

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

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

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

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

1235
1236
1237
The ``--submit`` option is used to send the job to the master daemon
but not wait for its completion. The job ID will be shown so that it
can be examined via **gnt-job info**.
1238
1239
1240
1241
1242

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

1248
1249
Note that it is not possible to select an offline or drained node as a
new secondary.
1250
1251
1252
1253
1254
1255

ACTIVATE-DISKS
^^^^^^^^^^^^^^

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

1256
1257
Activates the block devices of the given instance. If successful, the
command will show the location and name of the block devices::
1258
1259
1260
1261
1262

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


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

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

1279
1280
Note that it is safe to run this command while the instance is already
running.
1281
1282
1283
1284

DEACTIVATE-DISKS
^^^^^^^^^^^^^^^^

1285
**deactivate-disks** [-f] [--submit] {*instance*}
1286

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

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

1300
1301
1302
The ``--submit`` option is used to send the job to the master daemon
but not wait for its completion. The job ID will be shown so that it
can be examined via **gnt-job info**.
1303
1304
1305
1306
1307
1308
1309

GROW-DISK
^^^^^^^^^

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

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

1313
1314
Note that this command only change the block device size; it will not
grow the actual filesystems, partitions, etc. that live on that
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
disk. Usually, you will need to:

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

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

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

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

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

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

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

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

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


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

RECREATE-DISKS
^^^^^^^^^^^^^^

1355
1356
**recreate-disks** [--submit] [--disks=``indices``] [-n node1:[node2]]
  {*instance*}
1357
1358
1359
1360
1361

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

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

1367
1368
1369
1370
1371
1372
1373
1374
1375
Optionally the instance's disks can be recreated on different
nodes. This can be useful if, for example, the original nodes of the
instance have gone down (and are marked offline), so we can't recreate
on the same nodes. To do this, pass the new node(s) via ``-n`` option,
with a syntax similar to the **add** command. The number of nodes
passed must equal the number of nodes that the instance currently
has. Note that changing nodes is only allowed for 'all disk'
replacement (when ``--disks`` is not passed).

1376
1377
1378
The ``--submit`` option is used to send the job to the master daemon
but not wait for its completion. The job ID will be shown so that it
can be examined via **gnt-job info**.
1379
1380
1381
1382
1383
1384
1385
1386

Recovery
~~~~~~~~

FAILOVER
^^^^^^^^

**failover** [-f] [--ignore-consistency] [--shutdown-timeout=*N*]
1387
[--submit] [--ignore-ipolicy] {*instance*}
1388

1389
1390
1391
1392
1393
1394
Failover will stop the instance (if running), change its primary node,
and if it was originally running it will start it again (on the new
primary). This only works for instances with drbd template (in which
case you can only fail to the secondary node) and for externally
mirrored templates (shared storage) (which can change to any other
node).
1395

1396
1397
1398
1399
1400
1401
1402
Normally the failover will check the consistency of the disks before
failing over the instance. If you are trying to migrate instances off
a dead node, this will fail. Use the ``--ignore-consistency`` option
for this purpose. Note that this option can be dangerous as errors in
shutting down the instance will be ignored, resulting in possibly
having the instance running on two machines in parallel (on
disconnected DRBD drives).
1403
1404
1405

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

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

1413
1414
1415
If ``--ignore-ipolicy`` is given any instance policy violations occuring
during this operation are ignored.

1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
Example::

    # gnt-instance failover instance1.example.com


MIGRATE
^^^^^^^

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

1426
**migrate** [-f] [--allow-failover] [--non-live]
1427
[--migration-mode=live\|non-live] [--ignore-ipolicy] {*instance*}
1428
1429

Migrate will move the instance to its secondary node without
1430
1431
shutdown. It only works for instances having the drbd8 disk template
type.
1432

1433
1434
1435
The migration command needs a perfectly healthy instance, as we rely
on the dual-master capability of drbd8 and the disks of the instance
are not allowed to be degraded.
1436
1437
1438

The ``--non-live`` and ``--migration-mode=non-live`` options will
switch (for the hypervisors that support it) between a "fully live"
1439
1440
1441
1442
1443
1444
1445
1446
1447
(i.e. the interruption is as minimal as possible) migration and one in
which the instance is frozen, its state saved and transported to the
remote node, and then resumed there. This all depends on the
hypervisor support for two different methods. In any case, it is not
an error to pass this parameter (it will just be ignored if the
hypervisor doesn't support it). The option ``--migration-mode=live``
option will request a fully-live migration. The default, when neither
option is passed, depends on the hypervisor parameters (and can be
viewed with the **gnt-cluster info** command).
1448
1449

If the ``--cleanup`` option is passed, the operation changes from
1450
1451
1452
1453
1454
migration to attempting recovery from a failed previous migration.  In
this mode, Ganeti checks if the instance runs on the correct node (and
updates its configuration if not) and ensures the instances's disks
are configured correctly. In this mode, the ``--non-live`` option is
ignored.
1455
1456
1457

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

1458
If ``--allow-failover`` is specified it tries to fallback to failover if
1459
it already can determine that a migration won't work (e.g. if the
1460
instance is shut down). Please note that the fallback will not happen
1461
1462
during execution. If a migration fails during execution it still fails.

1463
1464
1465
If ``--ignore-ipolicy`` is given any instance policy violations occuring
during this operation are ignored.

1466
1467
1468
Example (and expected output)::

    # gnt-instance migrate instance1
1469
1470
1471
    Instance instance1 will be migrated. Note that migration
    might impact the instance if anything goes wrong (e.g. due to bugs in
    the hypervisor). Continue?
1472
    y/[n]/?: y
1473
    Migrating instance instance1.example.com
1474
    * checking disk consistency between source and target
1475
1476
    * switching node node2.example.com to secondary mode
    * changing into standalone mode
1477
    * changing disks into dual-master mode
1478
1479
    * wait until resync is done
    * preparing node2.example.com to accept the instance
1480
    * migrating instance to node2.example.com
1481
1482
1483
1484
1485
1486
    * switching node node1.example.com to secondary mode
    * wait until resync is done
    * changing into standalone mode
    * changing disks into single-master mode
    * wait until resync is done
    * done
1487
1488
1489
1490
1491
1492
    #


MOVE
^^^^

Iustin Pop's avatar
Iustin Pop committed
1493
**move** [-f] [--ignore-consistency]
1494
[-n *node*] [--shutdown-timeout=*N*] [--submit] [--ignore-ipolicy]
1495
1496
{*instance*}

1497
1498
Move will move the instance to an arbitrary node in the cluster.  This
works only for instances having a plain or file disk template.
1499

1500
1501
Note that since this operation is done via data copy, it will take a
long time for big disks (similar to replace-disks for a drbd
1502
1503
1504
1505
1506
1507
1508
instance).

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

Iustin Pop's avatar
Iustin Pop committed
1509
1510
1511
1512
The ``--ignore-consistency`` option will make Ganeti ignore any errors
in trying to shutdown the instance on its node; useful if the
hypervisor is broken and you want to recuperate the data.

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

1517
1518
1519
If ``--ignore-ipolicy`` is given any instance policy violations occuring
during this operation are ignored.

1520
1521
1522
1523
1524
Example::

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


1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
CHANGE-GROUP
~~~~~~~~~~~~

**change-group** [--iallocator *NAME*] [--to *GROUP*...] {*instance*}

This command moves an instance to another node group. The move is
calculated by an iallocator, either given on the command line or as a
cluster default.

If no specific destination groups are specified using ``--to``, all
groups except the one containing the instance are considered.

Example::

    # gnt-instance change-group -I hail --to rack2 inst1.example.com


1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
TAGS
~~~~

ADD-TAGS
^^^^^^^^

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

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

1553
1554
1555
1556
1557
If the ``--from`` option is given, the list of tags will be extended
with the contents of that file (each line becomes a tag).  In this
case, there is not need to pass tags on the command line (if you do,
both sources will be used). A file name of ``-`` will be interpreted
as stdin.
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576

LIST-TAGS
^^^^^^^^^

**list-tags** {*instancename*}

List the tags of the given instance.

REMOVE-TAGS
^^^^^^^^^^^

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

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

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

.. vim: set textwidth=72 :
1581
1582
1583
1584
.. Local Variables:
.. mode: rst
.. fill-column: 72
.. End: