Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.rst @ 6bce7ba2

History | View | Annotate | Download (75.1 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
kvm\_path
808
    Valid for the KVM hypervisor.
809

    
810
    Path to the userspace KVM (or qemu) program.
811

    
812
vnet\_hdr
813
    Valid for the KVM hypervisor.
814

    
815
    This boolean option determines whether the tap devices used by the
816
    KVM paravirtual nics (virtio-net) will get created with VNET_HDR
817
    (IFF_VNET_HDR) support.
818

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

    
823
    It is set to ``true`` by default.
824

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

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

    
832
You can also specify OS parameters that should not be logged but reused
833
at the next reinstall with ``--os-parameters-private`` and OS parameters
834
that should not be logged or saved to configuration with
835
``--os-parameters-secret``. Bear in mind that:
836

    
837
  * Launching the daemons in debug mode will cause debug logging to
838
    happen, which leaks private and secret parameters to the log files.
839
    Do not use the debug mode in production. Deamons will emit a warning
840
    on startup if they are in debug mode.
841
  * You will have to pass again all ``--os-parameters-secret`` parameters
842
    should you want to reinstall this instance.
843

    
844
The ``-I (--iallocator)`` option specifies the instance allocator plugin
845
to use (``.`` means the default allocator). If you pass in this option
846
the allocator will select nodes for this instance automatically, so you
847
don't need to pass them with the ``-n`` option. For more information
848
please refer to the instance allocator documentation.
849

    
850
The ``-t (--disk-template)`` options specifies the disk layout type
851
for the instance. If no disk template is specified, the default disk
852
template is used. The default disk template is the first in the list
853
of enabled disk templates, which can be adjusted cluster-wide with
854
``gnt-cluster modify``. The available choices for disk templates are:
855

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

    
860
file
861
    Disk devices will be regular files.
862

    
863
sharedfile
864
    Disk devices will be regulare files on a shared directory.
865

    
866
plain
867
    Disk devices will be logical volumes.
868

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

    
872
rbd
873
    Disk devices will be rbd volumes residing inside a RADOS cluster.
874

    
875
blockdev
876
    Disk devices will be adopted pre-existent block devices.
877

    
878
ext
879
    Disk devices will be provided by external shared storage,
880
    through the ExtStorage Interface using ExtStorage providers.
881

    
882
The optional second value of the ``-n (--node)`` is used for the drbd
883
template type and specifies the remote node.
884

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

    
888
The ``--file-storage-dir`` specifies the relative path under the
889
cluster-wide file storage directory to store file-based disks. It is
890
useful for having different subdirectories for different
891
instances. The full path of the directory where the disk files are
892
stored will consist of cluster-wide file storage directory + optional
893
subdirectory + instance name. This option is only relevant for
894
instances using the file storage backend.
895

    
896
The ``--file-driver`` specifies the driver to use for file-based
897
disks. Note that currently these drivers work with the xen hypervisor
898
only. This option is only relevant for instances using the file
899
storage backend. The available choices are:
900

    
901
loop
902
    Kernel loopback driver. This driver uses loopback devices to
903
    access the filesystem within the file. However, running I/O
904
    intensive applications in your instance using the loop driver
905
    might result in slowdowns. Furthermore, if you use the loopback
906
    driver consider increasing the maximum amount of loopback devices
907
    (on most systems it's 8) using the max\_loop param.
908

    
909
blktap
910
    The blktap driver (for Xen hypervisors). In order to be able to
911
    use the blktap driver you should check if the 'blktapctrl' user
912
    space disk agent is running (usually automatically started via
913
    xend).  This user-level disk I/O interface has the advantage of
914
    better performance. Especially if you use a network file system
915
    (e.g. NFS) to store your instances this is the recommended choice.
916

    
917
blktap2
918
    Analogous to the blktap driver, but used by newer versions of Xen.
919

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

    
923
The ``-c`` and ``--communication`` specify whether to enable/disable
924
instance communication, which is a communication mechanism between the
925
instance and the host.
926

    
927
See **ganeti**\(7) for a description of ``--submit`` and other common
928
options.
929

    
930
Example::
931

    
932
    # gnt-instance add -t file --disk 0:size=30g -B maxmem=512 -o debian-etch \
933
      -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
934
    # gnt-instance add -t plain --disk 0:size=30g -B maxmem=1024,minmem=512 \
935
      -o debian-etch -n node1.example.com instance1.example.com
936
    # gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
937
      -B maxmem=512 -o debian-etch -n node1.example.com instance1.example.com
938
    # gnt-instance add -t drbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
939
      -n node1.example.com:node2.example.com instance2.example.com
940
    # gnt-instance add -t rbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
941
      -n node1.example.com instance1.example.com
942
    # gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1 -B maxmem=512 \
943
      -o debian-etch -n node1.example.com instance1.example.com
944
    # gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1,param1=val1 \
945
      --disk 1:size=40g,provider=pvdr2,param2=val2,param3=val3 -B maxmem=512 \
946
      -o debian-etch -n node1.example.com instance1.example.com
947

    
948

    
949
BATCH-CREATE
950
^^^^^^^^^^^^
951

    
952
| **batch-create**
953
| [{-I|\--iallocator} *instance allocator*]
954
| {instances\_file.json}
955

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

    
963
The instance file must be a valid-formed JSON file, containing an
964
array of dictionaries with instance creation parameters. All parameters
965
(except ``iallocator``) which are valid for the instance creation
966
OP code are allowed. The most important ones are:
967

    
968
instance\_name
969
    The FQDN of the new instance.
970

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

    
975
disks
976
    Array of disk specifications. Each entry describes one disk as a
977
    dictionary of disk parameters.
978

    
979
beparams
980
    A dictionary of backend parameters.
981

    
982
hypervisor
983
    The hypervisor for the instance.
984

    
985
hvparams
986
    A dictionary with the hypervisor options. If not passed, the default
987
    hypervisor options will be inherited.
988

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

    
995
pnode, snode
996
    The primary and optionally the secondary node to use for the
997
    instance (in case an iallocator script is not used). If those
998
    parameters are given, they have to be given consistently for all
999
    instances in the batch operation.
1000

    
1001
start
1002
    whether to start the instance
1003

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

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

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

    
1016

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

    
1020
    [
1021
      {
1022
        "mode": "create",
1023
        "instance_name": "instance1.example.com",
1024
        "disk_template": "drbd",
1025
        "os_type": "debootstrap",
1026
        "disks": [{"size":"1024"}],
1027
        "nics": [{}],
1028
        "hypervisor": "xen-pvm"
1029
      },
1030
      {
1031
        "mode": "create",
1032
        "instance_name": "instance2.example.com",
1033
        "disk_template": "drbd",
1034
        "os_type": "debootstrap",
1035
        "disks": [{"size":"4096", "mode": "rw", "vg": "xenvg"}],
1036
        "nics": [{}],
1037
        "hypervisor": "xen-hvm",
1038
        "hvparams": {"acpi": true},
1039
        "beparams": {"maxmem": 512, "minmem": 256}
1040
      }
1041
    ]
1042

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

    
1046
    # gnt-instance batch-create instances.json
1047
    Submitted jobs 37, 38
1048

    
1049

    
1050
Note: If the allocator is used for computing suitable nodes for the
1051
instances, it will only take into account disk information for the
1052
default disk template. That means, even if other disk templates are
1053
specified for the instances, storage space information of these disk
1054
templates will not be considered in the allocation computation.
1055

    
1056

    
1057
REMOVE
1058
^^^^^^
1059

    
1060
| **remove** [\--ignore-failures] [\--shutdown-timeout=*N*] [\--submit]
1061
| [\--print-job-id] [\--force] {*instance*}
1062

    
1063
Remove an instance. This will remove all data from the instance and
1064
there is *no way back*. If you are not sure if you use an instance
1065
again, use **shutdown** first and leave it in the shutdown state for a
1066
while.
1067

    
1068
The ``--ignore-failures`` option will cause the removal to proceed
1069
even in the presence of errors during the removal of the instance
1070
(e.g. during the shutdown or the disk removal). If this option is not
1071
given, the command will stop at the first error.
1072

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

    
1078
The ``--force`` option is used to skip the interactive confirmation.
1079

    
1080
See **ganeti**\(7) for a description of ``--submit`` and other common
1081
options.
1082

    
1083
Example::
1084

    
1085
    # gnt-instance remove instance1.example.com
1086

    
1087

    
1088
LIST
1089
^^^^
1090

    
1091
| **list**
1092
| [\--no-headers] [\--separator=*SEPARATOR*] [\--units=*UNITS*] [-v]
1093
| [{-o|\--output} *[+]FIELD,...*] [\--filter] [instance...]
1094

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

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

    
1103
The units used to display the numeric values in the output varies,
1104
depending on the options given. By default, the values will be
1105
formatted in the most appropriate unit. If the ``--separator`` option
1106
is given, then the values are shown in mebibytes to allow parsing by
1107
scripts. In both cases, the ``--units`` option can be used to enforce
1108
a given output unit.
1109

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

    
1113
The ``-o (--output)`` option takes a comma-separated list of output
1114
fields. The available fields and their meaning are:
1115

    
1116
@QUERY_FIELDS_INSTANCE@
1117

    
1118
If the value of the option starts with the character ``+``, the new
1119
field(s) will be added to the default list. This allows one to quickly
1120
see the default list plus a few other fields, instead of retyping the
1121
entire list of fields.
1122

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

    
1132
If exactly one argument is given and it appears to be a query filter
1133
(see **ganeti**\(7)), the query result is filtered accordingly. For
1134
ambiguous cases (e.g. a single field name as a filter) the ``--filter``
1135
(``-F``) option forces the argument to be treated as a filter (e.g.
1136
``gnt-instance list -F admin_state``).
1137

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

    
1141

    
1142
LIST-FIELDS
1143
^^^^^^^^^^^
1144

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

    
1147
Lists available fields for instances.
1148

    
1149

    
1150
INFO
1151
^^^^
1152

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

    
1155
Show detailed information about the given instance(s). This is
1156
different from **list** as it shows detailed data about the instance's
1157
disks (especially useful for the drbd disk template).
1158

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

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

    
1166
The ``--roman`` option can be used to cause envy among people who like
1167
ancient cultures, but are stuck with non-latin-friendly cluster
1168
virtualization technologies.
1169

    
1170
MODIFY
1171
^^^^^^
1172

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

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

    
1203
The ``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``
1204
and ``-O (--os-parameters)`` options specifies hypervisor, backend and
1205
OS parameter options in the form of name=value[,...]. For details
1206
which options can be specified, see the **add** command.
1207

    
1208
The ``-t (--disk-template)`` option will change the disk template of
1209
the instance.  Currently only conversions between the plain and drbd
1210
disk templates are supported, and the instance must be stopped before
1211
attempting the conversion. When changing from the plain to the drbd
1212
disk template, a new secondary node must be specified via the ``-n``
1213
option. The option ``--no-wait-for-sync`` can be used when converting
1214
to the ``drbd`` template in order to make the instance available for
1215
startup before DRBD has finished resyncing.
1216

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

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

    
1237
mode
1238
  The access mode. Either ``ro`` (read-only) or the default ``rw`` (read-write).
1239

    
1240
name
1241
   This option specifies a name for the disk, which can be used as a disk
1242
   identifier. An instance can not have two disks with the same name.
1243

    
1244
The ``--net *N*:add[,options..]`` will add a new network interface to
1245
the instance. The available options are the same as in the **add**
1246
command (``mac``, ``ip``, ``link``, ``mode``, ``network``). The
1247
``--net *ID*,remove`` will remove the intances' NIC with *ID* identifier,
1248
which can be the index of the NIC, the NIC's name or the NIC's UUID.
1249
The ``--net *ID*:modify[,options..]`` option will change the parameters of
1250
the instance network interface with the *ID* identifier.
1251

    
1252
The option ``-o (--os-type)`` will change the OS name for the instance
1253
(without reinstallation). In case an OS variant is specified that is
1254
not found, then by default the modification is refused, unless
1255
``--force-variant`` is passed. An invalid OS will also be refused,
1256
unless the ``--force`` option is given.
1257

    
1258
The option ``--new-primary`` will set the new primary node of an instance
1259
assuming the disks have already been moved manually. Unless the ``--force``
1260
option is given, it is verified that the instance is no longer running
1261
on its current primary node.
1262

    
1263
The ``--online`` and ``--offline`` options are used to transition an
1264
instance into and out of the ``offline`` state. An instance can be
1265
turned offline only if it was previously down. The ``--online`` option
1266
fails if the instance was not in the ``offline`` state, otherwise it
1267
changes instance's state to ``down``. These modifications take effect
1268
immediately.
1269

    
1270
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1271
during this operation are ignored.
1272

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

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

    
1288
See **ganeti**\(7) for a description of ``--submit`` and other common
1289
options.
1290

    
1291
Most of the changes take effect at the next restart. If the instance is
1292
running, there is no effect on the instance.
1293

    
1294
REINSTALL
1295
^^^^^^^^^
1296

    
1297
| **reinstall** [{-o|\--os-type} *os-type*] [\--select-os] [-f *force*]
1298
| [\--force-multiple]
1299
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all]
1300
| [{-O|\--os-parameters} *OS\_PARAMETERS*] [\--submit] [\--print-job-id]
1301
| {*instance*...}
1302

    
1303
Reinstalls the operating system on the given instance(s). The
1304
instance(s) must be stopped when running this command. If the ``-o
1305
(--os-type)`` is specified, the operating system is changed.
1306

    
1307
The ``--select-os`` option switches to an interactive OS reinstall.
1308
The user is prompted to select the OS template from the list of
1309
available OS templates. OS parameters can be overridden using ``-O
1310
(--os-parameters)`` (more documentation for this option under the
1311
**add** command).
1312

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

    
1320
See **ganeti**\(7) for a description of ``--submit`` and other common
1321
options.
1322

    
1323
RENAME
1324
^^^^^^
1325

    
1326
| **rename** [\--no-ip-check] [\--no-name-check] [\--submit] [\--print-job-id]
1327
| {*instance*} {*new\_name*}
1328

    
1329
Renames the given instance. The instance must be stopped when running
1330
this command. The requirements for the new name are the same as for
1331
adding an instance: the new name must be resolvable and the IP it
1332
resolves to must not be reachable (in order to prevent duplicate IPs
1333
the next time the instance is started). The IP test can be skipped if
1334
the ``--no-ip-check`` option is passed.
1335

    
1336
Note that you can rename an instance to its same name, to force
1337
re-executing the os-specific rename script for that instance, if
1338
needed.
1339

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

    
1346
See **ganeti**\(7) for a description of ``--submit`` and other common
1347
options.
1348

    
1349
Starting/stopping/connecting to console
1350
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1351

    
1352
STARTUP
1353
^^^^^^^
1354

    
1355
| **startup**
1356
| [\--force] [\--ignore-offline]
1357
| [\--force-multiple] [\--no-remember]
1358
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1359
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1360
| [{-H|\--hypervisor-parameters} ``key=value...``]
1361
| [{-B|\--backend-parameters} ``key=value...``]
1362
| [\--submit] [\--print-job-id] [\--paused]
1363
| {*name*...}
1364

    
1365
Starts one or more instances, depending on the following options.  The
1366
four available modes are:
1367

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

    
1372
\--node
1373
    will start the instances who have the given node as either primary
1374
    or secondary
1375

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

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

    
1384
\--all
1385
    will start all instances in the cluster (no arguments accepted)
1386

    
1387
\--tags
1388
    will start all instances in the cluster with the tags given as
1389
    arguments
1390

    
1391
\--node-tags
1392
    will start all instances in the cluster on nodes with the tags
1393
    given as arguments
1394

    
1395
\--pri-node-tags
1396
    will start all instances in the cluster on primary nodes with the
1397
    tags given as arguments
1398

    
1399
\--sec-node-tags
1400
    will start all instances in the cluster on secondary nodes with the
1401
    tags given as arguments
1402

    
1403
Note that although you can pass more than one selection option, the
1404
last one wins, so in order to guarantee the desired result, don't pass
1405
more than one such option.
1406

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

    
1411
The ``--force-multiple`` will skip the interactive confirmation in the
1412
case the more than one instance will be affected.
1413

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

    
1420
The ``-H (--hypervisor-parameters)`` and ``-B (--backend-parameters)``
1421
options specify temporary hypervisor and backend parameters that can
1422
be used to start an instance with modified parameters. They can be
1423
useful for quick testing without having to modify an instance back and
1424
forth, e.g.::
1425

    
1426
    # gnt-instance start -H kernel_args="single" instance1
1427
    # gnt-instance start -B maxmem=2048 instance2
1428

    
1429

    
1430
The first form will start the instance instance1 in single-user mode,
1431
and the instance instance2 with 2GB of RAM (this time only, unless
1432
that is the actual instance memory size already). Note that the values
1433
override the instance parameters (and not extend them): an instance
1434
with "kernel\_args=ro" when started with -H kernel\_args=single will
1435
result in "single", not "ro single".
1436

    
1437
The ``--paused`` option is only valid for Xen and kvm hypervisors.  This
1438
pauses the instance at the start of bootup, awaiting ``gnt-instance
1439
console`` to unpause it, allowing the entire boot process to be
1440
monitored for debugging.
1441

    
1442
See **ganeti**\(7) for a description of ``--submit`` and other common
1443
options.
1444

    
1445
Example::
1446

    
1447
    # gnt-instance start instance1.example.com
1448
    # gnt-instance start --node node1.example.com node2.example.com
1449
    # gnt-instance start --all
1450

    
1451

    
1452
SHUTDOWN
1453
^^^^^^^^
1454

    
1455
| **shutdown**
1456
| [\--timeout=*N*]
1457
| [\--force] [\--force-multiple] [\--ignore-offline] [\--no-remember]
1458
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1459
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1460
| [\--submit] [\--print-job-id]
1461
| {*name*...}
1462

    
1463
Stops one or more instances. If the instance cannot be cleanly stopped
1464
during a hardcoded interval (currently 2 minutes), it will forcibly
1465
stop the instance (equivalent to switching off the power on a physical
1466
machine).
1467

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

    
1473
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1474
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1475
``--sec-node-tags`` options are similar as for the **startup** command
1476
and they influence the actual instances being shutdown.
1477

    
1478
``--ignore-offline`` can be used to ignore offline primary nodes and
1479
force the instance to be marked as stopped. This option should be used
1480
with care as it can lead to an inconsistent cluster state.
1481

    
1482
Use ``--force`` to be able to shutdown an instance even when it's marked
1483
as offline. This is useful is an offline instance ends up in the
1484
``ERROR_up`` state, for example.
1485

    
1486
The ``--no-remember`` option will perform the shutdown but not change
1487
the state of the instance in the configuration file (if it was running
1488
before, Ganeti will still thinks it needs to be running). This can be
1489
useful for a cluster-wide shutdown, where some instances are marked as
1490
up and some as down, and you don't want to change the running state:
1491
you just need to disable the watcher, shutdown all instances with
1492
``--no-remember``, and when the watcher is activated again it will
1493
restore the correct runtime state for all instances.
1494

    
1495
See **ganeti**\(7) for a description of ``--submit`` and other common
1496
options.
1497

    
1498
Example::
1499

    
1500
    # gnt-instance shutdown instance1.example.com
1501
    # gnt-instance shutdown --all
1502

    
1503

    
1504
REBOOT
1505
^^^^^^
1506

    
1507
| **reboot**
1508
| [{-t|\--type} *REBOOT-TYPE*]
1509
| [\--ignore-secondaries]
1510
| [\--shutdown-timeout=*N*]
1511
| [\--force-multiple]
1512
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1513
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1514
| [\--submit] [\--print-job-id]
1515
| [*name*...]
1516

    
1517
Reboots one or more instances. The type of reboot depends on the value
1518
of ``-t (--type)``. A soft reboot does a hypervisor reboot, a hard reboot
1519
does a instance stop, recreates the hypervisor config for the instance
1520
and starts the instance. A full reboot does the equivalent of
1521
**gnt-instance shutdown && gnt-instance startup**.  The default is
1522
hard reboot.
1523

    
1524
For the hard reboot the option ``--ignore-secondaries`` ignores errors
1525
for the secondary node while re-assembling the instance disks.
1526

    
1527
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1528
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1529
``--sec-node-tags`` options are similar as for the **startup** command
1530
and they influence the actual instances being rebooted.
1531

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

    
1537
The ``--force-multiple`` will skip the interactive confirmation in the
1538
case the more than one instance will be affected.
1539

    
1540
See **ganeti**\(7) for a description of ``--submit`` and other common
1541
options.
1542

    
1543
Example::
1544

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

    
1548

    
1549
CONSOLE
1550
^^^^^^^
1551

    
1552
**console** [\--show-cmd] {*instance*}
1553

    
1554
Connects to the console of the given instance. If the instance is not
1555
up, an error is returned. Use the ``--show-cmd`` option to display the
1556
command instead of executing it.
1557

    
1558
For HVM instances, this will attempt to connect to the serial console
1559
of the instance. To connect to the virtualized "physical" console of a
1560
HVM instance, use a VNC client with the connection info from the
1561
**info** command.
1562

    
1563
For Xen/kvm instances, if the instance is paused, this attempts to
1564
unpause the instance after waiting a few seconds for the connection to
1565
the console to be made.
1566

    
1567
Example::
1568

    
1569
    # gnt-instance console instance1.example.com
1570

    
1571

    
1572
Disk management
1573
~~~~~~~~~~~~~~~
1574

    
1575
REPLACE-DISKS
1576
^^^^^^^^^^^^^
1577

    
1578
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1579
| [\--ignore-ipolicy] {-p} [\--disks *idx*] {*instance*}
1580

    
1581
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1582
| [\--ignore-ipolicy] {-s} [\--disks *idx*] {*instance*}
1583

    
1584
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1585
| [\--ignore-ipolicy]
1586
| {{-I\|\--iallocator} *name* \| {{-n|\--new-secondary} *node* } {*instance*}
1587

    
1588
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1589
| [\--ignore-ipolicy] {-a\|\--auto} {*instance*}
1590

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

    
1594
The first form (when passing the ``-p`` option) will replace the disks
1595
on the primary, while the second form (when passing the ``-s`` option
1596
will replace the disks on the secondary node. For these two cases (as
1597
the node doesn't change), it is possible to only run the replace for a
1598
subset of the disks, using the option ``--disks`` which takes a list
1599
of comma-delimited disk indices (zero-based), e.g. 0,2 to replace only
1600
the first and third disks.
1601

    
1602
The third form (when passing either the ``--iallocator`` or the
1603
``--new-secondary`` option) is designed to change secondary node of the
1604
instance. Specifying ``--iallocator`` makes the new secondary be
1605
selected automatically by the specified allocator plugin (use ``.`` to
1606
indicate the default allocator), otherwise the new secondary node will
1607
be the one chosen manually via the ``--new-secondary`` option.
1608

    
1609
Note that it is not possible to select an offline or drained node as a
1610
new secondary.
1611

    
1612
The fourth form (when using ``--auto``) will automatically determine
1613
which disks of an instance are faulty and replace them within the same
1614
node. The ``--auto`` option works only when an instance has only
1615
faulty disks on either the primary or secondary node; it doesn't work
1616
when both sides have faulty disks.
1617

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

    
1627
The ``--ignore-ipolicy`` let the command ignore instance policy
1628
violations if replace-disks changes groups and the instance would
1629
violate the new groups instance policy.
1630

    
1631
See **ganeti**\(7) for a description of ``--submit`` and other common
1632
options.
1633

    
1634
ACTIVATE-DISKS
1635
^^^^^^^^^^^^^^
1636

    
1637
| **activate-disks** [\--submit] [\--print-job-id] [\--ignore-size]
1638
| [\--wait-for-sync] {*instance*}
1639

    
1640
Activates the block devices of the given instance. If successful, the
1641
command will show the location and name of the block devices::
1642

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

    
1646

    
1647
In this example, *node1.example.com* is the name of the node on which
1648
the devices have been activated. The *disk/0* and *disk/1* are the
1649
Ganeti-names of the instance disks; how they are visible inside the
1650
instance is hypervisor-specific. */dev/drbd0* and */dev/drbd1* are the
1651
actual block devices as visible on the node.
1652

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

    
1660
The ``--wait-for-sync`` option will ensure that the command returns only
1661
after the instance's disks are synchronised (mostly for DRBD); this can
1662
be useful to ensure consistency, as otherwise there are no commands that
1663
can wait until synchronisation is done. However when passing this
1664
option, the command will have additional output, making it harder to
1665
parse the disk information.
1666

    
1667
Note that it is safe to run this command while the instance is already
1668
running.
1669

    
1670
See **ganeti**\(7) for a description of ``--submit`` and other common
1671
options.
1672

    
1673
DEACTIVATE-DISKS
1674
^^^^^^^^^^^^^^^^
1675

    
1676
**deactivate-disks** [-f] [\--submit] [\--print-job-id] {*instance*}
1677

    
1678
De-activates the block devices of the given instance. Note that if you
1679
run this command for an instance with a drbd disk template, while it
1680
is running, it will not be able to shutdown the block devices on the
1681
primary node, but it will shutdown the block devices on the secondary
1682
nodes, thus breaking the replication.
1683

    
1684
The ``-f``/``--force`` option will skip checks that the instance is
1685
down; in case the hypervisor is confused and we can't talk to it,
1686
normally Ganeti will refuse to deactivate the disks, but with this
1687
option passed it will skip this check and directly try to deactivate
1688
the disks. This can still fail due to the instance actually running or
1689
other issues.
1690

    
1691
See **ganeti**\(7) for a description of ``--submit`` and other common
1692
options.
1693

    
1694
GROW-DISK
1695
^^^^^^^^^
1696

    
1697
| **grow-disk** [\--no-wait-for-sync] [\--submit] [\--print-job-id]
1698
| [\--absolute]
1699
| {*instance*} {*disk*} {*amount*}
1700

    
1701
Grows an instance's disk. This is only possible for instances having a
1702
plain, drbd, file, sharedfile, rbd or ext disk template. For the ext
1703
template to work, the ExtStorage provider should also support growing.
1704
This means having a ``grow`` script that actually grows the volume of
1705
the external shared storage.
1706

    
1707
Note that this command only change the block device size; it will not
1708
grow the actual filesystems, partitions, etc. that live on that
1709
disk. Usually, you will need to:
1710

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

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

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

    
1719
The *disk* argument is the index of the instance disk to grow. The
1720
*amount* argument is given as a number which can have a suffix (like the
1721
disk size in instance create); if the suffix is missing, the value will
1722
be interpreted as mebibytes.
1723

    
1724
By default, the *amount* value represents the desired increase in the
1725
disk size (e.g. an amount of 1G will take a disk of size 3G to 4G). If
1726
the optional ``--absolute`` parameter is passed, then the *amount*
1727
argument doesn't represent the delta, but instead the desired final disk
1728
size (e.g. an amount of 8G will take a disk of size 4G to 8G).
1729

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

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

    
1738
See **ganeti**\(7) for a description of ``--submit`` and other common
1739
options.
1740

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

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

    
1745
Example for increasing the disk size to a certain size::
1746

    
1747
   # gnt-instance grow-disk --absolute instance1.example.com 0 32g
1748

    
1749
Also note that disk shrinking is not supported; use **gnt-backup
1750
export** and then **gnt-backup import** to reduce the disk size of an
1751
instance.
1752

    
1753
RECREATE-DISKS
1754
^^^^^^^^^^^^^^
1755

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

    
1760
Recreates all or a subset of disks of the given instance.
1761

    
1762
Note that this functionality should only be used for missing disks; if
1763
any of the given disks already exists, the operation will fail.  While
1764
this is suboptimal, recreate-disks should hopefully not be needed in
1765
normal operation and as such the impact of this is low.
1766

    
1767
If only a subset should be recreated, any number of ``disk`` options can
1768
be specified. It expects a disk index and an optional list of disk
1769
parameters to change. Only ``size``, ``spindles``, and ``mode`` can be
1770
changed while recreating disks. To recreate all disks while changing
1771
parameters on a subset only, a ``--disk`` option must be given for every
1772
disk of the instance.
1773

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

    
1783
Another method of choosing which nodes to place the instance on is by
1784
using the specified iallocator, passing the ``--iallocator`` option.
1785
The primary and secondary nodes will be chosen by the specified
1786
iallocator plugin, or by the default allocator if ``.`` is specified.
1787

    
1788
See **ganeti**\(7) for a description of ``--submit`` and other common
1789
options.
1790

    
1791
Recovery/moving
1792
~~~~~~~~~~~~~~~
1793

    
1794
FAILOVER
1795
^^^^^^^^
1796

    
1797
| **failover** [-f] [\--ignore-consistency] [\--ignore-ipolicy]
1798
| [\--shutdown-timeout=*N*]
1799
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*]
1800
| [\--cleanup]
1801
| [\--submit] [\--print-job-id]
1802
| {*instance*}
1803

    
1804
Failover will stop the instance (if running), change its primary node,
1805
and if it was originally running it will start it again (on the new
1806
primary). This works for instances with drbd template (in which case you
1807
can only fail to the secondary node) and for externally mirrored
1808
templates (sharedfile, blockdev, rbd and ext) (in which case you can
1809
fail to any other node).
1810

    
1811
If the instance's disk template is of type sharedfile, blockdev, rbd or
1812
ext, then you can explicitly specify the target node (which can be any
1813
node) using the ``-n`` or ``--target-node`` option, or specify an
1814
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1815
omit both, the default iallocator will be used to specify the target
1816
node.
1817

    
1818
If the instance's disk template is of type drbd, the target node is
1819
automatically selected as the drbd's secondary node. Changing the
1820
secondary node is possible with a replace-disks operation.
1821

    
1822
Normally the failover will check the consistency of the disks before
1823
failing over the instance. If you are trying to migrate instances off
1824
a dead node, this will fail. Use the ``--ignore-consistency`` option
1825
for this purpose. Note that this option can be dangerous as errors in
1826
shutting down the instance will be ignored, resulting in possibly
1827
having the instance running on two machines in parallel (on
1828
disconnected DRBD drives).
1829

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

    
1835
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1836
during this operation are ignored.
1837

    
1838
If the ``--cleanup`` option is passed, the operation changes from
1839
performin a failover to attempting recovery from a failed previous failover.
1840
In this mode, Ganeti checks if the instance runs on the correct node (and
1841
updates its configuration if not) and ensures the instances' disks
1842
are configured correctly.
1843

    
1844
See **ganeti**\(7) for a description of ``--submit`` and other common
1845
options.
1846

    
1847
Example::
1848

    
1849
    # gnt-instance failover instance1.example.com
1850

    
1851
For externally mirrored templates also ``-n`` is available::
1852

    
1853
    # gnt-instance failover -n node3.example.com instance1.example.com
1854

    
1855

    
1856
MIGRATE
1857
^^^^^^^
1858

    
1859
| **migrate** [-f] [\--allow-failover] [\--non-live]
1860
| [\--migration-mode=live\|non-live] [\--ignore-ipolicy]
1861
| [\--no-runtime-changes] [\--submit] [\--print-job-id]
1862
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*] {*instance*}
1863

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

    
1866
Migrate will move the instance to its secondary node without shutdown.
1867
As with failover, it works for instances having the drbd disk template
1868
or an externally mirrored disk template type such as sharedfile,
1869
blockdev, rbd or ext.
1870

    
1871
If the instance's disk template is of type sharedfile, blockdev, rbd or
1872
ext, then you can explicitly specify the target node (which can be any
1873
node) using the ``-n`` or ``--target-node`` option, or specify an
1874
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1875
omit both, the default iallocator will be used to specify the target
1876
node.  Alternatively, the default iallocator can be requested by
1877
specifying ``.`` as the name of the plugin.
1878

    
1879
If the instance's disk template is of type drbd, the target node is
1880
automatically selected as the drbd's secondary node. Changing the
1881
secondary node is possible with a replace-disks operation.
1882

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

    
1887
The ``--non-live`` and ``--migration-mode=non-live`` options will
1888
switch (for the hypervisors that support it) between a "fully live"
1889
(i.e. the interruption is as minimal as possible) migration and one in
1890
which the instance is frozen, its state saved and transported to the
1891
remote node, and then resumed there. This all depends on the
1892
hypervisor support for two different methods. In any case, it is not
1893
an error to pass this parameter (it will just be ignored if the
1894
hypervisor doesn't support it). The option ``--migration-mode=live``
1895
option will request a fully-live migration. The default, when neither
1896
option is passed, depends on the hypervisor parameters (and can be
1897
viewed with the **gnt-cluster info** command).
1898

    
1899
If the ``--cleanup`` option is passed, the operation changes from
1900
migration to attempting recovery from a failed previous migration. In
1901
this mode, Ganeti checks if the instance runs on the correct node (and
1902
updates its configuration if not) and ensures the instances' disks
1903
are configured correctly. In this mode, the ``--non-live`` option is
1904
ignored.
1905

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

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

    
1913
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1914
during this operation are ignored.
1915

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

    
1920
If an instance has the backend parameter ``always_failover`` set to
1921
true, then the migration is automatically converted into a failover.
1922

    
1923
See **ganeti**\(7) for a description of ``--submit`` and other common
1924
options.
1925

    
1926
Example (and expected output)::
1927

    
1928
    # gnt-instance migrate instance1
1929
    Instance instance1 will be migrated. Note that migration
1930
    might impact the instance if anything goes wrong (e.g. due to bugs in
1931
    the hypervisor). Continue?
1932
    y/[n]/?: y
1933
    Migrating instance instance1.example.com
1934
    * checking disk consistency between source and target
1935
    * switching node node2.example.com to secondary mode
1936
    * changing into standalone mode
1937
    * changing disks into dual-master mode
1938
    * wait until resync is done
1939
    * preparing node2.example.com to accept the instance
1940
    * migrating instance to node2.example.com
1941
    * switching node node1.example.com to secondary mode
1942
    * wait until resync is done
1943
    * changing into standalone mode
1944
    * changing disks into single-master mode
1945
    * wait until resync is done
1946
    * done
1947
    #
1948

    
1949

    
1950
MOVE
1951
^^^^
1952

    
1953
| **move** [-f] [\--ignore-consistency]
1954
| [-n *node*] [\--compress=*compression-mode*] [\--shutdown-timeout=*N*]
1955
| [\--submit] [\--print-job-id] [\--ignore-ipolicy]
1956
| {*instance*}
1957

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

    
1961
Note that since this operation is done via data copy, it will take a
1962
long time for big disks (similar to replace-disks for a drbd
1963
instance).
1964

    
1965
The ``--compress`` option is used to specify which compression mode
1966
is used during the move. Valid values are 'none' (the default) and
1967
'gzip'.
1968

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

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

    
1978
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1979
during this operation are ignored.
1980

    
1981
See **ganeti**\(7) for a description of ``--submit`` and other common
1982
options.
1983

    
1984
Example::
1985

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

    
1988

    
1989
CHANGE-GROUP
1990
^^^^^^^^^^^^
1991

    
1992
| **change-group** [\--submit] [\--print-job-id]
1993
| [\--iallocator *NAME*] [\--to *GROUP*...] {*instance*}
1994

    
1995
This command moves an instance to another node group. The move is
1996
calculated by an iallocator, either given on the command line or as a
1997
cluster default. Note that the iallocator does only consider disk
1998
information of the default disk template, even if the instances'
1999
disk templates differ from that.
2000

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

    
2004
See **ganeti**\(7) for a description of ``--submit`` and other common
2005
options.
2006

    
2007
Example::
2008

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

    
2011

    
2012
Tags
2013
~~~~
2014

    
2015
ADD-TAGS
2016
^^^^^^^^
2017

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

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

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

    
2029
LIST-TAGS
2030
^^^^^^^^^
2031

    
2032
**list-tags** {*instancename*}
2033

    
2034
List the tags of the given instance.
2035

    
2036
REMOVE-TAGS
2037
^^^^^^^^^^^
2038

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

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

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

    
2050
.. vim: set textwidth=72 :
2051
.. Local Variables:
2052
.. mode: rst
2053
.. fill-column: 72
2054
.. End: