Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.rst @ 942817f2

History | View | Annotate | Download (75.6 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|\--disk-template {diskless \| file \| plain \| drbd \| rbd}}
31
| {\--disk=*N*: {size=*VAL*[,spindles=*VAL*] \| adopt=*LV*}[,options...]
32
|  \| {size=*VAL*,provider=*PROVIDER*}[,param=*value*... ][,options...]
33
|  \| {-s|\--os-size} *SIZE*}
34
| [\--no-ip-check] [\--no-name-check] [\--no-conflicts-check]
35
| [\--no-start] [\--no-install]
36
| [\--net=*N* [:options...] \| \--no-nics]
37
| [{-B|\--backend-parameters} *BEPARAMS*]
38
| [{-H|\--hypervisor-parameters} *HYPERVISOR* [: option=*value*... ]]
39
| [{-O|\--os-parameters} *param*=*value*... ]
40
| [--os-parameters-private *param*=*value*... ]
41
| [--os-parameters-secret *param*=*value*... ]
42
| [\--file-storage-dir *dir\_path*] [\--file-driver {loop \| blktap \| blktap2}]
43
| {{-n|\--node} *node[:secondary-node]* \| {-I|\--iallocator} *name*}
44
| {{-o|\--os-type} *os-type*}
45
| [\--submit] [\--print-job-id]
46
| [\--ignore-ipolicy]
47
| [\--no-wait-for-sync]
48
| [{-c|\--communication=yes|no}]
49
| {*instance*}
50

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

    
55
The ``disk`` option specifies the parameters for the disks of the
56
instance. The numbering of disks starts at zero, and at least one disk
57
needs to be passed. For each disk, either the size or the adoption
58
source needs to be given. The size is interpreted (when no unit is
59
given) in mebibytes. You can also use one of the suffixes *m*, *g* or
60
*t* to specify the exact the units used; these suffixes map to
61
mebibytes, gibibytes and tebibytes. Each disk can also take these
62
parameters (all optional):
63

    
64
spindles
65
  How many spindles (physical disks on the node) the disk should span.
66

    
67
mode
68
  The access mode. Either ``ro`` (read-only) or the default ``rw``
69
  (read-write).
70

    
71
name
72
   This option specifies a name for the disk, which can be used as a disk
73
   identifier. An instance can not have two disks with the same name.
74

    
75
vg
76
   The LVM volume group. This works only for LVM and DRBD devices.
77

    
78
metavg
79
   This options specifies a different VG for the metadata device. This
80
   works only for DRBD devices
81

    
82
When creating ExtStorage disks, also arbitrary parameters can be passed,
83
to the ExtStorage provider. Those parameters are passed as additional
84
comma separated options. Therefore, an ExtStorage disk provided by
85
provider ``pvdr1`` with parameters ``param1``, ``param2`` would be
86
passed as ``--disk 0:size=10G,provider=pvdr1,param1=val1,param2=val2``.
87

    
88
When using the ``adopt`` key in the disk definition, Ganeti will
89
reuse those volumes (instead of creating new ones) as the
90
instance's disks. Ganeti will rename these volumes to the standard
91
format, and (without installing the OS) will use them as-is for the
92
instance. This allows migrating instances from non-managed mode
93
(e.g. plain KVM with LVM) to being managed via Ganeti. Please note that
94
this works only for the \`plain' disk template (see below for
95
template details).
96

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

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

    
106
The minimum information needed to specify an ExtStorage disk are the
107
``size`` and the ``provider``. For example:
108
``--disk 0:size=20G,provider=pvdr1``.
109

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

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

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

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

    
129
mac
130
    either a value or 'generate' to generate a new unique MAC
131

    
132
ip
133
    specifies the IP address assigned to the instance from the Ganeti
134
    side (this is not necessarily what the instance will use, but what
135
    the node expects the instance to use). Note that if an IP in the
136
    range of a network configured with **gnt-network**\(8) is used,
137
    and the NIC is not already connected to it, this network has to be
138
    passed in the **network** parameter if this NIC is meant to be
139
    connected to the said network. ``--no-conflicts-check`` can be used
140
    to override this check. The special value **pool** causes Ganeti to
141
    select an IP from the the network the NIC is or will be connected to.
142
    One can pick an externally reserved IP of a network along with
143
    ``--no-conflict-check``. Note that this IP cannot be assigned to
144
    any other instance until it gets released.
145

    
146
mode
147
    specifies the connection mode for this NIC: routed, bridged or
148
    openvswitch.
149

    
150
link
151
    in bridged or openvswitch mode specifies the interface to attach
152
    this NIC to, in routed mode it's intended to differentiate between
153
    different routing tables/instance groups (but the meaning is
154
    dependent on the network script, see **gnt-cluster**\(8) for more
155
    details). Note that openvswitch support is also hypervisor
156
    dependent.
157

    
158
network
159
    derives the mode and the link from the settings of the network
160
    which is identified by its name. If the network option is chosen,
161
    link and mode must not be specified. Note that the mode and link
162
    depend on the network-to-nodegroup connection, thus allowing
163
    different nodegroups to be connected to the same network in
164
    different ways.
165

    
166
name
167
   this option specifies a name for the NIC, which can be used as a NIC
168
   identifier. An instance can not have two NICs with the same name.
169

    
170
vlan
171
   in openvswitch mode specifies the VLANs that the NIC will be
172
   connected to. To connect as an access port use ``n`` or ``.n`` with
173
   **n** being the VLAN ID. To connect as an trunk port use ``:n[:n]``.
174
   A hybrid port can be created with ``.n:n[:n]``
175

    
176
Of these "mode" and "link" are NIC parameters, and inherit their
177
default at cluster level.  Alternatively, if no network is desired for
178
the instance, you can prevent the default of one NIC with the
179
``--no-nics`` option.
180

    
181
The ``-o (--os-type)`` option specifies the operating system to be
182
installed.  The available operating systems can be listed with
183
**gnt-os list**.  Passing ``--no-install`` will however skip the OS
184
installation, allowing a manual import if so desired. Note that the
185
no-installation mode will automatically disable the start-up of the
186
instance (without an OS, it most likely won't be able to start-up
187
successfully).
188

    
189
The ``-B (--backend-parameters)`` option specifies the backend
190
parameters for the instance. If no such parameters are specified, the
191
values are inherited from the cluster. Possible parameters are:
192

    
193
maxmem
194
    the maximum memory size of the instance; as usual, suffixes can be
195
    used to denote the unit, otherwise the value is taken in mebibytes
196

    
197
minmem
198
    the minimum memory size of the instance; as usual, suffixes can be
199
    used to denote the unit, otherwise the value is taken in mebibytes
200

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

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

    
209
always\_failover
210
    ``True`` or ``False``, whether the instance must be failed over
211
    (shut down and rebooted) always or it may be migrated (briefly
212
    suspended)
213

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

    
220
The ``-H (--hypervisor-parameters)`` option specified the hypervisor
221
to use for the instance (must be one of the enabled hypervisors on the
222
cluster) and optionally custom parameters for this instance. If not
223
other options are used (i.e. the invocation is just -H *NAME*) the
224
instance will inherit the cluster options. The defaults below show the
225
cluster defaults at cluster creation time.
226

    
227
The possible hypervisor options are as follows:
228

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

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

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

    
238
    a
239
        floppy drive
240

    
241
    c
242
        hard disk
243

    
244
    d
245
        CDROM drive
246

    
247
    n
248
        network boot (PXE)
249

    
250
    The default is not to set an HVM boot order, which is interpreted
251
    as 'dc'.
252

    
253
    For KVM the boot order is either "floppy", "cdrom", "disk" or
254
    "network".  Please note that older versions of KVM couldn't netboot
255
    from virtio interfaces. This has been fixed in more recent versions
256
    and is confirmed to work at least with qemu-kvm 0.11.1. Also note
257
    that if you have set the ``kernel_path`` option, that will be used
258
    for booting, and this setting will be silently ignored.
259

    
260
blockdev\_prefix
261
    Valid for the Xen HVM and PVM hypervisors.
262

    
263
    Relevant to non-pvops guest kernels, in which the disk device names
264
    are given by the host.  Allows one to specify 'xvd', which helps run
265
    Red Hat based installers, driven by anaconda.
266

    
267
floppy\_image\_path
268
    Valid for the KVM hypervisor.
269

    
270
    The path to a floppy disk image to attach to the instance.  This
271
    is useful to install Windows operating systems on Virt/IO disks
272
    because you can specify here the floppy for the drivers at
273
    installation time.
274

    
275
cdrom\_image\_path
276
    Valid for the Xen HVM and KVM hypervisors.
277

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

    
280
cdrom2\_image\_path
281
    Valid for the KVM hypervisor.
282

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

    
287
nic\_type
288
    Valid for the Xen HVM and KVM hypervisors.
289

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

    
293
    - rtl8139 (default for Xen HVM) (HVM & KVM)
294
    - ne2k\_isa (HVM & KVM)
295
    - ne2k\_pci (HVM & KVM)
296
    - i82551 (KVM)
297
    - i82557b (KVM)
298
    - i82559er (KVM)
299
    - pcnet (KVM)
300
    - e1000 (KVM)
301
    - paravirtual (default for KVM) (HVM & KVM)
302

    
303
vif\_type
304
    Valid for the Xen HVM hypervisor.
305

    
306
    This parameter specifies the vif type of the nic configuration
307
    of the instance. Unsetting the value leads to no type being specified
308
    in the configuration. Note that this parameter only takes effect when
309
    the 'nic_type' is not set. The possible options are:
310

    
311
    - ioemu
312
    - vif
313

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

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

    
320
    - ioemu [default] (HVM & KVM)
321
    - paravirtual (HVM & KVM)
322
    - ide (KVM)
323
    - scsi (KVM)
324
    - sd (KVM)
325
    - mtd (KVM)
326
    - pflash (KVM)
327

    
328

    
329
cdrom\_disk\_type
330
    Valid for the KVM hypervisor.
331

    
332
    This parameter determines the way the cdroms disks are presented
333
    to the instance. The default behavior is to get the same value of
334
    the earlier parameter (disk_type). The possible options are:
335

    
336
    - paravirtual
337
    - ide
338
    - scsi
339
    - sd
340
    - mtd
341
    - pflash
342

    
343

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

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

    
353
vnc\_password\_file
354
    Valid for the Xen HVM and KVM hypervisors.
355

    
356
    Specifies the location of the file containing the password for
357
    connections using VNC. The default is a file named
358
    vnc-cluster-password which can be found in the configuration
359
    directory.
360

    
361
vnc\_tls
362
    Valid for the KVM hypervisor.
363

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

    
367
vnc\_x509\_path
368
    Valid for the KVM hypervisor.
369

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

    
373
vnc\_x509\_verify
374
    Valid for the KVM hypervisor.
375

    
376
spice\_bind
377
    Valid for the KVM hypervisor.
378

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

    
382
    - IPv4 addresses, including 0.0.0.0 and 127.0.0.1
383
    - IPv6 addresses, including :: and ::1
384
    - names of network interfaces
385

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

    
389
spice\_ip\_version
390
    Valid for the KVM hypervisor.
391

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

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

    
401
spice\_password\_file
402
    Valid for the KVM hypervisor.
403

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

    
408
spice\_image\_compression
409
    Valid for the KVM hypervisor.
410

    
411
    Configures the SPICE lossless image compression. Valid values are:
412

    
413
    - auto_glz
414
    - auto_lz
415
    - quic
416
    - glz
417
    - lz
418
    - off
419

    
420
spice\_jpeg\_wan\_compression
421
    Valid for the KVM hypervisor.
422

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

    
426
    - auto
427
    - never
428
    - always
429

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

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

    
436
    - auto
437
    - never
438
    - always
439

    
440
spice\_streaming\_video
441
    Valid for the KVM hypervisor.
442

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

    
445
    - off
446
    - all
447
    - filter
448

    
449
spice\_playback\_compression
450
    Valid for the KVM hypervisor.
451

    
452
    Configures whether SPICE should compress audio streams or not.
453

    
454
spice\_use\_tls
455
    Valid for the KVM hypervisor.
456

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

    
460
spice\_tls\_ciphers
461
    Valid for the KVM hypervisor.
462

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

    
466
spice\_use\_vdagent
467
    Valid for the KVM hypervisor.
468

    
469
    Enables or disables passing mouse events via SPICE vdagent.
470

    
471
cpu\_type
472
    Valid for the KVM hypervisor.
473

    
474
    This parameter determines the emulated cpu for the instance. If this
475
    parameter is empty (which is the default configuration), it will not
476
    be passed to KVM.
477

    
478
    Be aware of setting this parameter to ``"host"`` if you have nodes
479
    with different CPUs from each other. Live migration may stop working
480
    in this situation.
481

    
482
    For more information please refer to the KVM manual.
483

    
484
acpi
485
    Valid for the Xen HVM and KVM hypervisors.
486

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

    
490
    ACPI should be enabled for user shutdown detection.  See
491
    ``user_shutdown``.
492

    
493
pae
494
    Valid for the Xen HVM and KVM hypervisors.
495

    
496
    A boolean option that specifies if the hypervisor should enable
497
    PAE support for this instance. The default is false, disabling PAE
498
    support.
499

    
500
viridian
501
    Valid for the Xen HVM hypervisor.
502

    
503
    A boolean option that specifies if the hypervisor should enable
504
    viridian (Hyper-V) for this instance. The default is false,
505
    disabling viridian support.
506

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

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

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

    
519
    This option specifies the path (on the node) to the kernel to boot
520
    the instance with. Xen PVM instances always require this, while for
521
    KVM if this option is empty, it will cause the machine to load the
522
    kernel from its disks (and the boot will be done accordingly to
523
    ``boot_order``).
524

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

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

    
532
    The default setting for this value is simply ``"ro"``, which
533
    mounts the root disk (initially) in read-only one. For example,
534
    setting this to single will cause the instance to start in
535
    single-user mode.
536

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

    
540
    This option specifies the path (on the node) to the initrd to boot
541
    the instance with. Xen PVM instances can use this always, while
542
    for KVM if this option is only used if the ``kernel_path`` option
543
    is also specified. You can pass here either an absolute filename
544
    (the path to the initrd) if you want to use an initrd, or use the
545
    format no\_initrd\_path for no initrd.
546

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

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

    
554
    Please note, that if this setting is an empty string and the
555
    hypervisor is Xen it will not be written to the Xen configuration
556
    file
557

    
558
serial\_console
559
    Valid for the KVM hypervisor.
560

    
561
    This boolean option specifies whether to emulate a serial console
562
    for the instance. Note that some versions of KVM have a bug that
563
    will make an instance hang when configured to use the serial console
564
    unless a connection is made to it within about 2 seconds of the
565
    instance's startup. For such case it's recommended to disable this
566
    option, which is enabled by default.
567

    
568
serial\_speed
569
    Valid for the KVM hypervisor.
570

    
571
    This integer option specifies the speed of the serial console.
572
    Common values are 9600, 19200, 38400, 57600 and 115200: choose the
573
    one which works on your system. (The default is 38400 for historical
574
    reasons, but newer versions of kvm/qemu work with 115200)
575

    
576
disk\_cache
577
    Valid for the KVM hypervisor.
578

    
579
    The disk cache mode. It can be either default to not pass any
580
    cache option to KVM, or one of the KVM cache modes: none (for
581
    direct I/O), writethrough (to use the host cache but report
582
    completion to the guest only when the host has committed the
583
    changes to disk) or writeback (to use the host cache and report
584
    completion as soon as the data is in the host cache). Note that
585
    there are special considerations for the cache mode depending on
586
    version of KVM used and disk type (always raw file under Ganeti),
587
    please refer to the KVM documentation for more details.
588

    
589
security\_model
590
    Valid for the KVM hypervisor.
591

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

    
596
    Under *user* kvm will drop privileges and become the user
597
    specified by the security\_domain parameter.
598

    
599
    Under *pool* a global cluster pool of users will be used, making
600
    sure no two instances share the same user on the same node. (this
601
    mode is not implemented yet)
602

    
603
security\_domain
604
    Valid for the KVM hypervisor.
605

    
606
    Under security model *user* the username to run the instance
607
    under.  It must be a valid username existing on the host.
608

    
609
    Cannot be set under security model *none* or *pool*.
610

    
611
kvm\_flag
612
    Valid for the KVM hypervisor.
613

    
614
    If *enabled* the -enable-kvm flag is passed to kvm. If *disabled*
615
    -disable-kvm is passed. If unset no flag is passed, and the
616
    default running mode for your kvm binary will be used.
617

    
618
mem\_path
619
    Valid for the KVM hypervisor.
620

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

    
625
use\_chroot
626
    Valid for the KVM hypervisor.
627

    
628
    This boolean option determines whether to run the KVM instance in a
629
    chroot directory.
630

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

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

    
637
user\_shutdown
638
    Valid for the KVM hypervisor.
639

    
640
    This boolean option determines whether the KVM instance suports user
641
    shutdown detection.  This option does not necessarily require ACPI
642
    enabled, but ACPI must be enabled for users to poweroff their KVM
643
    instances.
644

    
645
    If it is set to ``true``, the user can shutdown this KVM instance
646
    and its status is reported as ``USER_down``.
647

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

    
650
migration\_downtime
651
    Valid for the KVM hypervisor.
652

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

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

    
661
cpu\_mask
662
    Valid for the Xen, KVM and LXC hypervisors.
663

    
664
    The processes belonging to the given instance are only scheduled
665
    on the specified CPUs.
666

    
667
    The format of the mask can be given in three forms. First, the word
668
    "all", which signifies the common case where all VCPUs can live on
669
    any CPU, based on the hypervisor's decisions.
670

    
671
    Second, a comma-separated list of CPU IDs or CPU ID ranges. The
672
    ranges are defined by a lower and higher boundary, separated by a
673
    dash, and the boundaries are inclusive. In this form, all VCPUs of
674
    the instance will be mapped on the selected list of CPUs. Example:
675
    ``0-2,5``, mapping all VCPUs (no matter how many) onto physical CPUs
676
    0, 1, 2 and 5.
677

    
678
    The last form is used for explicit control of VCPU-CPU pinnings. In
679
    this form, the list of VCPU mappings is given as a colon (:)
680
    separated list, whose elements are the possible values for the
681
    second or first form above. In this form, the number of elements in
682
    the colon-separated list _must_ equal the number of VCPUs of the
683
    instance.
684

    
685
    Example:
686

    
687
    .. code-block:: bash
688

    
689
      # Map the entire instance to CPUs 0-2
690
      gnt-instance modify -H cpu_mask=0-2 my-inst
691

    
692
      # Map vCPU 0 to physical CPU 1 and vCPU 1 to CPU 3 (assuming 2 vCPUs)
693
      gnt-instance modify -H cpu_mask=1:3 my-inst
694

    
695
      # Pin vCPU 0 to CPUs 1 or 2, and vCPU 1 to any CPU
696
      gnt-instance modify -H cpu_mask=1-2:all my-inst
697

    
698
      # Pin vCPU 0 to any CPU, vCPU 1 to CPUs 1, 3, 4 or 5, and CPU 2 to
699
      # CPU 0 (backslashes for escaping the comma)
700
      gnt-instance modify -H cpu_mask=all:1\\,3-5:0 my-inst
701

    
702
      # Pin entire VM to CPU 0
703
      gnt-instance modify -H cpu_mask=0 my-inst
704

    
705
      # Turn off CPU pinning (default setting)
706
      gnt-instance modify -H cpu_mask=all my-inst
707

    
708
cpu\_cap
709
    Valid for the Xen hypervisor.
710

    
711
    Set the maximum amount of cpu usage by the VM. The value is a percentage
712
    between 0 and (100 * number of VCPUs). Default cap is 0: unlimited.
713

    
714
cpu\_weight
715
    Valid for the Xen hypervisor.
716

    
717
    Set the cpu time ratio to be allocated to the VM. Valid values are
718
    between 1 and 65535. Default weight is 256.
719

    
720
usb\_mouse
721
    Valid for the KVM hypervisor.
722

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

    
727
keymap
728
    Valid for the KVM hypervisor.
729

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

    
733
reboot\_behavior
734
    Valid for Xen PVM, Xen HVM and KVM hypervisors.
735

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

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

    
742
cpu\_cores
743
    Valid for the KVM hypervisor.
744

    
745
    Number of emulated CPU cores.
746

    
747
cpu\_threads
748
    Valid for the KVM hypervisor.
749

    
750
    Number of emulated CPU threads.
751

    
752
cpu\_sockets
753
    Valid for the KVM hypervisor.
754

    
755
    Number of emulated CPU sockets.
756

    
757
soundhw
758
    Valid for the KVM and XEN hypervisors.
759

    
760
    Comma separated list of emulated sounds cards, or "all" to enable
761
    all the available ones.
762

    
763
cpuid
764
    Valid for the XEN hypervisor.
765

    
766
    Modify the values returned by CPUID_ instructions run within instances.
767

    
768
    This allows you to enable migration between nodes with different CPU
769
    attributes like cores, threads, hyperthreading or SS4 support by hiding
770
    the extra features where needed.
771

    
772
    See the XEN documentation for syntax and more information.
773

    
774
.. _CPUID: http://en.wikipedia.org/wiki/CPUID
775

    
776
usb\_devices
777
    Valid for the KVM hypervisor.
778

    
779
    Space separated list of usb devices. These can be emulated devices
780
    or passthrough ones, and each one gets passed to kvm with its own
781
    ``-usbdevice`` option. See the **qemu**\(1) manpage for the syntax
782
    of the possible components. Note that values set with this
783
    parameter are split on a space character and currently don't support
784
    quoting. For backwards compatibility reasons, the RAPI interface keeps
785
    accepting comma separated lists too.
786

    
787
vga
788
    Valid for the KVM hypervisor.
789

    
790
    Emulated vga mode, passed the the kvm -vga option.
791

    
792
kvm\_extra
793
    Valid for the KVM hypervisor.
794

    
795
    Any other option to the KVM hypervisor, useful tweaking anything
796
    that Ganeti doesn't support. Note that values set with this
797
    parameter are split on a space character and currently don't support
798
    quoting.
799

    
800
machine\_version
801
    Valid for the KVM hypervisor.
802

    
803
    Use in case an instance must be booted with an exact type of
804
    machine version (due to e.g. outdated drivers). In case it's not set
805
    the default version supported by your version of kvm is used.
806

    
807
migration\_caps
808
    Valid for the KVM hypervisor.
809

    
810
    Enable specific migration capabilities by providing a ":" separated
811
    list of supported capabilites. QEMU version 1.7.0 defines
812
    x-rdma-pin-all, auto-converge, zero-blocks, and xbzrle. Please note
813
    that while a combination of xbzrle and auto-converge might speed up
814
    the migration process significantly, the first may cause BSOD on
815
    Windows8r2 instances running on drbd.
816

    
817
kvm\_path
818
    Valid for the KVM hypervisor.
819

    
820
    Path to the userspace KVM (or qemu) program.
821

    
822
vnet\_hdr
823
    Valid for the KVM hypervisor.
824

    
825
    This boolean option determines whether the tap devices used by the
826
    KVM paravirtual nics (virtio-net) will get created with VNET_HDR
827
    (IFF_VNET_HDR) support.
828

    
829
    If set to false, it effectively disables offloading on the virio-net
830
    interfaces, which prevents host kernel tainting and log flooding,
831
    when dealing with broken or malicious virtio-net drivers.
832

    
833
    It is set to ``true`` by default.
834

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

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

    
842
You can also specify OS parameters that should not be logged but reused
843
at the next reinstall with ``--os-parameters-private`` and OS parameters
844
that should not be logged or saved to configuration with
845
``--os-parameters-secret``. Bear in mind that:
846

    
847
  * Launching the daemons in debug mode will cause debug logging to
848
    happen, which leaks private and secret parameters to the log files.
849
    Do not use the debug mode in production. Deamons will emit a warning
850
    on startup if they are in debug mode.
851
  * You will have to pass again all ``--os-parameters-secret`` parameters
852
    should you want to reinstall this instance.
853

    
854
The ``-I (--iallocator)`` option specifies the instance allocator plugin
855
to use (``.`` means the default allocator). If you pass in this option
856
the allocator will select nodes for this instance automatically, so you
857
don't need to pass them with the ``-n`` option. For more information
858
please refer to the instance allocator documentation.
859

    
860
The ``-t (--disk-template)`` options specifies the disk layout type
861
for the instance. If no disk template is specified, the default disk
862
template is used. The default disk template is the first in the list
863
of enabled disk templates, which can be adjusted cluster-wide with
864
``gnt-cluster modify``. The available choices for disk templates are:
865

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

    
870
file
871
    Disk devices will be regular files.
872

    
873
sharedfile
874
    Disk devices will be regulare files on a shared directory.
875

    
876
plain
877
    Disk devices will be logical volumes.
878

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

    
882
rbd
883
    Disk devices will be rbd volumes residing inside a RADOS cluster.
884

    
885
blockdev
886
    Disk devices will be adopted pre-existent block devices.
887

    
888
ext
889
    Disk devices will be provided by external shared storage,
890
    through the ExtStorage Interface using ExtStorage providers.
891

    
892
The optional second value of the ``-n (--node)`` is used for the drbd
893
template type and specifies the remote node.
894

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

    
898
The ``--file-storage-dir`` specifies the relative path under the
899
cluster-wide file storage directory to store file-based disks. It is
900
useful for having different subdirectories for different
901
instances. The full path of the directory where the disk files are
902
stored will consist of cluster-wide file storage directory + optional
903
subdirectory + instance name. This option is only relevant for
904
instances using the file storage backend.
905

    
906
The ``--file-driver`` specifies the driver to use for file-based
907
disks. Note that currently these drivers work with the xen hypervisor
908
only. This option is only relevant for instances using the file
909
storage backend. The available choices are:
910

    
911
loop
912
    Kernel loopback driver. This driver uses loopback devices to
913
    access the filesystem within the file. However, running I/O
914
    intensive applications in your instance using the loop driver
915
    might result in slowdowns. Furthermore, if you use the loopback
916
    driver consider increasing the maximum amount of loopback devices
917
    (on most systems it's 8) using the max\_loop param.
918

    
919
blktap
920
    The blktap driver (for Xen hypervisors). In order to be able to
921
    use the blktap driver you should check if the 'blktapctrl' user
922
    space disk agent is running (usually automatically started via
923
    xend).  This user-level disk I/O interface has the advantage of
924
    better performance. Especially if you use a network file system
925
    (e.g. NFS) to store your instances this is the recommended choice.
926

    
927
blktap2
928
    Analogous to the blktap driver, but used by newer versions of Xen.
929

    
930
If ``--ignore-ipolicy`` is given any instance policy violations occuring
931
during this operation are ignored.
932

    
933
The ``-c`` and ``--communication`` specify whether to enable/disable
934
instance communication, which is a communication mechanism between the
935
instance and the host.
936

    
937
See **ganeti**\(7) for a description of ``--submit`` and other common
938
options.
939

    
940
Example::
941

    
942
    # gnt-instance add -t file --disk 0:size=30g -B maxmem=512 -o debian-etch \
943
      -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
944
    # gnt-instance add -t plain --disk 0:size=30g -B maxmem=1024,minmem=512 \
945
      -o debian-etch -n node1.example.com instance1.example.com
946
    # gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
947
      -B maxmem=512 -o debian-etch -n node1.example.com instance1.example.com
948
    # gnt-instance add -t drbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
949
      -n node1.example.com:node2.example.com instance2.example.com
950
    # gnt-instance add -t rbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
951
      -n node1.example.com instance1.example.com
952
    # gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1 -B maxmem=512 \
953
      -o debian-etch -n node1.example.com instance1.example.com
954
    # gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1,param1=val1 \
955
      --disk 1:size=40g,provider=pvdr2,param2=val2,param3=val3 -B maxmem=512 \
956
      -o debian-etch -n node1.example.com instance1.example.com
957

    
958

    
959
BATCH-CREATE
960
^^^^^^^^^^^^
961

    
962
| **batch-create**
963
| [{-I|\--iallocator} *instance allocator*]
964
| {instances\_file.json}
965

    
966
This command (similar to the Ganeti 1.2 **batcher** tool) submits
967
multiple instance creation jobs based on a definition file. This
968
file can contain all options which are valid when adding an instance
969
with the exception of the ``iallocator`` field. The IAllocator is,
970
for optimization purposes, only allowed to be set for the whole batch
971
operation using the ``--iallocator`` parameter.
972

    
973
The instance file must be a valid-formed JSON file, containing an
974
array of dictionaries with instance creation parameters. All parameters
975
(except ``iallocator``) which are valid for the instance creation
976
OP code are allowed. The most important ones are:
977

    
978
instance\_name
979
    The FQDN of the new instance.
980

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

    
985
disks
986
    Array of disk specifications. Each entry describes one disk as a
987
    dictionary of disk parameters.
988

    
989
beparams
990
    A dictionary of backend parameters.
991

    
992
hypervisor
993
    The hypervisor for the instance.
994

    
995
hvparams
996
    A dictionary with the hypervisor options. If not passed, the default
997
    hypervisor options will be inherited.
998

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

    
1005
pnode, snode
1006
    The primary and optionally the secondary node to use for the
1007
    instance (in case an iallocator script is not used). If those
1008
    parameters are given, they have to be given consistently for all
1009
    instances in the batch operation.
1010

    
1011
start
1012
    whether to start the instance
1013

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

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

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

    
1026

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

    
1030
    [
1031
      {
1032
        "mode": "create",
1033
        "instance_name": "instance1.example.com",
1034
        "disk_template": "drbd",
1035
        "os_type": "debootstrap",
1036
        "disks": [{"size":"1024"}],
1037
        "nics": [{}],
1038
        "hypervisor": "xen-pvm"
1039
      },
1040
      {
1041
        "mode": "create",
1042
        "instance_name": "instance2.example.com",
1043
        "disk_template": "drbd",
1044
        "os_type": "debootstrap",
1045
        "disks": [{"size":"4096", "mode": "rw", "vg": "xenvg"}],
1046
        "nics": [{}],
1047
        "hypervisor": "xen-hvm",
1048
        "hvparams": {"acpi": true},
1049
        "beparams": {"maxmem": 512, "minmem": 256}
1050
      }
1051
    ]
1052

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

    
1056
    # gnt-instance batch-create instances.json
1057
    Submitted jobs 37, 38
1058

    
1059

    
1060
Note: If the allocator is used for computing suitable nodes for the
1061
instances, it will only take into account disk information for the
1062
default disk template. That means, even if other disk templates are
1063
specified for the instances, storage space information of these disk
1064
templates will not be considered in the allocation computation.
1065

    
1066

    
1067
REMOVE
1068
^^^^^^
1069

    
1070
| **remove** [\--ignore-failures] [\--shutdown-timeout=*N*] [\--submit]
1071
| [\--print-job-id] [\--force] {*instance*}
1072

    
1073
Remove an instance. This will remove all data from the instance and
1074
there is *no way back*. If you are not sure if you use an instance
1075
again, use **shutdown** first and leave it in the shutdown state for a
1076
while.
1077

    
1078
The ``--ignore-failures`` option will cause the removal to proceed
1079
even in the presence of errors during the removal of the instance
1080
(e.g. during the shutdown or the disk removal). If this option is not
1081
given, the command will stop at the first error.
1082

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

    
1088
The ``--force`` option is used to skip the interactive confirmation.
1089

    
1090
See **ganeti**\(7) for a description of ``--submit`` and other common
1091
options.
1092

    
1093
Example::
1094

    
1095
    # gnt-instance remove instance1.example.com
1096

    
1097

    
1098
LIST
1099
^^^^
1100

    
1101
| **list**
1102
| [\--no-headers] [\--separator=*SEPARATOR*] [\--units=*UNITS*] [-v]
1103
| [{-o|\--output} *[+]FIELD,...*] [\--filter] [instance...]
1104

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

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

    
1113
The units used to display the numeric values in the output varies,
1114
depending on the options given. By default, the values will be
1115
formatted in the most appropriate unit. If the ``--separator`` option
1116
is given, then the values are shown in mebibytes to allow parsing by
1117
scripts. In both cases, the ``--units`` option can be used to enforce
1118
a given output unit.
1119

    
1120
The ``-v`` option activates verbose mode, which changes the display of
1121
special field states (see **ganeti**\(7)).
1122

    
1123
The ``-o (--output)`` option takes a comma-separated list of output
1124
fields. The available fields and their meaning are:
1125

    
1126
@QUERY_FIELDS_INSTANCE@
1127

    
1128
If the value of the option starts with the character ``+``, the new
1129
field(s) will be added to the default list. This allows one to quickly
1130
see the default list plus a few other fields, instead of retyping the
1131
entire list of fields.
1132

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

    
1142
If exactly one argument is given and it appears to be a query filter
1143
(see **ganeti**\(7)), the query result is filtered accordingly. For
1144
ambiguous cases (e.g. a single field name as a filter) the ``--filter``
1145
(``-F``) option forces the argument to be treated as a filter (e.g.
1146
``gnt-instance list -F admin_state``).
1147

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

    
1151

    
1152
LIST-FIELDS
1153
^^^^^^^^^^^
1154

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

    
1157
Lists available fields for instances.
1158

    
1159

    
1160
INFO
1161
^^^^
1162

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

    
1165
Show detailed information about the given instance(s). This is
1166
different from **list** as it shows detailed data about the instance's
1167
disks (especially useful for the drbd disk template).
1168

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

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

    
1176
The ``--roman`` option can be used to cause envy among people who like
1177
ancient cultures, but are stuck with non-latin-friendly cluster
1178
virtualization technologies.
1179

    
1180
MODIFY
1181
^^^^^^
1182

    
1183
| **modify**
1184
| [{-H|\--hypervisor-parameters} *HYPERVISOR\_PARAMETERS*]
1185
| [{-B|\--backend-parameters} *BACKEND\_PARAMETERS*]
1186
| [{-m|\--runtime-memory} *SIZE*]
1187
| [\--net add[:options...] \|
1188
|  \--net [*N*:]add[,options...] \|
1189
|  \--net [*ID*:]remove \|
1190
|  \--net *ID*:modify[,options...]]
1191
| [\--disk add:size=*SIZE*[,options...] \|
1192
|  \--disk *N*:add,size=*SIZE*[,options...] \|
1193
|  \--disk *N*:add,size=*SIZE*,provider=*PROVIDER*[,options...][,param=*value*... ] \|
1194
|  \--disk *ID*:modify[,options...]
1195
|  \--disk [*ID*:]remove]
1196
| [{-t|\--disk-template} plain \| {-t|\--disk-template} drbd -n *new_secondary*] [\--no-wait-for-sync]
1197
| [\--new-primary=*node*]
1198
| [\--os-type=*OS* [\--force-variant]]
1199
| [{-O|\--os-parameters} *param*=*value*... ]
1200
| [--os-parameters-private *param*=*value*... ]
1201
| [\--offline \| \--online]
1202
| [\--submit] [\--print-job-id]
1203
| [\--ignore-ipolicy]
1204
| [\--hotplug]
1205
| [\--hotplug-if-possible]
1206
| {*instance*}
1207

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

    
1213
The ``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``
1214
and ``-O (--os-parameters)`` options specifies hypervisor, backend and
1215
OS parameter options in the form of name=value[,...]. For details
1216
which options can be specified, see the **add** command.
1217

    
1218
The ``-t (--disk-template)`` option will change the disk template of
1219
the instance.  Currently only conversions between the plain and drbd
1220
disk templates are supported, and the instance must be stopped before
1221
attempting the conversion. When changing from the plain to the drbd
1222
disk template, a new secondary node must be specified via the ``-n``
1223
option. The option ``--no-wait-for-sync`` can be used when converting
1224
to the ``drbd`` template in order to make the instance available for
1225
startup before DRBD has finished resyncing.
1226

    
1227
The ``-m (--runtime-memory)`` option will change an instance's runtime
1228
memory to the given size (in MB if a different suffix is not specified),
1229
by ballooning it up or down to the new value.
1230

    
1231
The ``--disk add:size=*SIZE*,[options..]`` option adds a disk to the
1232
instance, and ``--disk *N*:add:size=*SIZE*,[options..]`` will add a disk
1233
to the the instance at a specific index. The available options are the
1234
same as in the **add** command(``spindles``, ``mode``, ``name``, ``vg``,
1235
``metavg``). Per default, gnt-instance waits for the disk mirror to sync.
1236
If you do not want this behavior, use the ``--no-wait-for-sync`` option.
1237
When adding an ExtStorage disk, the ``provider=*PROVIDER*`` option is
1238
also mandatory and specifies the ExtStorage provider. Also, for
1239
ExtStorage disks arbitrary parameters can be passed as additional comma
1240
separated options, same as in the **add** command. The ``--disk remove``
1241
option will remove the last disk of the instance. Use
1242
``--disk `` *ID*``:remove`` to remove a disk by its identifier. *ID*
1243
can be the index of the disk, the disks's name or the disks's UUID. The
1244
``--disk *ID*:modify[,options...]`` will change the options of the disk.
1245
Available options are:
1246

    
1247
mode
1248
  The access mode. Either ``ro`` (read-only) or the default ``rw`` (read-write).
1249

    
1250
name
1251
   This option specifies a name for the disk, which can be used as a disk
1252
   identifier. An instance can not have two disks with the same name.
1253

    
1254
The ``--net *N*:add[,options..]`` will add a new network interface to
1255
the instance. The available options are the same as in the **add**
1256
command (``mac``, ``ip``, ``link``, ``mode``, ``network``). The
1257
``--net *ID*,remove`` will remove the intances' NIC with *ID* identifier,
1258
which can be the index of the NIC, the NIC's name or the NIC's UUID.
1259
The ``--net *ID*:modify[,options..]`` option will change the parameters of
1260
the instance network interface with the *ID* identifier.
1261

    
1262
The option ``-o (--os-type)`` will change the OS name for the instance
1263
(without reinstallation). In case an OS variant is specified that is
1264
not found, then by default the modification is refused, unless
1265
``--force-variant`` is passed. An invalid OS will also be refused,
1266
unless the ``--force`` option is given.
1267

    
1268
The option ``--new-primary`` will set the new primary node of an instance
1269
assuming the disks have already been moved manually. Unless the ``--force``
1270
option is given, it is verified that the instance is no longer running
1271
on its current primary node.
1272

    
1273
The ``--online`` and ``--offline`` options are used to transition an
1274
instance into and out of the ``offline`` state. An instance can be
1275
turned offline only if it was previously down. The ``--online`` option
1276
fails if the instance was not in the ``offline`` state, otherwise it
1277
changes instance's state to ``down``. These modifications take effect
1278
immediately.
1279

    
1280
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1281
during this operation are ignored.
1282

    
1283
If ``--hotplug`` is given any disk and NIC modifications will take
1284
effect without the need of actual reboot. Please note that this feature
1285
is currently supported only for KVM hypervisor and there are some
1286
restrictions: a) KVM versions >= 1.0 support it b) instances with chroot
1287
or uid pool security model do not support disk hotplug c) RBD disks with
1288
userspace access mode can not be hotplugged (yet) d) if hotplug fails
1289
(for any reason) a warning is printed but execution is continued e)
1290
for existing NIC modification interactive verification is needed unless
1291
``--force`` option is passed.
1292

    
1293
If ``--hotplug-if-possible`` is given then ganeti won't abort in case
1294
hotplug is not supported. It will continue execution and modification
1295
will take place after reboot. This covers use cases where instances are
1296
not running or hypervisor is not KVM.
1297

    
1298
See **ganeti**\(7) for a description of ``--submit`` and other common
1299
options.
1300

    
1301
Most of the changes take effect at the next restart. If the instance is
1302
running, there is no effect on the instance.
1303

    
1304
REINSTALL
1305
^^^^^^^^^
1306

    
1307
| **reinstall** [{-o|\--os-type} *os-type*] [\--select-os] [-f *force*]
1308
| [\--force-multiple]
1309
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all]
1310
| [{-O|\--os-parameters} *OS\_PARAMETERS*]
1311
| [--os-parameters-private} *OS\_PARAMETERS*]
1312
| [--os-parameters-secret} *OS\_PARAMETERS*]
1313
| [\--submit] [\--print-job-id]
1314
| {*instance*...}
1315

    
1316
Reinstalls the operating system on the given instance(s). The
1317
instance(s) must be stopped when running this command. If the ``-o
1318
(--os-type)`` is specified, the operating system is changed.
1319

    
1320
The ``--select-os`` option switches to an interactive OS reinstall.
1321
The user is prompted to select the OS template from the list of
1322
available OS templates. OS parameters can be overridden using ``-O
1323
(--os-parameters)`` (more documentation for this option under the
1324
**add** command).
1325

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

    
1333
See **ganeti**\(7) for a description of ``--submit`` and other common
1334
options.
1335

    
1336
RENAME
1337
^^^^^^
1338

    
1339
| **rename** [\--no-ip-check] [\--no-name-check] [\--submit] [\--print-job-id]
1340
| {*instance*} {*new\_name*}
1341

    
1342
Renames the given instance. The instance must be stopped when running
1343
this command. The requirements for the new name are the same as for
1344
adding an instance: the new name must be resolvable and the IP it
1345
resolves to must not be reachable (in order to prevent duplicate IPs
1346
the next time the instance is started). The IP test can be skipped if
1347
the ``--no-ip-check`` option is passed.
1348

    
1349
Note that you can rename an instance to its same name, to force
1350
re-executing the os-specific rename script for that instance, if
1351
needed.
1352

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

    
1359
See **ganeti**\(7) for a description of ``--submit`` and other common
1360
options.
1361

    
1362
Starting/stopping/connecting to console
1363
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1364

    
1365
STARTUP
1366
^^^^^^^
1367

    
1368
| **startup**
1369
| [\--force] [\--ignore-offline]
1370
| [\--force-multiple] [\--no-remember]
1371
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1372
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1373
| [{-H|\--hypervisor-parameters} ``key=value...``]
1374
| [{-B|\--backend-parameters} ``key=value...``]
1375
| [\--submit] [\--print-job-id] [\--paused]
1376
| {*name*...}
1377

    
1378
Starts one or more instances, depending on the following options.  The
1379
four available modes are:
1380

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

    
1385
\--node
1386
    will start the instances who have the given node as either primary
1387
    or secondary
1388

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

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

    
1397
\--all
1398
    will start all instances in the cluster (no arguments accepted)
1399

    
1400
\--tags
1401
    will start all instances in the cluster with the tags given as
1402
    arguments
1403

    
1404
\--node-tags
1405
    will start all instances in the cluster on nodes with the tags
1406
    given as arguments
1407

    
1408
\--pri-node-tags
1409
    will start all instances in the cluster on primary nodes with the
1410
    tags given as arguments
1411

    
1412
\--sec-node-tags
1413
    will start all instances in the cluster on secondary nodes with the
1414
    tags given as arguments
1415

    
1416
Note that although you can pass more than one selection option, the
1417
last one wins, so in order to guarantee the desired result, don't pass
1418
more than one such option.
1419

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

    
1424
The ``--force-multiple`` will skip the interactive confirmation in the
1425
case the more than one instance will be affected.
1426

    
1427
The ``--no-remember`` option will perform the startup but not change
1428
the state of the instance in the configuration file (if it was stopped
1429
before, Ganeti will still think it needs to be stopped). This can be
1430
used for testing, or for a one shot-start where you don't want the
1431
watcher to restart the instance if it crashes.
1432

    
1433
The ``-H (--hypervisor-parameters)`` and ``-B (--backend-parameters)``
1434
options specify temporary hypervisor and backend parameters that can
1435
be used to start an instance with modified parameters. They can be
1436
useful for quick testing without having to modify an instance back and
1437
forth, e.g.::
1438

    
1439
    # gnt-instance start -H kernel_args="single" instance1
1440
    # gnt-instance start -B maxmem=2048 instance2
1441

    
1442

    
1443
The first form will start the instance instance1 in single-user mode,
1444
and the instance instance2 with 2GB of RAM (this time only, unless
1445
that is the actual instance memory size already). Note that the values
1446
override the instance parameters (and not extend them): an instance
1447
with "kernel\_args=ro" when started with -H kernel\_args=single will
1448
result in "single", not "ro single".
1449

    
1450
The ``--paused`` option is only valid for Xen and kvm hypervisors.  This
1451
pauses the instance at the start of bootup, awaiting ``gnt-instance
1452
console`` to unpause it, allowing the entire boot process to be
1453
monitored for debugging.
1454

    
1455
See **ganeti**\(7) for a description of ``--submit`` and other common
1456
options.
1457

    
1458
Example::
1459

    
1460
    # gnt-instance start instance1.example.com
1461
    # gnt-instance start --node node1.example.com node2.example.com
1462
    # gnt-instance start --all
1463

    
1464

    
1465
SHUTDOWN
1466
^^^^^^^^
1467

    
1468
| **shutdown**
1469
| [\--timeout=*N*]
1470
| [\--force] [\--force-multiple] [\--ignore-offline] [\--no-remember]
1471
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1472
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1473
| [\--submit] [\--print-job-id]
1474
| {*name*...}
1475

    
1476
Stops one or more instances. If the instance cannot be cleanly stopped
1477
during a hardcoded interval (currently 2 minutes), it will forcibly
1478
stop the instance (equivalent to switching off the power on a physical
1479
machine).
1480

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

    
1486
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1487
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1488
``--sec-node-tags`` options are similar as for the **startup** command
1489
and they influence the actual instances being shutdown.
1490

    
1491
``--ignore-offline`` can be used to ignore offline primary nodes and
1492
force the instance to be marked as stopped. This option should be used
1493
with care as it can lead to an inconsistent cluster state.
1494

    
1495
Use ``--force`` to be able to shutdown an instance even when it's marked
1496
as offline. This is useful is an offline instance ends up in the
1497
``ERROR_up`` state, for example.
1498

    
1499
The ``--no-remember`` option will perform the shutdown but not change
1500
the state of the instance in the configuration file (if it was running
1501
before, Ganeti will still thinks it needs to be running). This can be
1502
useful for a cluster-wide shutdown, where some instances are marked as
1503
up and some as down, and you don't want to change the running state:
1504
you just need to disable the watcher, shutdown all instances with
1505
``--no-remember``, and when the watcher is activated again it will
1506
restore the correct runtime state for all instances.
1507

    
1508
See **ganeti**\(7) for a description of ``--submit`` and other common
1509
options.
1510

    
1511
Example::
1512

    
1513
    # gnt-instance shutdown instance1.example.com
1514
    # gnt-instance shutdown --all
1515

    
1516

    
1517
REBOOT
1518
^^^^^^
1519

    
1520
| **reboot**
1521
| [{-t|\--type} *REBOOT-TYPE*]
1522
| [\--ignore-secondaries]
1523
| [\--shutdown-timeout=*N*]
1524
| [\--force-multiple]
1525
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1526
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1527
| [\--submit] [\--print-job-id]
1528
| [*name*...]
1529

    
1530
Reboots one or more instances. The type of reboot depends on the value
1531
of ``-t (--type)``. A soft reboot does a hypervisor reboot, a hard reboot
1532
does a instance stop, recreates the hypervisor config for the instance
1533
and starts the instance. A full reboot does the equivalent of
1534
**gnt-instance shutdown && gnt-instance startup**.  The default is
1535
hard reboot.
1536

    
1537
For the hard reboot the option ``--ignore-secondaries`` ignores errors
1538
for the secondary node while re-assembling the instance disks.
1539

    
1540
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1541
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1542
``--sec-node-tags`` options are similar as for the **startup** command
1543
and they influence the actual instances being rebooted.
1544

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

    
1550
The ``--force-multiple`` will skip the interactive confirmation in the
1551
case the more than one instance will be affected.
1552

    
1553
See **ganeti**\(7) for a description of ``--submit`` and other common
1554
options.
1555

    
1556
Example::
1557

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

    
1561

    
1562
CONSOLE
1563
^^^^^^^
1564

    
1565
**console** [\--show-cmd] {*instance*}
1566

    
1567
Connects to the console of the given instance. If the instance is not
1568
up, an error is returned. Use the ``--show-cmd`` option to display the
1569
command instead of executing it.
1570

    
1571
For HVM instances, this will attempt to connect to the serial console
1572
of the instance. To connect to the virtualized "physical" console of a
1573
HVM instance, use a VNC client with the connection info from the
1574
**info** command.
1575

    
1576
For Xen/kvm instances, if the instance is paused, this attempts to
1577
unpause the instance after waiting a few seconds for the connection to
1578
the console to be made.
1579

    
1580
Example::
1581

    
1582
    # gnt-instance console instance1.example.com
1583

    
1584

    
1585
Disk management
1586
~~~~~~~~~~~~~~~
1587

    
1588
REPLACE-DISKS
1589
^^^^^^^^^^^^^
1590

    
1591
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1592
| [\--ignore-ipolicy] {-p} [\--disks *idx*] {*instance*}
1593

    
1594
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1595
| [\--ignore-ipolicy] {-s} [\--disks *idx*] {*instance*}
1596

    
1597
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1598
| [\--ignore-ipolicy]
1599
| {{-I\|\--iallocator} *name* \| {{-n|\--new-secondary} *node* } {*instance*}
1600

    
1601
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1602
| [\--ignore-ipolicy] {-a\|\--auto} {*instance*}
1603

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

    
1607
The first form (when passing the ``-p`` option) will replace the disks
1608
on the primary, while the second form (when passing the ``-s`` option
1609
will replace the disks on the secondary node. For these two cases (as
1610
the node doesn't change), it is possible to only run the replace for a
1611
subset of the disks, using the option ``--disks`` which takes a list
1612
of comma-delimited disk indices (zero-based), e.g. 0,2 to replace only
1613
the first and third disks.
1614

    
1615
The third form (when passing either the ``--iallocator`` or the
1616
``--new-secondary`` option) is designed to change secondary node of the
1617
instance. Specifying ``--iallocator`` makes the new secondary be
1618
selected automatically by the specified allocator plugin (use ``.`` to
1619
indicate the default allocator), otherwise the new secondary node will
1620
be the one chosen manually via the ``--new-secondary`` option.
1621

    
1622
Note that it is not possible to select an offline or drained node as a
1623
new secondary.
1624

    
1625
The fourth form (when using ``--auto``) will automatically determine
1626
which disks of an instance are faulty and replace them within the same
1627
node. The ``--auto`` option works only when an instance has only
1628
faulty disks on either the primary or secondary node; it doesn't work
1629
when both sides have faulty disks.
1630

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

    
1640
The ``--ignore-ipolicy`` let the command ignore instance policy
1641
violations if replace-disks changes groups and the instance would
1642
violate the new groups instance policy.
1643

    
1644
See **ganeti**\(7) for a description of ``--submit`` and other common
1645
options.
1646

    
1647
ACTIVATE-DISKS
1648
^^^^^^^^^^^^^^
1649

    
1650
| **activate-disks** [\--submit] [\--print-job-id] [\--ignore-size]
1651
| [\--wait-for-sync] {*instance*}
1652

    
1653
Activates the block devices of the given instance. If successful, the
1654
command will show the location and name of the block devices::
1655

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

    
1659

    
1660
In this example, *node1.example.com* is the name of the node on which
1661
the devices have been activated. The *disk/0* and *disk/1* are the
1662
Ganeti-names of the instance disks; how they are visible inside the
1663
instance is hypervisor-specific. */dev/drbd0* and */dev/drbd1* are the
1664
actual block devices as visible on the node.
1665

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

    
1673
The ``--wait-for-sync`` option will ensure that the command returns only
1674
after the instance's disks are synchronised (mostly for DRBD); this can
1675
be useful to ensure consistency, as otherwise there are no commands that
1676
can wait until synchronisation is done. However when passing this
1677
option, the command will have additional output, making it harder to
1678
parse the disk information.
1679

    
1680
Note that it is safe to run this command while the instance is already
1681
running.
1682

    
1683
See **ganeti**\(7) for a description of ``--submit`` and other common
1684
options.
1685

    
1686
DEACTIVATE-DISKS
1687
^^^^^^^^^^^^^^^^
1688

    
1689
**deactivate-disks** [-f] [\--submit] [\--print-job-id] {*instance*}
1690

    
1691
De-activates the block devices of the given instance. Note that if you
1692
run this command for an instance with a drbd disk template, while it
1693
is running, it will not be able to shutdown the block devices on the
1694
primary node, but it will shutdown the block devices on the secondary
1695
nodes, thus breaking the replication.
1696

    
1697
The ``-f``/``--force`` option will skip checks that the instance is
1698
down; in case the hypervisor is confused and we can't talk to it,
1699
normally Ganeti will refuse to deactivate the disks, but with this
1700
option passed it will skip this check and directly try to deactivate
1701
the disks. This can still fail due to the instance actually running or
1702
other issues.
1703

    
1704
See **ganeti**\(7) for a description of ``--submit`` and other common
1705
options.
1706

    
1707
GROW-DISK
1708
^^^^^^^^^
1709

    
1710
| **grow-disk** [\--no-wait-for-sync] [\--submit] [\--print-job-id]
1711
| [\--absolute]
1712
| {*instance*} {*disk*} {*amount*}
1713

    
1714
Grows an instance's disk. This is only possible for instances having a
1715
plain, drbd, file, sharedfile, rbd or ext disk template. For the ext
1716
template to work, the ExtStorage provider should also support growing.
1717
This means having a ``grow`` script that actually grows the volume of
1718
the external shared storage.
1719

    
1720
Note that this command only change the block device size; it will not
1721
grow the actual filesystems, partitions, etc. that live on that
1722
disk. Usually, you will need to:
1723

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

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

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

    
1732
The *disk* argument is the index of the instance disk to grow. The
1733
*amount* argument is given as a number which can have a suffix (like the
1734
disk size in instance create); if the suffix is missing, the value will
1735
be interpreted as mebibytes.
1736

    
1737
By default, the *amount* value represents the desired increase in the
1738
disk size (e.g. an amount of 1G will take a disk of size 3G to 4G). If
1739
the optional ``--absolute`` parameter is passed, then the *amount*
1740
argument doesn't represent the delta, but instead the desired final disk
1741
size (e.g. an amount of 8G will take a disk of size 4G to 8G).
1742

    
1743
For instances with a drbd template, note that the disk grow operation
1744
might complete on one node but fail on the other; this will leave the
1745
instance with different-sized LVs on the two nodes, but this will not
1746
create problems (except for unused space).
1747

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

    
1751
See **ganeti**\(7) for a description of ``--submit`` and other common
1752
options.
1753

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

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

    
1758
Example for increasing the disk size to a certain size::
1759

    
1760
   # gnt-instance grow-disk --absolute instance1.example.com 0 32g
1761

    
1762
Also note that disk shrinking is not supported; use **gnt-backup
1763
export** and then **gnt-backup import** to reduce the disk size of an
1764
instance.
1765

    
1766
RECREATE-DISKS
1767
^^^^^^^^^^^^^^
1768

    
1769
| **recreate-disks** [\--submit] [\--print-job-id]
1770
| [{-n node1:[node2] \| {-I\|\--iallocator *name*}}]
1771
| [\--disk=*N*[:[size=*VAL*][,spindles=*VAL*][,mode=*ro\|rw*]]] {*instance*}
1772

    
1773
Recreates all or a subset of disks of the given instance.
1774

    
1775
Note that this functionality should only be used for missing disks; if
1776
any of the given disks already exists, the operation will fail.  While
1777
this is suboptimal, recreate-disks should hopefully not be needed in
1778
normal operation and as such the impact of this is low.
1779

    
1780
If only a subset should be recreated, any number of ``disk`` options can
1781
be specified. It expects a disk index and an optional list of disk
1782
parameters to change. Only ``size``, ``spindles``, and ``mode`` can be
1783
changed while recreating disks. To recreate all disks while changing
1784
parameters on a subset only, a ``--disk`` option must be given for every
1785
disk of the instance.
1786

    
1787
Optionally the instance's disks can be recreated on different
1788
nodes. This can be useful if, for example, the original nodes of the
1789
instance have gone down (and are marked offline), so we can't recreate
1790
on the same nodes. To do this, pass the new node(s) via ``-n`` option,
1791
with a syntax similar to the **add** command. The number of nodes
1792
passed must equal the number of nodes that the instance currently
1793
has. Note that changing nodes is only allowed when all disks are
1794
replaced, e.g. when no ``--disk`` option is passed.
1795

    
1796
Another method of choosing which nodes to place the instance on is by
1797
using the specified iallocator, passing the ``--iallocator`` option.
1798
The primary and secondary nodes will be chosen by the specified
1799
iallocator plugin, or by the default allocator if ``.`` is specified.
1800

    
1801
See **ganeti**\(7) for a description of ``--submit`` and other common
1802
options.
1803

    
1804
Recovery/moving
1805
~~~~~~~~~~~~~~~
1806

    
1807
FAILOVER
1808
^^^^^^^^
1809

    
1810
| **failover** [-f] [\--ignore-consistency] [\--ignore-ipolicy]
1811
| [\--shutdown-timeout=*N*]
1812
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*]
1813
| [\--cleanup]
1814
| [\--submit] [\--print-job-id]
1815
| {*instance*}
1816

    
1817
Failover will stop the instance (if running), change its primary node,
1818
and if it was originally running it will start it again (on the new
1819
primary). This works for instances with drbd template (in which case you
1820
can only fail to the secondary node) and for externally mirrored
1821
templates (sharedfile, blockdev, rbd and ext) (in which case you can
1822
fail to any other node).
1823

    
1824
If the instance's disk template is of type sharedfile, blockdev, rbd or
1825
ext, then you can explicitly specify the target node (which can be any
1826
node) using the ``-n`` or ``--target-node`` option, or specify an
1827
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1828
omit both, the default iallocator will be used to specify the target
1829
node.
1830

    
1831
If the instance's disk template is of type drbd, the target node is
1832
automatically selected as the drbd's secondary node. Changing the
1833
secondary node is possible with a replace-disks operation.
1834

    
1835
Normally the failover will check the consistency of the disks before
1836
failing over the instance. If you are trying to migrate instances off
1837
a dead node, this will fail. Use the ``--ignore-consistency`` option
1838
for this purpose. Note that this option can be dangerous as errors in
1839
shutting down the instance will be ignored, resulting in possibly
1840
having the instance running on two machines in parallel (on
1841
disconnected DRBD drives).
1842

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

    
1848
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1849
during this operation are ignored.
1850

    
1851
If the ``--cleanup`` option is passed, the operation changes from
1852
performin a failover to attempting recovery from a failed previous failover.
1853
In this mode, Ganeti checks if the instance runs on the correct node (and
1854
updates its configuration if not) and ensures the instances' disks
1855
are configured correctly.
1856

    
1857
See **ganeti**\(7) for a description of ``--submit`` and other common
1858
options.
1859

    
1860
Example::
1861

    
1862
    # gnt-instance failover instance1.example.com
1863

    
1864
For externally mirrored templates also ``-n`` is available::
1865

    
1866
    # gnt-instance failover -n node3.example.com instance1.example.com
1867

    
1868

    
1869
MIGRATE
1870
^^^^^^^
1871

    
1872
| **migrate** [-f] [\--allow-failover] [\--non-live]
1873
| [\--migration-mode=live\|non-live] [\--ignore-ipolicy]
1874
| [\--no-runtime-changes] [\--submit] [\--print-job-id]
1875
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*] {*instance*}
1876

    
1877
| **migrate** [-f] \--cleanup [\--submit] [\--print-job-id] {*instance*}
1878

    
1879
Migrate will move the instance to its secondary node without shutdown.
1880
As with failover, it works for instances having the drbd disk template
1881
or an externally mirrored disk template type such as sharedfile,
1882
blockdev, rbd or ext.
1883

    
1884
If the instance's disk template is of type sharedfile, blockdev, rbd or
1885
ext, then you can explicitly specify the target node (which can be any
1886
node) using the ``-n`` or ``--target-node`` option, or specify an
1887
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1888
omit both, the default iallocator will be used to specify the target
1889
node.  Alternatively, the default iallocator can be requested by
1890
specifying ``.`` as the name of the plugin.
1891

    
1892
If the instance's disk template is of type drbd, the target node is
1893
automatically selected as the drbd's secondary node. Changing the
1894
secondary node is possible with a replace-disks operation.
1895

    
1896
The migration command needs a perfectly healthy instance for drbd
1897
instances, as we rely on the dual-master capability of drbd8 and the
1898
disks of the instance are not allowed to be degraded.
1899

    
1900
The ``--non-live`` and ``--migration-mode=non-live`` options will
1901
switch (for the hypervisors that support it) between a "fully live"
1902
(i.e. the interruption is as minimal as possible) migration and one in
1903
which the instance is frozen, its state saved and transported to the
1904
remote node, and then resumed there. This all depends on the
1905
hypervisor support for two different methods. In any case, it is not
1906
an error to pass this parameter (it will just be ignored if the
1907
hypervisor doesn't support it). The option ``--migration-mode=live``
1908
option will request a fully-live migration. The default, when neither
1909
option is passed, depends on the hypervisor parameters (and can be
1910
viewed with the **gnt-cluster info** command).
1911

    
1912
If the ``--cleanup`` option is passed, the operation changes from
1913
migration to attempting recovery from a failed previous migration. In
1914
this mode, Ganeti checks if the instance runs on the correct node (and
1915
updates its configuration if not) and ensures the instances' disks
1916
are configured correctly. In this mode, the ``--non-live`` option is
1917
ignored.
1918

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

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

    
1926
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1927
during this operation are ignored.
1928

    
1929
The ``--no-runtime-changes`` option forbids migrate to alter an
1930
instance's runtime before migrating it (eg. ballooning an instance
1931
down because the target node doesn't have enough available memory).
1932

    
1933
If an instance has the backend parameter ``always_failover`` set to
1934
true, then the migration is automatically converted into a failover.
1935

    
1936
See **ganeti**\(7) for a description of ``--submit`` and other common
1937
options.
1938

    
1939
Example (and expected output)::
1940

    
1941
    # gnt-instance migrate instance1
1942
    Instance instance1 will be migrated. Note that migration
1943
    might impact the instance if anything goes wrong (e.g. due to bugs in
1944
    the hypervisor). Continue?
1945
    y/[n]/?: y
1946
    Migrating instance instance1.example.com
1947
    * checking disk consistency between source and target
1948
    * switching node node2.example.com to secondary mode
1949
    * changing into standalone mode
1950
    * changing disks into dual-master mode
1951
    * wait until resync is done
1952
    * preparing node2.example.com to accept the instance
1953
    * migrating instance to node2.example.com
1954
    * switching node node1.example.com to secondary mode
1955
    * wait until resync is done
1956
    * changing into standalone mode
1957
    * changing disks into single-master mode
1958
    * wait until resync is done
1959
    * done
1960
    #
1961

    
1962

    
1963
MOVE
1964
^^^^
1965

    
1966
| **move** [-f] [\--ignore-consistency]
1967
| [-n *node*] [\--compress=*compression-mode*] [\--shutdown-timeout=*N*]
1968
| [\--submit] [\--print-job-id] [\--ignore-ipolicy]
1969
| {*instance*}
1970

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

    
1974
Note that since this operation is done via data copy, it will take a
1975
long time for big disks (similar to replace-disks for a drbd
1976
instance).
1977

    
1978
The ``--compress`` option is used to specify which compression mode
1979
is used during the move. Valid values are 'none' (the default) and
1980
'gzip'.
1981

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

    
1987
The ``--ignore-consistency`` option will make Ganeti ignore any errors
1988
in trying to shutdown the instance on its node; useful if the
1989
hypervisor is broken and you want to recover the data.
1990

    
1991
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1992
during this operation are ignored.
1993

    
1994
See **ganeti**\(7) for a description of ``--submit`` and other common
1995
options.
1996

    
1997
Example::
1998

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

    
2001

    
2002
CHANGE-GROUP
2003
^^^^^^^^^^^^
2004

    
2005
| **change-group** [\--submit] [\--print-job-id]
2006
| [\--iallocator *NAME*] [\--to *GROUP*...] {*instance*}
2007

    
2008
This command moves an instance to another node group. The move is
2009
calculated by an iallocator, either given on the command line or as a
2010
cluster default. Note that the iallocator does only consider disk
2011
information of the default disk template, even if the instances'
2012
disk templates differ from that.
2013

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

    
2017
See **ganeti**\(7) for a description of ``--submit`` and other common
2018
options.
2019

    
2020
Example::
2021

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

    
2024

    
2025
Tags
2026
~~~~
2027

    
2028
ADD-TAGS
2029
^^^^^^^^
2030

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

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

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

    
2042
LIST-TAGS
2043
^^^^^^^^^
2044

    
2045
**list-tags** {*instancename*}
2046

    
2047
List the tags of the given instance.
2048

    
2049
REMOVE-TAGS
2050
^^^^^^^^^^^
2051

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

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

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

    
2063
.. vim: set textwidth=72 :
2064
.. Local Variables:
2065
.. mode: rst
2066
.. fill-column: 72
2067
.. End: