Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.rst @ d069fec8

History | View | Annotate | Download (74 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
| [\--file-storage-dir *dir\_path*] [\--file-driver {loop \| blktap \| blktap2}]
41
| {{-n|\--node} *node[:secondary-node]* \| {-I|\--iallocator} *name*}
42
| {{-o|\--os-type} *os-type*}
43
| [\--submit] [\--print-job-id]
44
| [\--ignore-ipolicy]
45
| [\--no-wait-for-sync]
46
| {*instance*}
47

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

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

    
61
spindles
62
  How many spindles (physical disks on the node) the disk should span.
63

    
64
mode
65
  The access mode. Either ``ro`` (read-only) or the default ``rw``
66
  (read-write).
67

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

    
72
vg
73
   The LVM volume group. This works only for LVM and DRBD devices.
74

    
75
metavg
76
   This options specifies a different VG for the metadata device. This
77
   works only for DRBD devices. If not specified, the default metavg
78
   of the node-group (possibly inherited from the cluster-wide settings)
79
   will be used.
80

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
226
The possible hypervisor options are as follows:
227

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

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

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

    
237
    a
238
        floppy drive
239

    
240
    c
241
        hard disk
242

    
243
    d
244
        CDROM drive
245

    
246
    n
247
        network boot (PXE)
248

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
310
    - ioemu
311
    - vif
312

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

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

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

    
327

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

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

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

    
342

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
425
    - auto
426
    - never
427
    - always
428

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

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

    
435
    - auto
436
    - never
437
    - always
438

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

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

    
444
    - off
445
    - all
446
    - filter
447

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
489
pae
490
    Valid for the Xen HVM and KVM hypervisors.
491

    
492
    A boolean option that specifies if the hypervisor should enable
493
    PAE support for this instance. The default is false, disabling PAE
494
    support.
495

    
496
viridian
497
    Valid for the Xen HVM hypervisor.
498

    
499
    A boolean option that specifies if the hypervisor should enable
500
    viridian (Hyper-V) for this instance. The default is false,
501
    disabling viridian support.
502

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

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

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

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

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

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

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

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

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

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

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

    
550
    Please note, that if this setting is an empty string and the
551
    hypervisor is Xen it will not be written to the Xen configuration
552
    file
553

    
554
serial\_console
555
    Valid for the KVM hypervisor.
556

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

    
564
serial\_speed
565
    Valid for the KVM hypervisor.
566

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

    
572
disk\_cache
573
    Valid for the KVM hypervisor.
574

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

    
585
security\_model
586
    Valid for the KVM hypervisor.
587

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

    
592
    Under *user* kvm will drop privileges and become the user
593
    specified by the security\_domain parameter.
594

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

    
599
security\_domain
600
    Valid for the KVM hypervisor.
601

    
602
    Under security model *user* the username to run the instance
603
    under.  It must be a valid username existing on the host.
604

    
605
    Cannot be set under security model *none* or *pool*.
606

    
607
kvm\_flag
608
    Valid for the KVM hypervisor.
609

    
610
    If *enabled* the -enable-kvm flag is passed to kvm. If *disabled*
611
    -disable-kvm is passed. If unset no flag is passed, and the
612
    default running mode for your kvm binary will be used.
613

    
614
mem\_path
615
    Valid for the KVM hypervisor.
616

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

    
621
use\_chroot
622
    Valid for the KVM hypervisor.
623

    
624
    This boolean option determines whether to run the KVM instance in a
625
    chroot directory.
626

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

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

    
633
migration\_downtime
634
    Valid for the KVM hypervisor.
635

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

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

    
644
cpu\_mask
645
    Valid for the Xen, KVM and LXC hypervisors.
646

    
647
    The processes belonging to the given instance are only scheduled
648
    on the specified CPUs.
649

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

    
654
    Second, a comma-separated list of CPU IDs or CPU ID ranges. The
655
    ranges are defined by a lower and higher boundary, separated by a
656
    dash, and the boundaries are inclusive. In this form, all VCPUs of
657
    the instance will be mapped on the selected list of CPUs. Example:
658
    ``0-2,5``, mapping all VCPUs (no matter how many) onto physical CPUs
659
    0, 1, 2 and 5.
660

    
661
    The last form is used for explicit control of VCPU-CPU pinnings. In
662
    this form, the list of VCPU mappings is given as a colon (:)
663
    separated list, whose elements are the possible values for the
664
    second or first form above. In this form, the number of elements in
665
    the colon-separated list _must_ equal the number of VCPUs of the
666
    instance.
667

    
668
    Example:
669

    
670
    .. code-block:: bash
671

    
672
      # Map the entire instance to CPUs 0-2
673
      gnt-instance modify -H cpu_mask=0-2 my-inst
674

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

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

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

    
685
      # Pin entire VM to CPU 0
686
      gnt-instance modify -H cpu_mask=0 my-inst
687

    
688
      # Turn off CPU pinning (default setting)
689
      gnt-instance modify -H cpu_mask=all my-inst
690

    
691
cpu\_cap
692
    Valid for the Xen hypervisor.
693

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

    
697
cpu\_weight
698
    Valid for the Xen hypervisor.
699

    
700
    Set the cpu time ratio to be allocated to the VM. Valid values are
701
    between 1 and 65535. Default weight is 256.
702

    
703
usb\_mouse
704
    Valid for the KVM hypervisor.
705

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

    
710
keymap
711
    Valid for the KVM hypervisor.
712

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

    
716
reboot\_behavior
717
    Valid for Xen PVM, Xen HVM and KVM hypervisors.
718

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

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

    
725
cpu\_cores
726
    Valid for the KVM hypervisor.
727

    
728
    Number of emulated CPU cores.
729

    
730
cpu\_threads
731
    Valid for the KVM hypervisor.
732

    
733
    Number of emulated CPU threads.
734

    
735
cpu\_sockets
736
    Valid for the KVM hypervisor.
737

    
738
    Number of emulated CPU sockets.
739

    
740
soundhw
741
    Valid for the KVM and XEN hypervisors.
742

    
743
    Comma separated list of emulated sounds cards, or "all" to enable
744
    all the available ones.
745

    
746
cpuid
747
    Valid for the XEN hypervisor.
748

    
749
    Modify the values returned by CPUID_ instructions run within instances.
750

    
751
    This allows you to enable migration between nodes with different CPU
752
    attributes like cores, threads, hyperthreading or SS4 support by hiding
753
    the extra features where needed.
754

    
755
    See the XEN documentation for syntax and more information.
756

    
757
.. _CPUID: http://en.wikipedia.org/wiki/CPUID
758

    
759
usb\_devices
760
    Valid for the KVM hypervisor.
761

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

    
770
vga
771
    Valid for the KVM hypervisor.
772

    
773
    Emulated vga mode, passed the the kvm -vga option.
774

    
775
kvm\_extra
776
    Valid for the KVM hypervisor.
777

    
778
    Any other option to the KVM hypervisor, useful tweaking anything
779
    that Ganeti doesn't support. Note that values set with this
780
    parameter are split on a space character and currently don't support
781
    quoting.
782

    
783
machine\_version
784
    Valid for the KVM hypervisor.
785

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

    
790
migration\_caps
791
    Valid for the KVM hypervisor.
792

    
793
    Enable specific migration capabilities by providing a ":" separated
794
    list of supported capabilites. QEMU version 1.7.0 defines
795
    x-rdma-pin-all, auto-converge, zero-blocks, and xbzrle. Please note
796
    that while a combination of xbzrle and auto-converge might speed up
797
    the migration process significantly, the first may cause BSOD on
798
    Windows8r2 instances running on drbd.
799

    
800
kvm\_path
801
    Valid for the KVM hypervisor.
802

    
803
    Path to the userspace KVM (or qemu) program.
804

    
805
vnet\_hdr
806
    Valid for the KVM hypervisor.
807

    
808
    This boolean option determines whether the tap devices used by the
809
    KVM paravirtual nics (virtio-net) will get created with VNET_HDR
810
    (IFF_VNET_HDR) support.
811

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

    
816
    It is set to ``true`` by default.
817

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

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

    
825
The ``-I (--iallocator)`` option specifies the instance allocator plugin
826
to use (``.`` means the default allocator). If you pass in this option
827
the allocator will select nodes for this instance automatically, so you
828
don't need to pass them with the ``-n`` option. For more information
829
please refer to the instance allocator documentation.
830

    
831
The ``-t (--disk-template)`` options specifies the disk layout type
832
for the instance. If no disk template is specified, the default disk
833
template is used. The default disk template is the first in the list
834
of enabled disk templates, which can be adjusted cluster-wide with
835
``gnt-cluster modify``. The available choices for disk templates are:
836

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

    
841
file
842
    Disk devices will be regular files.
843

    
844
sharedfile
845
    Disk devices will be regulare files on a shared directory.
846

    
847
plain
848
    Disk devices will be logical volumes.
849

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

    
853
rbd
854
    Disk devices will be rbd volumes residing inside a RADOS cluster.
855

    
856
blockdev
857
    Disk devices will be adopted pre-existent block devices.
858

    
859
ext
860
    Disk devices will be provided by external shared storage,
861
    through the ExtStorage Interface using ExtStorage providers.
862

    
863
The optional second value of the ``-n (--node)`` is used for the drbd
864
template type and specifies the remote node.
865

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

    
869
The ``--file-storage-dir`` specifies the relative path under the
870
cluster-wide file storage directory to store file-based disks. It is
871
useful for having different subdirectories for different
872
instances. The full path of the directory where the disk files are
873
stored will consist of cluster-wide file storage directory + optional
874
subdirectory + instance name. This option is only relevant for
875
instances using the file storage backend.
876

    
877
The ``--file-driver`` specifies the driver to use for file-based
878
disks. Note that currently these drivers work with the xen hypervisor
879
only. This option is only relevant for instances using the file
880
storage backend. The available choices are:
881

    
882
loop
883
    Kernel loopback driver. This driver uses loopback devices to
884
    access the filesystem within the file. However, running I/O
885
    intensive applications in your instance using the loop driver
886
    might result in slowdowns. Furthermore, if you use the loopback
887
    driver consider increasing the maximum amount of loopback devices
888
    (on most systems it's 8) using the max\_loop param.
889

    
890
blktap
891
    The blktap driver (for Xen hypervisors). In order to be able to
892
    use the blktap driver you should check if the 'blktapctrl' user
893
    space disk agent is running (usually automatically started via
894
    xend).  This user-level disk I/O interface has the advantage of
895
    better performance. Especially if you use a network file system
896
    (e.g. NFS) to store your instances this is the recommended choice.
897

    
898
blktap2
899
    Analogous to the blktap driver, but used by newer versions of Xen.
900

    
901
If ``--ignore-ipolicy`` is given any instance policy violations occuring
902
during this operation are ignored.
903

    
904
See **ganeti**\(7) for a description of ``--submit`` and other common
905
options.
906

    
907
Example::
908

    
909
    # gnt-instance add -t file --disk 0:size=30g -B maxmem=512 -o debian-etch \
910
      -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
911
    # gnt-instance add -t plain --disk 0:size=30g -B maxmem=1024,minmem=512 \
912
      -o debian-etch -n node1.example.com instance1.example.com
913
    # gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
914
      -B maxmem=512 -o debian-etch -n node1.example.com instance1.example.com
915
    # gnt-instance add -t drbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
916
      -n node1.example.com:node2.example.com instance2.example.com
917
    # gnt-instance add -t rbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
918
      -n node1.example.com instance1.example.com
919
    # gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1 -B maxmem=512 \
920
      -o debian-etch -n node1.example.com instance1.example.com
921
    # gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1,param1=val1 \
922
      --disk 1:size=40g,provider=pvdr2,param2=val2,param3=val3 -B maxmem=512 \
923
      -o debian-etch -n node1.example.com instance1.example.com
924

    
925

    
926
BATCH-CREATE
927
^^^^^^^^^^^^
928

    
929
| **batch-create**
930
| [{-I|\--iallocator} *instance allocator*]
931
| {instances\_file.json}
932

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

    
940
The instance file must be a valid-formed JSON file, containing an
941
array of dictionaries with instance creation parameters. All parameters
942
(except ``iallocator``) which are valid for the instance creation
943
OP code are allowed. The most important ones are:
944

    
945
instance\_name
946
    The FQDN of the new instance.
947

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

    
952
disks
953
    Array of disk specifications. Each entry describes one disk as a
954
    dictionary of disk parameters.
955

    
956
beparams
957
    A dictionary of backend parameters.
958

    
959
hypervisor
960
    The hypervisor for the instance.
961

    
962
hvparams
963
    A dictionary with the hypervisor options. If not passed, the default
964
    hypervisor options will be inherited.
965

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

    
972
pnode, snode
973
    The primary and optionally the secondary node to use for the
974
    instance (in case an iallocator script is not used). If those
975
    parameters are given, they have to be given consistently for all
976
    instances in the batch operation.
977

    
978
start
979
    whether to start the instance
980

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

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

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

    
993

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

    
997
    [
998
      {
999
        "mode": "create",
1000
        "instance_name": "instance1.example.com",
1001
        "disk_template": "drbd",
1002
        "os_type": "debootstrap",
1003
        "disks": [{"size":"1024"}],
1004
        "nics": [{}],
1005
        "hypervisor": "xen-pvm"
1006
      },
1007
      {
1008
        "mode": "create",
1009
        "instance_name": "instance2.example.com",
1010
        "disk_template": "drbd",
1011
        "os_type": "debootstrap",
1012
        "disks": [{"size":"4096", "mode": "rw", "vg": "xenvg"}],
1013
        "nics": [{}],
1014
        "hypervisor": "xen-hvm",
1015
        "hvparams": {"acpi": true},
1016
        "beparams": {"maxmem": 512, "minmem": 256}
1017
      }
1018
    ]
1019

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

    
1023
    # gnt-instance batch-create instances.json
1024
    Submitted jobs 37, 38
1025

    
1026

    
1027
Note: If the allocator is used for computing suitable nodes for the
1028
instances, it will only take into account disk information for the
1029
default disk template. That means, even if other disk templates are
1030
specified for the instances, storage space information of these disk
1031
templates will not be considered in the allocation computation.
1032

    
1033

    
1034
REMOVE
1035
^^^^^^
1036

    
1037
| **remove** [\--ignore-failures] [\--shutdown-timeout=*N*] [\--submit]
1038
| [\--print-job-id] [\--force] {*instance*}
1039

    
1040
Remove an instance. This will remove all data from the instance and
1041
there is *no way back*. If you are not sure if you use an instance
1042
again, use **shutdown** first and leave it in the shutdown state for a
1043
while.
1044

    
1045
The ``--ignore-failures`` option will cause the removal to proceed
1046
even in the presence of errors during the removal of the instance
1047
(e.g. during the shutdown or the disk removal). If this option is not
1048
given, the command will stop at the first error.
1049

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

    
1055
The ``--force`` option is used to skip the interactive confirmation.
1056

    
1057
See **ganeti**\(7) for a description of ``--submit`` and other common
1058
options.
1059

    
1060
Example::
1061

    
1062
    # gnt-instance remove instance1.example.com
1063

    
1064

    
1065
LIST
1066
^^^^
1067

    
1068
| **list**
1069
| [\--no-headers] [\--separator=*SEPARATOR*] [\--units=*UNITS*] [-v]
1070
| [{-o|\--output} *[+]FIELD,...*] [\--filter] [instance...]
1071

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

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

    
1080
The units used to display the numeric values in the output varies,
1081
depending on the options given. By default, the values will be
1082
formatted in the most appropriate unit. If the ``--separator`` option
1083
is given, then the values are shown in mebibytes to allow parsing by
1084
scripts. In both cases, the ``--units`` option can be used to enforce
1085
a given output unit.
1086

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

    
1090
The ``-o (--output)`` option takes a comma-separated list of output
1091
fields. The available fields and their meaning are:
1092

    
1093
@QUERY_FIELDS_INSTANCE@
1094

    
1095
If the value of the option starts with the character ``+``, the new
1096
field(s) will be added to the default list. This allows one to quickly
1097
see the default list plus a few other fields, instead of retyping the
1098
entire list of fields.
1099

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

    
1109
If exactly one argument is given and it appears to be a query filter
1110
(see **ganeti**\(7)), the query result is filtered accordingly. For
1111
ambiguous cases (e.g. a single field name as a filter) the ``--filter``
1112
(``-F``) option forces the argument to be treated as a filter (e.g.
1113
``gnt-instance list -F admin_state``).
1114

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

    
1118

    
1119
LIST-FIELDS
1120
^^^^^^^^^^^
1121

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

    
1124
Lists available fields for instances.
1125

    
1126

    
1127
INFO
1128
^^^^
1129

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

    
1132
Show detailed information about the given instance(s). This is
1133
different from **list** as it shows detailed data about the instance's
1134
disks (especially useful for the drbd disk template).
1135

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

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

    
1143
The ``--roman`` option can be used to cause envy among people who like
1144
ancient cultures, but are stuck with non-latin-friendly cluster
1145
virtualization technologies.
1146

    
1147
MODIFY
1148
^^^^^^
1149

    
1150
| **modify**
1151
| [{-H|\--hypervisor-parameters} *HYPERVISOR\_PARAMETERS*]
1152
| [{-B|\--backend-parameters} *BACKEND\_PARAMETERS*]
1153
| [{-m|\--runtime-memory} *SIZE*]
1154
| [\--net add[:options...] \|
1155
|  \--net [*N*:]add[,options...] \|
1156
|  \--net [*ID*:]remove \|
1157
|  \--net *ID*:modify[,options...]]
1158
| [\--disk add:size=*SIZE*[,options...] \|
1159
|  \--disk *N*:add,size=*SIZE*[,options...] \|
1160
|  \--disk *N*:add,size=*SIZE*,provider=*PROVIDER*[,options...][,param=*value*... ] \|
1161
|  \--disk *ID*:modify[,options...]
1162
|  \--disk [*ID*:]remove]
1163
| [{-t|\--disk-template} plain \| {-t|\--disk-template} drbd -n *new_secondary*] [\--no-wait-for-sync]
1164
| [\--new-primary=*node*]
1165
| [\--os-type=*OS* [\--force-variant]]
1166
| [{-O|\--os-parameters} *param*=*value*... ]
1167
| [\--offline \| \--online]
1168
| [\--submit] [\--print-job-id]
1169
| [\--ignore-ipolicy]
1170
| [\--hotplug]
1171
| [\--hotplug-if-possible]
1172
| {*instance*}
1173

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

    
1179
The ``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``
1180
and ``-O (--os-parameters)`` options specifies hypervisor, backend and
1181
OS parameter options in the form of name=value[,...]. For details
1182
which options can be specified, see the **add** command.
1183

    
1184
The ``-t (--disk-template)`` option will change the disk template of
1185
the instance.  Currently only conversions between the plain and drbd
1186
disk templates are supported, and the instance must be stopped before
1187
attempting the conversion. When changing from the plain to the drbd
1188
disk template, a new secondary node must be specified via the ``-n``
1189
option. The option ``--no-wait-for-sync`` can be used when converting
1190
to the ``drbd`` template in order to make the instance available for
1191
startup before DRBD has finished resyncing.
1192

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

    
1197
The ``--disk add:size=*SIZE*,[options..]`` option adds a disk to the
1198
instance, and ``--disk *N*:add:size=*SIZE*,[options..]`` will add a disk
1199
to the the instance at a specific index. The available options are the
1200
same as in the **add** command(``spindles``, ``mode``, ``name``, ``vg``,
1201
``metavg``). Per default, gnt-instance waits for the disk mirror to sync.
1202
If you do not want this behavior, use the ``--no-wait-for-sync`` option.
1203
When adding an ExtStorage disk, the ``provider=*PROVIDER*`` option is
1204
also mandatory and specifies the ExtStorage provider. Also, for
1205
ExtStorage disks arbitrary parameters can be passed as additional comma
1206
separated options, same as in the **add** command. The ``--disk remove``
1207
option will remove the last disk of the instance. Use
1208
``--disk `` *ID*``:remove`` to remove a disk by its identifier. *ID*
1209
can be the index of the disk, the disks's name or the disks's UUID. The
1210
``--disk *ID*:modify[,options...]`` will change the options of the disk.
1211
Available options are:
1212

    
1213
mode
1214
  The access mode. Either ``ro`` (read-only) or the default ``rw`` (read-write).
1215

    
1216
name
1217
   This option specifies a name for the disk, which can be used as a disk
1218
   identifier. An instance can not have two disks with the same name.
1219

    
1220
The ``--net *N*:add[,options..]`` will add a new network interface to
1221
the instance. The available options are the same as in the **add**
1222
command (``mac``, ``ip``, ``link``, ``mode``, ``network``). The
1223
``--net *ID*,remove`` will remove the intances' NIC with *ID* identifier,
1224
which can be the index of the NIC, the NIC's name or the NIC's UUID.
1225
The ``--net *ID*:modify[,options..]`` option will change the parameters of
1226
the instance network interface with the *ID* identifier.
1227

    
1228
The option ``-o (--os-type)`` will change the OS name for the instance
1229
(without reinstallation). In case an OS variant is specified that is
1230
not found, then by default the modification is refused, unless
1231
``--force-variant`` is passed. An invalid OS will also be refused,
1232
unless the ``--force`` option is given.
1233

    
1234
The option ``--new-primary`` will set the new primary node of an instance
1235
assuming the disks have already been moved manually. Unless the ``--force``
1236
option is given, it is verified that the instance is no longer running
1237
on its current primary node.
1238

    
1239
The ``--online`` and ``--offline`` options are used to transition an
1240
instance into and out of the ``offline`` state. An instance can be
1241
turned offline only if it was previously down. The ``--online`` option
1242
fails if the instance was not in the ``offline`` state, otherwise it
1243
changes instance's state to ``down``. These modifications take effect
1244
immediately.
1245

    
1246
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1247
during this operation are ignored.
1248

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

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

    
1264
See **ganeti**\(7) for a description of ``--submit`` and other common
1265
options.
1266

    
1267
Most of the changes take effect at the next restart. If the instance is
1268
running, there is no effect on the instance.
1269

    
1270
REINSTALL
1271
^^^^^^^^^
1272

    
1273
| **reinstall** [{-o|\--os-type} *os-type*] [\--select-os] [-f *force*]
1274
| [\--force-multiple]
1275
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all]
1276
| [{-O|\--os-parameters} *OS\_PARAMETERS*] [\--submit] [\--print-job-id]
1277
| {*instance*...}
1278

    
1279
Reinstalls the operating system on the given instance(s). The
1280
instance(s) must be stopped when running this command. If the ``-o
1281
(--os-type)`` is specified, the operating system is changed.
1282

    
1283
The ``--select-os`` option switches to an interactive OS reinstall.
1284
The user is prompted to select the OS template from the list of
1285
available OS templates. OS parameters can be overridden using ``-O
1286
(--os-parameters)`` (more documentation for this option under the
1287
**add** command).
1288

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

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

    
1299
RENAME
1300
^^^^^^
1301

    
1302
| **rename** [\--no-ip-check] [\--no-name-check] [\--submit] [\--print-job-id]
1303
| {*instance*} {*new\_name*}
1304

    
1305
Renames the given instance. The instance must be stopped when running
1306
this command. The requirements for the new name are the same as for
1307
adding an instance: the new name must be resolvable and the IP it
1308
resolves to must not be reachable (in order to prevent duplicate IPs
1309
the next time the instance is started). The IP test can be skipped if
1310
the ``--no-ip-check`` option is passed.
1311

    
1312
Note that you can rename an instance to its same name, to force
1313
re-executing the os-specific rename script for that instance, if
1314
needed.
1315

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

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

    
1325
Starting/stopping/connecting to console
1326
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1327

    
1328
STARTUP
1329
^^^^^^^
1330

    
1331
| **startup**
1332
| [\--force] [\--ignore-offline]
1333
| [\--force-multiple] [\--no-remember]
1334
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1335
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1336
| [{-H|\--hypervisor-parameters} ``key=value...``]
1337
| [{-B|\--backend-parameters} ``key=value...``]
1338
| [\--submit] [\--print-job-id] [\--paused]
1339
| {*name*...}
1340

    
1341
Starts one or more instances, depending on the following options.  The
1342
four available modes are:
1343

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

    
1348
\--node
1349
    will start the instances who have the given node as either primary
1350
    or secondary
1351

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

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

    
1360
\--all
1361
    will start all instances in the cluster (no arguments accepted)
1362

    
1363
\--tags
1364
    will start all instances in the cluster with the tags given as
1365
    arguments
1366

    
1367
\--node-tags
1368
    will start all instances in the cluster on nodes with the tags
1369
    given as arguments
1370

    
1371
\--pri-node-tags
1372
    will start all instances in the cluster on primary nodes with the
1373
    tags given as arguments
1374

    
1375
\--sec-node-tags
1376
    will start all instances in the cluster on secondary nodes with the
1377
    tags given as arguments
1378

    
1379
Note that although you can pass more than one selection option, the
1380
last one wins, so in order to guarantee the desired result, don't pass
1381
more than one such option.
1382

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

    
1387
The ``--force-multiple`` will skip the interactive confirmation in the
1388
case the more than one instance will be affected.
1389

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

    
1396
The ``-H (--hypervisor-parameters)`` and ``-B (--backend-parameters)``
1397
options specify temporary hypervisor and backend parameters that can
1398
be used to start an instance with modified parameters. They can be
1399
useful for quick testing without having to modify an instance back and
1400
forth, e.g.::
1401

    
1402
    # gnt-instance start -H kernel_args="single" instance1
1403
    # gnt-instance start -B maxmem=2048 instance2
1404

    
1405

    
1406
The first form will start the instance instance1 in single-user mode,
1407
and the instance instance2 with 2GB of RAM (this time only, unless
1408
that is the actual instance memory size already). Note that the values
1409
override the instance parameters (and not extend them): an instance
1410
with "kernel\_args=ro" when started with -H kernel\_args=single will
1411
result in "single", not "ro single".
1412

    
1413
The ``--paused`` option is only valid for Xen and kvm hypervisors.  This
1414
pauses the instance at the start of bootup, awaiting ``gnt-instance
1415
console`` to unpause it, allowing the entire boot process to be
1416
monitored for debugging.
1417

    
1418
See **ganeti**\(7) for a description of ``--submit`` and other common
1419
options.
1420

    
1421
Example::
1422

    
1423
    # gnt-instance start instance1.example.com
1424
    # gnt-instance start --node node1.example.com node2.example.com
1425
    # gnt-instance start --all
1426

    
1427

    
1428
SHUTDOWN
1429
^^^^^^^^
1430

    
1431
| **shutdown**
1432
| [\--timeout=*N*]
1433
| [\--force] [\--force-multiple] [\--ignore-offline] [\--no-remember]
1434
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1435
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1436
| [\--submit] [\--print-job-id]
1437
| {*name*...}
1438

    
1439
Stops one or more instances. If the instance cannot be cleanly stopped
1440
during a hardcoded interval (currently 2 minutes), it will forcibly
1441
stop the instance (equivalent to switching off the power on a physical
1442
machine).
1443

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

    
1449
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1450
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1451
``--sec-node-tags`` options are similar as for the **startup** command
1452
and they influence the actual instances being shutdown.
1453

    
1454
``--ignore-offline`` can be used to ignore offline primary nodes and
1455
force the instance to be marked as stopped. This option should be used
1456
with care as it can lead to an inconsistent cluster state.
1457

    
1458
Use ``--force`` to be able to shutdown an instance even when it's marked
1459
as offline. This is useful is an offline instance ends up in the
1460
``ERROR_up`` state, for example.
1461

    
1462
The ``--no-remember`` option will perform the shutdown but not change
1463
the state of the instance in the configuration file (if it was running
1464
before, Ganeti will still thinks it needs to be running). This can be
1465
useful for a cluster-wide shutdown, where some instances are marked as
1466
up and some as down, and you don't want to change the running state:
1467
you just need to disable the watcher, shutdown all instances with
1468
``--no-remember``, and when the watcher is activated again it will
1469
restore the correct runtime state for all instances.
1470

    
1471
See **ganeti**\(7) for a description of ``--submit`` and other common
1472
options.
1473

    
1474
Example::
1475

    
1476
    # gnt-instance shutdown instance1.example.com
1477
    # gnt-instance shutdown --all
1478

    
1479

    
1480
REBOOT
1481
^^^^^^
1482

    
1483
| **reboot**
1484
| [{-t|\--type} *REBOOT-TYPE*]
1485
| [\--ignore-secondaries]
1486
| [\--shutdown-timeout=*N*]
1487
| [\--force-multiple]
1488
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1489
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1490
| [\--submit] [\--print-job-id]
1491
| [*name*...]
1492

    
1493
Reboots one or more instances. The type of reboot depends on the value
1494
of ``-t (--type)``. A soft reboot does a hypervisor reboot, a hard reboot
1495
does a instance stop, recreates the hypervisor config for the instance
1496
and starts the instance. A full reboot does the equivalent of
1497
**gnt-instance shutdown && gnt-instance startup**.  The default is
1498
hard reboot.
1499

    
1500
For the hard reboot the option ``--ignore-secondaries`` ignores errors
1501
for the secondary node while re-assembling the instance disks.
1502

    
1503
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1504
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1505
``--sec-node-tags`` options are similar as for the **startup** command
1506
and they influence the actual instances being rebooted.
1507

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

    
1513
The ``--force-multiple`` will skip the interactive confirmation in the
1514
case the more than one instance will be affected.
1515

    
1516
See **ganeti**\(7) for a description of ``--submit`` and other common
1517
options.
1518

    
1519
Example::
1520

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

    
1524

    
1525
CONSOLE
1526
^^^^^^^
1527

    
1528
**console** [\--show-cmd] {*instance*}
1529

    
1530
Connects to the console of the given instance. If the instance is not
1531
up, an error is returned. Use the ``--show-cmd`` option to display the
1532
command instead of executing it.
1533

    
1534
For HVM instances, this will attempt to connect to the serial console
1535
of the instance. To connect to the virtualized "physical" console of a
1536
HVM instance, use a VNC client with the connection info from the
1537
**info** command.
1538

    
1539
For Xen/kvm instances, if the instance is paused, this attempts to
1540
unpause the instance after waiting a few seconds for the connection to
1541
the console to be made.
1542

    
1543
Example::
1544

    
1545
    # gnt-instance console instance1.example.com
1546

    
1547

    
1548
Disk management
1549
~~~~~~~~~~~~~~~
1550

    
1551
REPLACE-DISKS
1552
^^^^^^^^^^^^^
1553

    
1554
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1555
| [\--ignore-ipolicy] {-p} [\--disks *idx*] {*instance*}
1556

    
1557
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1558
| [\--ignore-ipolicy] {-s} [\--disks *idx*] {*instance*}
1559

    
1560
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1561
| [\--ignore-ipolicy]
1562
| {{-I\|\--iallocator} *name* \| {{-n|\--new-secondary} *node* } {*instance*}
1563

    
1564
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1565
| [\--ignore-ipolicy] {-a\|\--auto} {*instance*}
1566

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

    
1570
The first form (when passing the ``-p`` option) will replace the disks
1571
on the primary, while the second form (when passing the ``-s`` option
1572
will replace the disks on the secondary node. For these two cases (as
1573
the node doesn't change), it is possible to only run the replace for a
1574
subset of the disks, using the option ``--disks`` which takes a list
1575
of comma-delimited disk indices (zero-based), e.g. 0,2 to replace only
1576
the first and third disks.
1577

    
1578
The third form (when passing either the ``--iallocator`` or the
1579
``--new-secondary`` option) is designed to change secondary node of the
1580
instance. Specifying ``--iallocator`` makes the new secondary be
1581
selected automatically by the specified allocator plugin (use ``.`` to
1582
indicate the default allocator), otherwise the new secondary node will
1583
be the one chosen manually via the ``--new-secondary`` option.
1584

    
1585
Note that it is not possible to select an offline or drained node as a
1586
new secondary.
1587

    
1588
The fourth form (when using ``--auto``) will automatically determine
1589
which disks of an instance are faulty and replace them within the same
1590
node. The ``--auto`` option works only when an instance has only
1591
faulty disks on either the primary or secondary node; it doesn't work
1592
when both sides have faulty disks.
1593

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

    
1603
The ``--ignore-ipolicy`` let the command ignore instance policy
1604
violations if replace-disks changes groups and the instance would
1605
violate the new groups instance policy.
1606

    
1607
See **ganeti**\(7) for a description of ``--submit`` and other common
1608
options.
1609

    
1610
ACTIVATE-DISKS
1611
^^^^^^^^^^^^^^
1612

    
1613
| **activate-disks** [\--submit] [\--print-job-id] [\--ignore-size]
1614
| [\--wait-for-sync] {*instance*}
1615

    
1616
Activates the block devices of the given instance. If successful, the
1617
command will show the location and name of the block devices::
1618

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

    
1622

    
1623
In this example, *node1.example.com* is the name of the node on which
1624
the devices have been activated. The *disk/0* and *disk/1* are the
1625
Ganeti-names of the instance disks; how they are visible inside the
1626
instance is hypervisor-specific. */dev/drbd0* and */dev/drbd1* are the
1627
actual block devices as visible on the node.
1628

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

    
1636
The ``--wait-for-sync`` option will ensure that the command returns only
1637
after the instance's disks are synchronised (mostly for DRBD); this can
1638
be useful to ensure consistency, as otherwise there are no commands that
1639
can wait until synchronisation is done. However when passing this
1640
option, the command will have additional output, making it harder to
1641
parse the disk information.
1642

    
1643
Note that it is safe to run this command while the instance is already
1644
running.
1645

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

    
1649
DEACTIVATE-DISKS
1650
^^^^^^^^^^^^^^^^
1651

    
1652
**deactivate-disks** [-f] [\--submit] [\--print-job-id] {*instance*}
1653

    
1654
De-activates the block devices of the given instance. Note that if you
1655
run this command for an instance with a drbd disk template, while it
1656
is running, it will not be able to shutdown the block devices on the
1657
primary node, but it will shutdown the block devices on the secondary
1658
nodes, thus breaking the replication.
1659

    
1660
The ``-f``/``--force`` option will skip checks that the instance is
1661
down; in case the hypervisor is confused and we can't talk to it,
1662
normally Ganeti will refuse to deactivate the disks, but with this
1663
option passed it will skip this check and directly try to deactivate
1664
the disks. This can still fail due to the instance actually running or
1665
other issues.
1666

    
1667
See **ganeti**\(7) for a description of ``--submit`` and other common
1668
options.
1669

    
1670
GROW-DISK
1671
^^^^^^^^^
1672

    
1673
| **grow-disk** [\--no-wait-for-sync] [\--submit] [\--print-job-id]
1674
| [\--absolute]
1675
| {*instance*} {*disk*} {*amount*}
1676

    
1677
Grows an instance's disk. This is only possible for instances having a
1678
plain, drbd, file, sharedfile, rbd or ext disk template. For the ext
1679
template to work, the ExtStorage provider should also support growing.
1680
This means having a ``grow`` script that actually grows the volume of
1681
the external shared storage.
1682

    
1683
Note that this command only change the block device size; it will not
1684
grow the actual filesystems, partitions, etc. that live on that
1685
disk. Usually, you will need to:
1686

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

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

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

    
1695
The *disk* argument is the index of the instance disk to grow. The
1696
*amount* argument is given as a number which can have a suffix (like the
1697
disk size in instance create); if the suffix is missing, the value will
1698
be interpreted as mebibytes.
1699

    
1700
By default, the *amount* value represents the desired increase in the
1701
disk size (e.g. an amount of 1G will take a disk of size 3G to 4G). If
1702
the optional ``--absolute`` parameter is passed, then the *amount*
1703
argument doesn't represent the delta, but instead the desired final disk
1704
size (e.g. an amount of 8G will take a disk of size 4G to 8G).
1705

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

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

    
1714
See **ganeti**\(7) for a description of ``--submit`` and other common
1715
options.
1716

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

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

    
1721
Example for increasing the disk size to a certain size::
1722

    
1723
   # gnt-instance grow-disk --absolute instance1.example.com 0 32g
1724

    
1725
Also note that disk shrinking is not supported; use **gnt-backup
1726
export** and then **gnt-backup import** to reduce the disk size of an
1727
instance.
1728

    
1729
RECREATE-DISKS
1730
^^^^^^^^^^^^^^
1731

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

    
1736
Recreates all or a subset of disks of the given instance.
1737

    
1738
Note that this functionality should only be used for missing disks; if
1739
any of the given disks already exists, the operation will fail.  While
1740
this is suboptimal, recreate-disks should hopefully not be needed in
1741
normal operation and as such the impact of this is low.
1742

    
1743
If only a subset should be recreated, any number of ``disk`` options can
1744
be specified. It expects a disk index and an optional list of disk
1745
parameters to change. Only ``size``, ``spindles``, and ``mode`` can be
1746
changed while recreating disks. To recreate all disks while changing
1747
parameters on a subset only, a ``--disk`` option must be given for every
1748
disk of the instance.
1749

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

    
1759
Another method of choosing which nodes to place the instance on is by
1760
using the specified iallocator, passing the ``--iallocator`` option.
1761
The primary and secondary nodes will be chosen by the specified
1762
iallocator plugin, or by the default allocator if ``.`` is specified.
1763

    
1764
See **ganeti**\(7) for a description of ``--submit`` and other common
1765
options.
1766

    
1767
Recovery/moving
1768
~~~~~~~~~~~~~~~
1769

    
1770
FAILOVER
1771
^^^^^^^^
1772

    
1773
| **failover** [-f] [\--ignore-consistency] [\--ignore-ipolicy]
1774
| [\--shutdown-timeout=*N*]
1775
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*]
1776
| [\--cleanup]
1777
| [\--submit] [\--print-job-id]
1778
| {*instance*}
1779

    
1780
Failover will stop the instance (if running), change its primary node,
1781
and if it was originally running it will start it again (on the new
1782
primary). This works for instances with drbd template (in which case you
1783
can only fail to the secondary node) and for externally mirrored
1784
templates (sharedfile, blockdev, rbd and ext) (in which case you can
1785
fail to any other node).
1786

    
1787
If the instance's disk template is of type sharedfile, blockdev, rbd or
1788
ext, then you can explicitly specify the target node (which can be any
1789
node) using the ``-n`` or ``--target-node`` option, or specify an
1790
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1791
omit both, the default iallocator will be used to specify the target
1792
node.
1793

    
1794
If the instance's disk template is of type drbd, the target node is
1795
automatically selected as the drbd's secondary node. Changing the
1796
secondary node is possible with a replace-disks operation.
1797

    
1798
Normally the failover will check the consistency of the disks before
1799
failing over the instance. If you are trying to migrate instances off
1800
a dead node, this will fail. Use the ``--ignore-consistency`` option
1801
for this purpose. Note that this option can be dangerous as errors in
1802
shutting down the instance will be ignored, resulting in possibly
1803
having the instance running on two machines in parallel (on
1804
disconnected DRBD drives).
1805

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

    
1811
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1812
during this operation are ignored.
1813

    
1814
If the ``--cleanup`` option is passed, the operation changes from
1815
performin a failover to attempting recovery from a failed previous failover.
1816
In this mode, Ganeti checks if the instance runs on the correct node (and
1817
updates its configuration if not) and ensures the instances' disks
1818
are configured correctly.
1819

    
1820
See **ganeti**\(7) for a description of ``--submit`` and other common
1821
options.
1822

    
1823
Example::
1824

    
1825
    # gnt-instance failover instance1.example.com
1826

    
1827
For externally mirrored templates also ``-n`` is available::
1828

    
1829
    # gnt-instance failover -n node3.example.com instance1.example.com
1830

    
1831

    
1832
MIGRATE
1833
^^^^^^^
1834

    
1835
| **migrate** [-f] [\--allow-failover] [\--non-live]
1836
| [\--migration-mode=live\|non-live] [\--ignore-ipolicy]
1837
| [\--no-runtime-changes] [\--submit] [\--print-job-id]
1838
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*] {*instance*}
1839

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

    
1842
Migrate will move the instance to its secondary node without shutdown.
1843
As with failover, it works for instances having the drbd disk template
1844
or an externally mirrored disk template type such as sharedfile,
1845
blockdev, rbd or ext.
1846

    
1847
If the instance's disk template is of type sharedfile, blockdev, rbd or
1848
ext, then you can explicitly specify the target node (which can be any
1849
node) using the ``-n`` or ``--target-node`` option, or specify an
1850
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1851
omit both, the default iallocator will be used to specify the target
1852
node.  Alternatively, the default iallocator can be requested by
1853
specifying ``.`` as the name of the plugin.
1854

    
1855
If the instance's disk template is of type drbd, the target node is
1856
automatically selected as the drbd's secondary node. Changing the
1857
secondary node is possible with a replace-disks operation.
1858

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

    
1863
The ``--non-live`` and ``--migration-mode=non-live`` options will
1864
switch (for the hypervisors that support it) between a "fully live"
1865
(i.e. the interruption is as minimal as possible) migration and one in
1866
which the instance is frozen, its state saved and transported to the
1867
remote node, and then resumed there. This all depends on the
1868
hypervisor support for two different methods. In any case, it is not
1869
an error to pass this parameter (it will just be ignored if the
1870
hypervisor doesn't support it). The option ``--migration-mode=live``
1871
option will request a fully-live migration. The default, when neither
1872
option is passed, depends on the hypervisor parameters (and can be
1873
viewed with the **gnt-cluster info** command).
1874

    
1875
If the ``--cleanup`` option is passed, the operation changes from
1876
migration to attempting recovery from a failed previous migration. In
1877
this mode, Ganeti checks if the instance runs on the correct node (and
1878
updates its configuration if not) and ensures the instances' disks
1879
are configured correctly. In this mode, the ``--non-live`` option is
1880
ignored.
1881

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

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

    
1889
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1890
during this operation are ignored.
1891

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

    
1896
If an instance has the backend parameter ``always_failover`` set to
1897
true, then the migration is automatically converted into a failover.
1898

    
1899
See **ganeti**\(7) for a description of ``--submit`` and other common
1900
options.
1901

    
1902
Example (and expected output)::
1903

    
1904
    # gnt-instance migrate instance1
1905
    Instance instance1 will be migrated. Note that migration
1906
    might impact the instance if anything goes wrong (e.g. due to bugs in
1907
    the hypervisor). Continue?
1908
    y/[n]/?: y
1909
    Migrating instance instance1.example.com
1910
    * checking disk consistency between source and target
1911
    * switching node node2.example.com to secondary mode
1912
    * changing into standalone mode
1913
    * changing disks into dual-master mode
1914
    * wait until resync is done
1915
    * preparing node2.example.com to accept the instance
1916
    * migrating instance to node2.example.com
1917
    * switching node node1.example.com to secondary mode
1918
    * wait until resync is done
1919
    * changing into standalone mode
1920
    * changing disks into single-master mode
1921
    * wait until resync is done
1922
    * done
1923
    #
1924

    
1925

    
1926
MOVE
1927
^^^^
1928

    
1929
| **move** [-f] [\--ignore-consistency]
1930
| [-n *node*] [\--shutdown-timeout=*N*] [\--submit] [\--print-job-id]
1931
| [\--ignore-ipolicy]
1932
| {*instance*}
1933

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

    
1937
Note that since this operation is done via data copy, it will take a
1938
long time for big disks (similar to replace-disks for a drbd
1939
instance).
1940

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

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

    
1950
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1951
during this operation are ignored.
1952

    
1953
See **ganeti**\(7) for a description of ``--submit`` and other common
1954
options.
1955

    
1956
Example::
1957

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

    
1960

    
1961
CHANGE-GROUP
1962
^^^^^^^^^^^^
1963

    
1964
| **change-group** [\--submit] [\--print-job-id]
1965
| [\--iallocator *NAME*] [\--to *GROUP*...] {*instance*}
1966

    
1967
This command moves an instance to another node group. The move is
1968
calculated by an iallocator, either given on the command line or as a
1969
cluster default. Note that the iallocator does only consider disk
1970
information of the default disk template, even if the instances'
1971
disk templates differ from that.
1972

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

    
1976
See **ganeti**\(7) for a description of ``--submit`` and other common
1977
options.
1978

    
1979
Example::
1980

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

    
1983

    
1984
Tags
1985
~~~~
1986

    
1987
ADD-TAGS
1988
^^^^^^^^
1989

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

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

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

    
2001
LIST-TAGS
2002
^^^^^^^^^
2003

    
2004
**list-tags** {*instancename*}
2005

    
2006
List the tags of the given instance.
2007

    
2008
REMOVE-TAGS
2009
^^^^^^^^^^^
2010

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

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

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

    
2022
.. vim: set textwidth=72 :
2023
.. Local Variables:
2024
.. mode: rst
2025
.. fill-column: 72
2026
.. End: