Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.rst @ 8e4aacdc

History | View | Annotate | Download (74.4 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 option 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
access
82
   If 'userspace', instance will access this disk directly without going
83
   through a block device, avoiding expensive context switches with
84
   kernel space. This option works only for RBD, Gluster and ExtStorage
85
   devices. If not specified, the default access of the node-group (possibly
86
   inherited from the cluster-wide settings) will be used.
87

    
88
When creating ExtStorage disks, also arbitrary parameters can be passed,
89
to the ExtStorage provider. Those parameters are passed as additional
90
comma separated options. Therefore, an ExtStorage disk provided by
91
provider ``pvdr1`` with parameters ``param1``, ``param2`` would be
92
passed as ``--disk 0:size=10G,provider=pvdr1,param1=val1,param2=val2``.
93

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

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

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

    
112
The minimum information needed to specify an ExtStorage disk are the
113
``size`` and the ``provider``. For example:
114
``--disk 0:size=20G,provider=pvdr1``.
115

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

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

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

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

    
135
mac
136
    either a value or 'generate' to generate a new unique MAC
137

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

    
152
mode
153
    specifies the connection mode for this NIC: routed, bridged or
154
    openvswitch.
155

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

    
164
network
165
    derives the mode and the link from the settings of the network
166
    which is identified by its name. If the network option is chosen,
167
    link and mode must not be specified. Note that the mode and link
168
    depend on the network-to-nodegroup connection, thus allowing
169
    different nodegroups to be connected to the same network in
170
    different ways.
171

    
172
name
173
   this option specifies a name for the NIC, which can be used as a NIC
174
   identifier. An instance can not have two NICs with the same name.
175

    
176
vlan
177
   in openvswitch mode specifies the VLANs that the NIC will be
178
   connected to. To connect as an access port use ``n`` or ``.n`` with
179
   **n** being the VLAN ID. To connect as an trunk port use ``:n[:n]``.
180
   A hybrid port can be created with ``.n:n[:n]``
181

    
182
Of these "mode" and "link" are NIC parameters, and inherit their
183
default at cluster level.  Alternatively, if no network is desired for
184
the instance, you can prevent the default of one NIC with the
185
``--no-nics`` option.
186

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

    
195
The ``-B (--backend-parameters)`` option specifies the backend
196
parameters for the instance. If no such parameters are specified, the
197
values are inherited from the cluster. Possible parameters are:
198

    
199
maxmem
200
    the maximum memory size of the instance; as usual, suffixes can be
201
    used to denote the unit, otherwise the value is taken in mebibytes
202

    
203
minmem
204
    the minimum memory size of the instance; as usual, suffixes can be
205
    used to denote the unit, otherwise the value is taken in mebibytes
206

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

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

    
215
always\_failover
216
    ``True`` or ``False``, whether the instance must be failed over
217
    (shut down and rebooted) always or it may be migrated (briefly
218
    suspended)
219

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

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

    
233
The possible hypervisor options are as follows:
234

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

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

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

    
244
    a
245
        floppy drive
246

    
247
    c
248
        hard disk
249

    
250
    d
251
        CDROM drive
252

    
253
    n
254
        network boot (PXE)
255

    
256
    The default is not to set an HVM boot order, which is interpreted
257
    as 'dc'.
258

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

    
266
blockdev\_prefix
267
    Valid for the Xen HVM and PVM hypervisors.
268

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

    
273
floppy\_image\_path
274
    Valid for the KVM hypervisor.
275

    
276
    The path to a floppy disk image to attach to the instance.  This
277
    is useful to install Windows operating systems on Virt/IO disks
278
    because you can specify here the floppy for the drivers at
279
    installation time.
280

    
281
cdrom\_image\_path
282
    Valid for the Xen HVM and KVM hypervisors.
283

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

    
286
cdrom2\_image\_path
287
    Valid for the KVM hypervisor.
288

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

    
293
nic\_type
294
    Valid for the Xen HVM and KVM hypervisors.
295

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

    
299
    - rtl8139 (default for Xen HVM) (HVM & KVM)
300
    - ne2k\_isa (HVM & KVM)
301
    - ne2k\_pci (HVM & KVM)
302
    - i82551 (KVM)
303
    - i82557b (KVM)
304
    - i82559er (KVM)
305
    - pcnet (KVM)
306
    - e1000 (KVM)
307
    - paravirtual (default for KVM) (HVM & KVM)
308

    
309
vif\_type
310
    Valid for the Xen HVM hypervisor.
311

    
312
    This parameter specifies the vif type of the nic configuration
313
    of the instance. Unsetting the value leads to no type being specified
314
    in the configuration. Note that this parameter only takes effect when
315
    the 'nic_type' is not set. The possible options are:
316

    
317
    - ioemu
318
    - vif
319

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

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

    
326
    - ioemu [default] (HVM & KVM)
327
    - paravirtual (HVM & KVM)
328
    - ide (KVM)
329
    - scsi (KVM)
330
    - sd (KVM)
331
    - mtd (KVM)
332
    - pflash (KVM)
333

    
334

    
335
cdrom\_disk\_type
336
    Valid for the KVM hypervisor.
337

    
338
    This parameter determines the way the cdroms disks are presented
339
    to the instance. The default behavior is to get the same value of
340
    the earlier parameter (disk_type). The possible options are:
341

    
342
    - paravirtual
343
    - ide
344
    - scsi
345
    - sd
346
    - mtd
347
    - pflash
348

    
349

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

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

    
359
vnc\_password\_file
360
    Valid for the Xen HVM and KVM hypervisors.
361

    
362
    Specifies the location of the file containing the password for
363
    connections using VNC. The default is a file named
364
    vnc-cluster-password which can be found in the configuration
365
    directory.
366

    
367
vnc\_tls
368
    Valid for the KVM hypervisor.
369

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

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

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

    
379
vnc\_x509\_verify
380
    Valid for the KVM hypervisor.
381

    
382
spice\_bind
383
    Valid for the KVM hypervisor.
384

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

    
388
    - IPv4 addresses, including 0.0.0.0 and 127.0.0.1
389
    - IPv6 addresses, including :: and ::1
390
    - names of network interfaces
391

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

    
395
spice\_ip\_version
396
    Valid for the KVM hypervisor.
397

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

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

    
407
spice\_password\_file
408
    Valid for the KVM hypervisor.
409

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

    
414
spice\_image\_compression
415
    Valid for the KVM hypervisor.
416

    
417
    Configures the SPICE lossless image compression. Valid values are:
418

    
419
    - auto_glz
420
    - auto_lz
421
    - quic
422
    - glz
423
    - lz
424
    - off
425

    
426
spice\_jpeg\_wan\_compression
427
    Valid for the KVM hypervisor.
428

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

    
432
    - auto
433
    - never
434
    - always
435

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

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

    
442
    - auto
443
    - never
444
    - always
445

    
446
spice\_streaming\_video
447
    Valid for the KVM hypervisor.
448

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

    
451
    - off
452
    - all
453
    - filter
454

    
455
spice\_playback\_compression
456
    Valid for the KVM hypervisor.
457

    
458
    Configures whether SPICE should compress audio streams or not.
459

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

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

    
466
spice\_tls\_ciphers
467
    Valid for the KVM hypervisor.
468

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

    
472
spice\_use\_vdagent
473
    Valid for the KVM hypervisor.
474

    
475
    Enables or disables passing mouse events via SPICE vdagent.
476

    
477
cpu\_type
478
    Valid for the KVM hypervisor.
479

    
480
    This parameter determines the emulated cpu for the instance. If this
481
    parameter is empty (which is the default configuration), it will not
482
    be passed to KVM.
483

    
484
    Be aware of setting this parameter to ``"host"`` if you have nodes
485
    with different CPUs from each other. Live migration may stop working
486
    in this situation.
487

    
488
    For more information please refer to the KVM manual.
489

    
490
acpi
491
    Valid for the Xen HVM and KVM hypervisors.
492

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

    
496
pae
497
    Valid for the Xen HVM and KVM hypervisors.
498

    
499
    A boolean option that specifies if the hypervisor should enable
500
    PAE support for this instance. The default is false, disabling PAE
501
    support.
502

    
503
viridian
504
    Valid for the Xen HVM hypervisor.
505

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

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

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

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

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

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

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

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

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

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

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

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

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

    
561
serial\_console
562
    Valid for the KVM hypervisor.
563

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

    
571
serial\_speed
572
    Valid for the KVM hypervisor.
573

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

    
579
disk\_cache
580
    Valid for the KVM hypervisor.
581

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

    
592
security\_model
593
    Valid for the KVM hypervisor.
594

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

    
599
    Under *user* kvm will drop privileges and become the user
600
    specified by the security\_domain parameter.
601

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

    
606
security\_domain
607
    Valid for the KVM hypervisor.
608

    
609
    Under security model *user* the username to run the instance
610
    under.  It must be a valid username existing on the host.
611

    
612
    Cannot be set under security model *none* or *pool*.
613

    
614
kvm\_flag
615
    Valid for the KVM hypervisor.
616

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

    
621
mem\_path
622
    Valid for the KVM hypervisor.
623

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

    
628
use\_chroot
629
    Valid for the KVM hypervisor.
630

    
631
    This boolean option determines whether to run the KVM instance in a
632
    chroot directory.
633

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

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

    
640
migration\_downtime
641
    Valid for the KVM hypervisor.
642

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

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

    
651
cpu\_mask
652
    Valid for the Xen, KVM and LXC hypervisors.
653

    
654
    The processes belonging to the given instance are only scheduled
655
    on the specified CPUs.
656

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

    
661
    Second, a comma-separated list of CPU IDs or CPU ID ranges. The
662
    ranges are defined by a lower and higher boundary, separated by a
663
    dash, and the boundaries are inclusive. In this form, all VCPUs of
664
    the instance will be mapped on the selected list of CPUs. Example:
665
    ``0-2,5``, mapping all VCPUs (no matter how many) onto physical CPUs
666
    0, 1, 2 and 5.
667

    
668
    The last form is used for explicit control of VCPU-CPU pinnings. In
669
    this form, the list of VCPU mappings is given as a colon (:)
670
    separated list, whose elements are the possible values for the
671
    second or first form above. In this form, the number of elements in
672
    the colon-separated list _must_ equal the number of VCPUs of the
673
    instance.
674

    
675
    Example:
676

    
677
    .. code-block:: bash
678

    
679
      # Map the entire instance to CPUs 0-2
680
      gnt-instance modify -H cpu_mask=0-2 my-inst
681

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

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

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

    
692
      # Pin entire VM to CPU 0
693
      gnt-instance modify -H cpu_mask=0 my-inst
694

    
695
      # Turn off CPU pinning (default setting)
696
      gnt-instance modify -H cpu_mask=all my-inst
697

    
698
cpu\_cap
699
    Valid for the Xen hypervisor.
700

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

    
704
cpu\_weight
705
    Valid for the Xen hypervisor.
706

    
707
    Set the cpu time ratio to be allocated to the VM. Valid values are
708
    between 1 and 65535. Default weight is 256.
709

    
710
usb\_mouse
711
    Valid for the KVM hypervisor.
712

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

    
717
keymap
718
    Valid for the KVM hypervisor.
719

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

    
723
reboot\_behavior
724
    Valid for Xen PVM, Xen HVM and KVM hypervisors.
725

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

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

    
732
cpu\_cores
733
    Valid for the KVM hypervisor.
734

    
735
    Number of emulated CPU cores.
736

    
737
cpu\_threads
738
    Valid for the KVM hypervisor.
739

    
740
    Number of emulated CPU threads.
741

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

    
745
    Number of emulated CPU sockets.
746

    
747
soundhw
748
    Valid for the KVM and XEN hypervisors.
749

    
750
    Comma separated list of emulated sounds cards, or "all" to enable
751
    all the available ones.
752

    
753
cpuid
754
    Valid for the XEN hypervisor.
755

    
756
    Modify the values returned by CPUID_ instructions run within instances.
757

    
758
    This allows you to enable migration between nodes with different CPU
759
    attributes like cores, threads, hyperthreading or SS4 support by hiding
760
    the extra features where needed.
761

    
762
    See the XEN documentation for syntax and more information.
763

    
764
.. _CPUID: http://en.wikipedia.org/wiki/CPUID
765

    
766
usb\_devices
767
    Valid for the KVM hypervisor.
768

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

    
777
vga
778
    Valid for the KVM hypervisor.
779

    
780
    Emulated vga mode, passed the the kvm -vga option.
781

    
782
kvm\_extra
783
    Valid for the KVM hypervisor.
784

    
785
    Any other option to the KVM hypervisor, useful tweaking anything
786
    that Ganeti doesn't support. Note that values set with this
787
    parameter are split on a space character and currently don't support
788
    quoting.
789

    
790
machine\_version
791
    Valid for the KVM hypervisor.
792

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

    
797
migration\_caps
798
    Valid for the KVM hypervisor.
799

    
800
    Enable specific migration capabilities by providing a ":" separated
801
    list of supported capabilites. QEMU version 1.7.0 defines
802
    x-rdma-pin-all, auto-converge, zero-blocks, and xbzrle. Please note
803
    that while a combination of xbzrle and auto-converge might speed up
804
    the migration process significantly, the first may cause BSOD on
805
    Windows8r2 instances running on drbd.
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
The ``-I (--iallocator)`` option specifies the instance allocator plugin
833
to use (``.`` means the default allocator). If you pass in this option
834
the allocator will select nodes for this instance automatically, so you
835
don't need to pass them with the ``-n`` option. For more information
836
please refer to the instance allocator documentation.
837

    
838
The ``-t (--disk-template)`` options specifies the disk layout type
839
for the instance. If no disk template is specified, the default disk
840
template is used. The default disk template is the first in the list
841
of enabled disk templates, which can be adjusted cluster-wide with
842
``gnt-cluster modify``. The available choices for disk templates are:
843

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

    
848
file
849
    Disk devices will be regular files.
850

    
851
sharedfile
852
    Disk devices will be regulare files on a shared directory.
853

    
854
plain
855
    Disk devices will be logical volumes.
856

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

    
860
rbd
861
    Disk devices will be rbd volumes residing inside a RADOS cluster.
862

    
863
blockdev
864
    Disk devices will be adopted pre-existent block devices.
865

    
866
ext
867
    Disk devices will be provided by external shared storage,
868
    through the ExtStorage Interface using ExtStorage providers.
869

    
870
The optional second value of the ``-n (--node)`` is used for the drbd
871
template type and specifies the remote node.
872

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

    
876
The ``--file-storage-dir`` specifies the relative path under the
877
cluster-wide file storage directory to store file-based disks. It is
878
useful for having different subdirectories for different
879
instances. The full path of the directory where the disk files are
880
stored will consist of cluster-wide file storage directory + optional
881
subdirectory + instance name. This option is only relevant for
882
instances using the file storage backend.
883

    
884
The ``--file-driver`` specifies the driver to use for file-based
885
disks. Note that currently these drivers work with the xen hypervisor
886
only. This option is only relevant for instances using the file
887
storage backend. The available choices are:
888

    
889
loop
890
    Kernel loopback driver. This driver uses loopback devices to
891
    access the filesystem within the file. However, running I/O
892
    intensive applications in your instance using the loop driver
893
    might result in slowdowns. Furthermore, if you use the loopback
894
    driver consider increasing the maximum amount of loopback devices
895
    (on most systems it's 8) using the max\_loop param.
896

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

    
905
blktap2
906
    Analogous to the blktap driver, but used by newer versions of Xen.
907

    
908
If ``--ignore-ipolicy`` is given any instance policy violations occuring
909
during this operation are ignored.
910

    
911
See **ganeti**\(7) for a description of ``--submit`` and other common
912
options.
913

    
914
Example::
915

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

    
932

    
933
BATCH-CREATE
934
^^^^^^^^^^^^
935

    
936
| **batch-create**
937
| [{-I|\--iallocator} *instance allocator*]
938
| {instances\_file.json}
939

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

    
947
The instance file must be a valid-formed JSON file, containing an
948
array of dictionaries with instance creation parameters. All parameters
949
(except ``iallocator``) which are valid for the instance creation
950
OP code are allowed. The most important ones are:
951

    
952
instance\_name
953
    The FQDN of the new instance.
954

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

    
959
disks
960
    Array of disk specifications. Each entry describes one disk as a
961
    dictionary of disk parameters.
962

    
963
beparams
964
    A dictionary of backend parameters.
965

    
966
hypervisor
967
    The hypervisor for the instance.
968

    
969
hvparams
970
    A dictionary with the hypervisor options. If not passed, the default
971
    hypervisor options will be inherited.
972

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

    
979
pnode, snode
980
    The primary and optionally the secondary node to use for the
981
    instance (in case an iallocator script is not used). If those
982
    parameters are given, they have to be given consistently for all
983
    instances in the batch operation.
984

    
985
start
986
    whether to start the instance
987

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

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

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

    
1000

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

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

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

    
1030
    # gnt-instance batch-create instances.json
1031
    Submitted jobs 37, 38
1032

    
1033

    
1034
Note: If the allocator is used for computing suitable nodes for the
1035
instances, it will only take into account disk information for the
1036
default disk template. That means, even if other disk templates are
1037
specified for the instances, storage space information of these disk
1038
templates will not be considered in the allocation computation.
1039

    
1040

    
1041
REMOVE
1042
^^^^^^
1043

    
1044
| **remove** [\--ignore-failures] [\--shutdown-timeout=*N*] [\--submit]
1045
| [\--print-job-id] [\--force] {*instance*}
1046

    
1047
Remove an instance. This will remove all data from the instance and
1048
there is *no way back*. If you are not sure if you use an instance
1049
again, use **shutdown** first and leave it in the shutdown state for a
1050
while.
1051

    
1052
The ``--ignore-failures`` option will cause the removal to proceed
1053
even in the presence of errors during the removal of the instance
1054
(e.g. during the shutdown or the disk removal). If this option is not
1055
given, the command will stop at the first error.
1056

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

    
1062
The ``--force`` option is used to skip the interactive confirmation.
1063

    
1064
See **ganeti**\(7) for a description of ``--submit`` and other common
1065
options.
1066

    
1067
Example::
1068

    
1069
    # gnt-instance remove instance1.example.com
1070

    
1071

    
1072
LIST
1073
^^^^
1074

    
1075
| **list**
1076
| [\--no-headers] [\--separator=*SEPARATOR*] [\--units=*UNITS*] [-v]
1077
| [{-o|\--output} *[+]FIELD,...*] [\--filter] [instance...]
1078

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

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

    
1087
The units used to display the numeric values in the output varies,
1088
depending on the options given. By default, the values will be
1089
formatted in the most appropriate unit. If the ``--separator`` option
1090
is given, then the values are shown in mebibytes to allow parsing by
1091
scripts. In both cases, the ``--units`` option can be used to enforce
1092
a given output unit.
1093

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

    
1097
The ``-o (--output)`` option takes a comma-separated list of output
1098
fields. The available fields and their meaning are:
1099

    
1100
@QUERY_FIELDS_INSTANCE@
1101

    
1102
If the value of the option starts with the character ``+``, the new
1103
field(s) will be added to the default list. This allows one to quickly
1104
see the default list plus a few other fields, instead of retyping the
1105
entire list of fields.
1106

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

    
1116
If exactly one argument is given and it appears to be a query filter
1117
(see **ganeti**\(7)), the query result is filtered accordingly. For
1118
ambiguous cases (e.g. a single field name as a filter) the ``--filter``
1119
(``-F``) option forces the argument to be treated as a filter (e.g.
1120
``gnt-instance list -F admin_state``).
1121

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

    
1125

    
1126
LIST-FIELDS
1127
^^^^^^^^^^^
1128

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

    
1131
Lists available fields for instances.
1132

    
1133

    
1134
INFO
1135
^^^^
1136

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

    
1139
Show detailed information about the given instance(s). This is
1140
different from **list** as it shows detailed data about the instance's
1141
disks (especially useful for the drbd disk template).
1142

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

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

    
1150
The ``--roman`` option can be used to cause envy among people who like
1151
ancient cultures, but are stuck with non-latin-friendly cluster
1152
virtualization technologies.
1153

    
1154
MODIFY
1155
^^^^^^
1156

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

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

    
1186
The ``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``
1187
and ``-O (--os-parameters)`` options specifies hypervisor, backend and
1188
OS parameter options in the form of name=value[,...]. For details
1189
which options can be specified, see the **add** command.
1190

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

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

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

    
1221
mode
1222
  The access mode. Either ``ro`` (read-only) or the default ``rw`` (read-write).
1223

    
1224
name
1225
   This option specifies a name for the disk, which can be used as a disk
1226
   identifier. An instance can not have two disks with the same name.
1227

    
1228
The ``--net *N*:add[,options..]`` will add a new network interface to
1229
the instance. The available options are the same as in the **add**
1230
command (``mac``, ``ip``, ``link``, ``mode``, ``network``). The
1231
``--net *ID*,remove`` will remove the intances' NIC with *ID* identifier,
1232
which can be the index of the NIC, the NIC's name or the NIC's UUID.
1233
The ``--net *ID*:modify[,options..]`` option will change the parameters of
1234
the instance network interface with the *ID* identifier.
1235

    
1236
The option ``-o (--os-type)`` will change the OS name for the instance
1237
(without reinstallation). In case an OS variant is specified that is
1238
not found, then by default the modification is refused, unless
1239
``--force-variant`` is passed. An invalid OS will also be refused,
1240
unless the ``--force`` option is given.
1241

    
1242
The option ``--new-primary`` will set the new primary node of an instance
1243
assuming the disks have already been moved manually. Unless the ``--force``
1244
option is given, it is verified that the instance is no longer running
1245
on its current primary node.
1246

    
1247
The ``--online`` and ``--offline`` options are used to transition an
1248
instance into and out of the ``offline`` state. An instance can be
1249
turned offline only if it was previously down. The ``--online`` option
1250
fails if the instance was not in the ``offline`` state, otherwise it
1251
changes instance's state to ``down``. These modifications take effect
1252
immediately.
1253

    
1254
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1255
during this operation are ignored.
1256

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

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

    
1272
See **ganeti**\(7) for a description of ``--submit`` and other common
1273
options.
1274

    
1275
Most of the changes take effect at the next restart. If the instance is
1276
running, there is no effect on the instance.
1277

    
1278
REINSTALL
1279
^^^^^^^^^
1280

    
1281
| **reinstall** [{-o|\--os-type} *os-type*] [\--select-os] [-f *force*]
1282
| [\--force-multiple]
1283
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all]
1284
| [{-O|\--os-parameters} *OS\_PARAMETERS*] [\--submit] [\--print-job-id]
1285
| {*instance*...}
1286

    
1287
Reinstalls the operating system on the given instance(s). The
1288
instance(s) must be stopped when running this command. If the ``-o
1289
(--os-type)`` is specified, the operating system is changed.
1290

    
1291
The ``--select-os`` option switches to an interactive OS reinstall.
1292
The user is prompted to select the OS template from the list of
1293
available OS templates. OS parameters can be overridden using ``-O
1294
(--os-parameters)`` (more documentation for this option under the
1295
**add** command).
1296

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

    
1304
See **ganeti**\(7) for a description of ``--submit`` and other common
1305
options.
1306

    
1307
RENAME
1308
^^^^^^
1309

    
1310
| **rename** [\--no-ip-check] [\--no-name-check] [\--submit] [\--print-job-id]
1311
| {*instance*} {*new\_name*}
1312

    
1313
Renames the given instance. The instance must be stopped when running
1314
this command. The requirements for the new name are the same as for
1315
adding an instance: the new name must be resolvable and the IP it
1316
resolves to must not be reachable (in order to prevent duplicate IPs
1317
the next time the instance is started). The IP test can be skipped if
1318
the ``--no-ip-check`` option is passed.
1319

    
1320
Note that you can rename an instance to its same name, to force
1321
re-executing the os-specific rename script for that instance, if
1322
needed.
1323

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

    
1330
See **ganeti**\(7) for a description of ``--submit`` and other common
1331
options.
1332

    
1333
Starting/stopping/connecting to console
1334
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1335

    
1336
STARTUP
1337
^^^^^^^
1338

    
1339
| **startup**
1340
| [\--force] [\--ignore-offline]
1341
| [\--force-multiple] [\--no-remember]
1342
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1343
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1344
| [{-H|\--hypervisor-parameters} ``key=value...``]
1345
| [{-B|\--backend-parameters} ``key=value...``]
1346
| [\--submit] [\--print-job-id] [\--paused]
1347
| {*name*...}
1348

    
1349
Starts one or more instances, depending on the following options.  The
1350
four available modes are:
1351

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

    
1356
\--node
1357
    will start the instances who have the given node as either primary
1358
    or secondary
1359

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

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

    
1368
\--all
1369
    will start all instances in the cluster (no arguments accepted)
1370

    
1371
\--tags
1372
    will start all instances in the cluster with the tags given as
1373
    arguments
1374

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

    
1379
\--pri-node-tags
1380
    will start all instances in the cluster on primary nodes with the
1381
    tags given as arguments
1382

    
1383
\--sec-node-tags
1384
    will start all instances in the cluster on secondary nodes with the
1385
    tags given as arguments
1386

    
1387
Note that although you can pass more than one selection option, the
1388
last one wins, so in order to guarantee the desired result, don't pass
1389
more than one such option.
1390

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

    
1395
The ``--force-multiple`` will skip the interactive confirmation in the
1396
case the more than one instance will be affected.
1397

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

    
1404
The ``-H (--hypervisor-parameters)`` and ``-B (--backend-parameters)``
1405
options specify temporary hypervisor and backend parameters that can
1406
be used to start an instance with modified parameters. They can be
1407
useful for quick testing without having to modify an instance back and
1408
forth, e.g.::
1409

    
1410
    # gnt-instance start -H kernel_args="single" instance1
1411
    # gnt-instance start -B maxmem=2048 instance2
1412

    
1413

    
1414
The first form will start the instance instance1 in single-user mode,
1415
and the instance instance2 with 2GB of RAM (this time only, unless
1416
that is the actual instance memory size already). Note that the values
1417
override the instance parameters (and not extend them): an instance
1418
with "kernel\_args=ro" when started with -H kernel\_args=single will
1419
result in "single", not "ro single".
1420

    
1421
The ``--paused`` option is only valid for Xen and kvm hypervisors.  This
1422
pauses the instance at the start of bootup, awaiting ``gnt-instance
1423
console`` to unpause it, allowing the entire boot process to be
1424
monitored for debugging.
1425

    
1426
See **ganeti**\(7) for a description of ``--submit`` and other common
1427
options.
1428

    
1429
Example::
1430

    
1431
    # gnt-instance start instance1.example.com
1432
    # gnt-instance start --node node1.example.com node2.example.com
1433
    # gnt-instance start --all
1434

    
1435

    
1436
SHUTDOWN
1437
^^^^^^^^
1438

    
1439
| **shutdown**
1440
| [\--timeout=*N*]
1441
| [\--force] [\--force-multiple] [\--ignore-offline] [\--no-remember]
1442
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1443
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1444
| [\--submit] [\--print-job-id]
1445
| {*name*...}
1446

    
1447
Stops one or more instances. If the instance cannot be cleanly stopped
1448
during a hardcoded interval (currently 2 minutes), it will forcibly
1449
stop the instance (equivalent to switching off the power on a physical
1450
machine).
1451

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

    
1457
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1458
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1459
``--sec-node-tags`` options are similar as for the **startup** command
1460
and they influence the actual instances being shutdown.
1461

    
1462
``--ignore-offline`` can be used to ignore offline primary nodes and
1463
force the instance to be marked as stopped. This option should be used
1464
with care as it can lead to an inconsistent cluster state.
1465

    
1466
Use ``--force`` to be able to shutdown an instance even when it's marked
1467
as offline. This is useful is an offline instance ends up in the
1468
``ERROR_up`` state, for example.
1469

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

    
1479
See **ganeti**\(7) for a description of ``--submit`` and other common
1480
options.
1481

    
1482
Example::
1483

    
1484
    # gnt-instance shutdown instance1.example.com
1485
    # gnt-instance shutdown --all
1486

    
1487

    
1488
REBOOT
1489
^^^^^^
1490

    
1491
| **reboot**
1492
| [{-t|\--type} *REBOOT-TYPE*]
1493
| [\--ignore-secondaries]
1494
| [\--shutdown-timeout=*N*]
1495
| [\--force-multiple]
1496
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1497
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1498
| [\--submit] [\--print-job-id]
1499
| [*name*...]
1500

    
1501
Reboots one or more instances. The type of reboot depends on the value
1502
of ``-t (--type)``. A soft reboot does a hypervisor reboot, a hard reboot
1503
does a instance stop, recreates the hypervisor config for the instance
1504
and starts the instance. A full reboot does the equivalent of
1505
**gnt-instance shutdown && gnt-instance startup**.  The default is
1506
hard reboot.
1507

    
1508
For the hard reboot the option ``--ignore-secondaries`` ignores errors
1509
for the secondary node while re-assembling the instance disks.
1510

    
1511
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1512
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1513
``--sec-node-tags`` options are similar as for the **startup** command
1514
and they influence the actual instances being rebooted.
1515

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

    
1521
The ``--force-multiple`` will skip the interactive confirmation in the
1522
case the more than one instance will be affected.
1523

    
1524
See **ganeti**\(7) for a description of ``--submit`` and other common
1525
options.
1526

    
1527
Example::
1528

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

    
1532

    
1533
CONSOLE
1534
^^^^^^^
1535

    
1536
**console** [\--show-cmd] {*instance*}
1537

    
1538
Connects to the console of the given instance. If the instance is not
1539
up, an error is returned. Use the ``--show-cmd`` option to display the
1540
command instead of executing it.
1541

    
1542
For HVM instances, this will attempt to connect to the serial console
1543
of the instance. To connect to the virtualized "physical" console of a
1544
HVM instance, use a VNC client with the connection info from the
1545
**info** command.
1546

    
1547
For Xen/kvm instances, if the instance is paused, this attempts to
1548
unpause the instance after waiting a few seconds for the connection to
1549
the console to be made.
1550

    
1551
Example::
1552

    
1553
    # gnt-instance console instance1.example.com
1554

    
1555

    
1556
Disk management
1557
~~~~~~~~~~~~~~~
1558

    
1559
REPLACE-DISKS
1560
^^^^^^^^^^^^^
1561

    
1562
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1563
| [\--ignore-ipolicy] {-p} [\--disks *idx*] {*instance*}
1564

    
1565
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1566
| [\--ignore-ipolicy] {-s} [\--disks *idx*] {*instance*}
1567

    
1568
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1569
| [\--ignore-ipolicy]
1570
| {{-I\|\--iallocator} *name* \| {{-n|\--new-secondary} *node* } {*instance*}
1571

    
1572
| **replace-disks** [\--submit] [\--print-job-id] [\--early-release]
1573
| [\--ignore-ipolicy] {-a\|\--auto} {*instance*}
1574

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

    
1578
The first form (when passing the ``-p`` option) will replace the disks
1579
on the primary, while the second form (when passing the ``-s`` option
1580
will replace the disks on the secondary node. For these two cases (as
1581
the node doesn't change), it is possible to only run the replace for a
1582
subset of the disks, using the option ``--disks`` which takes a list
1583
of comma-delimited disk indices (zero-based), e.g. 0,2 to replace only
1584
the first and third disks.
1585

    
1586
The third form (when passing either the ``--iallocator`` or the
1587
``--new-secondary`` option) is designed to change secondary node of the
1588
instance. Specifying ``--iallocator`` makes the new secondary be
1589
selected automatically by the specified allocator plugin (use ``.`` to
1590
indicate the default allocator), otherwise the new secondary node will
1591
be the one chosen manually via the ``--new-secondary`` option.
1592

    
1593
Note that it is not possible to select an offline or drained node as a
1594
new secondary.
1595

    
1596
The fourth form (when using ``--auto``) will automatically determine
1597
which disks of an instance are faulty and replace them within the same
1598
node. The ``--auto`` option works only when an instance has only
1599
faulty disks on either the primary or secondary node; it doesn't work
1600
when both sides have faulty disks.
1601

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

    
1611
The ``--ignore-ipolicy`` let the command ignore instance policy
1612
violations if replace-disks changes groups and the instance would
1613
violate the new groups instance policy.
1614

    
1615
See **ganeti**\(7) for a description of ``--submit`` and other common
1616
options.
1617

    
1618
ACTIVATE-DISKS
1619
^^^^^^^^^^^^^^
1620

    
1621
| **activate-disks** [\--submit] [\--print-job-id] [\--ignore-size]
1622
| [\--wait-for-sync] {*instance*}
1623

    
1624
Activates the block devices of the given instance. If successful, the
1625
command will show the location and name of the block devices::
1626

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

    
1630

    
1631
In this example, *node1.example.com* is the name of the node on which
1632
the devices have been activated. The *disk/0* and *disk/1* are the
1633
Ganeti-names of the instance disks; how they are visible inside the
1634
instance is hypervisor-specific. */dev/drbd0* and */dev/drbd1* are the
1635
actual block devices as visible on the node.
1636

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

    
1644
The ``--wait-for-sync`` option will ensure that the command returns only
1645
after the instance's disks are synchronised (mostly for DRBD); this can
1646
be useful to ensure consistency, as otherwise there are no commands that
1647
can wait until synchronisation is done. However when passing this
1648
option, the command will have additional output, making it harder to
1649
parse the disk information.
1650

    
1651
Note that it is safe to run this command while the instance is already
1652
running.
1653

    
1654
See **ganeti**\(7) for a description of ``--submit`` and other common
1655
options.
1656

    
1657
DEACTIVATE-DISKS
1658
^^^^^^^^^^^^^^^^
1659

    
1660
**deactivate-disks** [-f] [\--submit] [\--print-job-id] {*instance*}
1661

    
1662
De-activates the block devices of the given instance. Note that if you
1663
run this command for an instance with a drbd disk template, while it
1664
is running, it will not be able to shutdown the block devices on the
1665
primary node, but it will shutdown the block devices on the secondary
1666
nodes, thus breaking the replication.
1667

    
1668
The ``-f``/``--force`` option will skip checks that the instance is
1669
down; in case the hypervisor is confused and we can't talk to it,
1670
normally Ganeti will refuse to deactivate the disks, but with this
1671
option passed it will skip this check and directly try to deactivate
1672
the disks. This can still fail due to the instance actually running or
1673
other issues.
1674

    
1675
See **ganeti**\(7) for a description of ``--submit`` and other common
1676
options.
1677

    
1678
GROW-DISK
1679
^^^^^^^^^
1680

    
1681
| **grow-disk** [\--no-wait-for-sync] [\--submit] [\--print-job-id]
1682
| [\--absolute]
1683
| {*instance*} {*disk*} {*amount*}
1684

    
1685
Grows an instance's disk. This is only possible for instances having a
1686
plain, drbd, file, sharedfile, rbd or ext disk template. For the ext
1687
template to work, the ExtStorage provider should also support growing.
1688
This means having a ``grow`` script that actually grows the volume of
1689
the external shared storage.
1690

    
1691
Note that this command only change the block device size; it will not
1692
grow the actual filesystems, partitions, etc. that live on that
1693
disk. Usually, you will need to:
1694

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

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

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

    
1703
The *disk* argument is the index of the instance disk to grow. The
1704
*amount* argument is given as a number which can have a suffix (like the
1705
disk size in instance create); if the suffix is missing, the value will
1706
be interpreted as mebibytes.
1707

    
1708
By default, the *amount* value represents the desired increase in the
1709
disk size (e.g. an amount of 1G will take a disk of size 3G to 4G). If
1710
the optional ``--absolute`` parameter is passed, then the *amount*
1711
argument doesn't represent the delta, but instead the desired final disk
1712
size (e.g. an amount of 8G will take a disk of size 4G to 8G).
1713

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

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

    
1722
See **ganeti**\(7) for a description of ``--submit`` and other common
1723
options.
1724

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

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

    
1729
Example for increasing the disk size to a certain size::
1730

    
1731
   # gnt-instance grow-disk --absolute instance1.example.com 0 32g
1732

    
1733
Also note that disk shrinking is not supported; use **gnt-backup
1734
export** and then **gnt-backup import** to reduce the disk size of an
1735
instance.
1736

    
1737
RECREATE-DISKS
1738
^^^^^^^^^^^^^^
1739

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

    
1744
Recreates all or a subset of disks of the given instance.
1745

    
1746
Note that this functionality should only be used for missing disks; if
1747
any of the given disks already exists, the operation will fail.  While
1748
this is suboptimal, recreate-disks should hopefully not be needed in
1749
normal operation and as such the impact of this is low.
1750

    
1751
If only a subset should be recreated, any number of ``disk`` options can
1752
be specified. It expects a disk index and an optional list of disk
1753
parameters to change. Only ``size``, ``spindles``, and ``mode`` can be
1754
changed while recreating disks. To recreate all disks while changing
1755
parameters on a subset only, a ``--disk`` option must be given for every
1756
disk of the instance.
1757

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

    
1767
Another method of choosing which nodes to place the instance on is by
1768
using the specified iallocator, passing the ``--iallocator`` option.
1769
The primary and secondary nodes will be chosen by the specified
1770
iallocator plugin, or by the default allocator if ``.`` is specified.
1771

    
1772
See **ganeti**\(7) for a description of ``--submit`` and other common
1773
options.
1774

    
1775
Recovery/moving
1776
~~~~~~~~~~~~~~~
1777

    
1778
FAILOVER
1779
^^^^^^^^
1780

    
1781
| **failover** [-f] [\--ignore-consistency] [\--ignore-ipolicy]
1782
| [\--shutdown-timeout=*N*]
1783
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*]
1784
| [\--cleanup]
1785
| [\--submit] [\--print-job-id]
1786
| {*instance*}
1787

    
1788
Failover will stop the instance (if running), change its primary node,
1789
and if it was originally running it will start it again (on the new
1790
primary). This works for instances with drbd template (in which case you
1791
can only fail to the secondary node) and for externally mirrored
1792
templates (sharedfile, blockdev, rbd and ext) (in which case you can
1793
fail to any other node).
1794

    
1795
If the instance's disk template is of type sharedfile, blockdev, rbd or
1796
ext, then you can explicitly specify the target node (which can be any
1797
node) using the ``-n`` or ``--target-node`` option, or specify an
1798
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1799
omit both, the default iallocator will be used to specify the target
1800
node.
1801

    
1802
If the instance's disk template is of type drbd, the target node is
1803
automatically selected as the drbd's secondary node. Changing the
1804
secondary node is possible with a replace-disks operation.
1805

    
1806
Normally the failover will check the consistency of the disks before
1807
failing over the instance. If you are trying to migrate instances off
1808
a dead node, this will fail. Use the ``--ignore-consistency`` option
1809
for this purpose. Note that this option can be dangerous as errors in
1810
shutting down the instance will be ignored, resulting in possibly
1811
having the instance running on two machines in parallel (on
1812
disconnected DRBD drives).
1813

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

    
1819
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1820
during this operation are ignored.
1821

    
1822
If the ``--cleanup`` option is passed, the operation changes from
1823
performin a failover to attempting recovery from a failed previous failover.
1824
In this mode, Ganeti checks if the instance runs on the correct node (and
1825
updates its configuration if not) and ensures the instances' disks
1826
are configured correctly.
1827

    
1828
See **ganeti**\(7) for a description of ``--submit`` and other common
1829
options.
1830

    
1831
Example::
1832

    
1833
    # gnt-instance failover instance1.example.com
1834

    
1835
For externally mirrored templates also ``-n`` is available::
1836

    
1837
    # gnt-instance failover -n node3.example.com instance1.example.com
1838

    
1839

    
1840
MIGRATE
1841
^^^^^^^
1842

    
1843
| **migrate** [-f] [\--allow-failover] [\--non-live]
1844
| [\--migration-mode=live\|non-live] [\--ignore-ipolicy]
1845
| [\--no-runtime-changes] [\--submit] [\--print-job-id]
1846
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*] {*instance*}
1847

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

    
1850
Migrate will move the instance to its secondary node without shutdown.
1851
As with failover, it works for instances having the drbd disk template
1852
or an externally mirrored disk template type such as sharedfile,
1853
blockdev, rbd or ext.
1854

    
1855
If the instance's disk template is of type sharedfile, blockdev, rbd or
1856
ext, then you can explicitly specify the target node (which can be any
1857
node) using the ``-n`` or ``--target-node`` option, or specify an
1858
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1859
omit both, the default iallocator will be used to specify the target
1860
node.  Alternatively, the default iallocator can be requested by
1861
specifying ``.`` as the name of the plugin.
1862

    
1863
If the instance's disk template is of type drbd, the target node is
1864
automatically selected as the drbd's secondary node. Changing the
1865
secondary node is possible with a replace-disks operation.
1866

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

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

    
1883
If the ``--cleanup`` option is passed, the operation changes from
1884
migration to attempting recovery from a failed previous migration. In
1885
this mode, Ganeti checks if the instance runs on the correct node (and
1886
updates its configuration if not) and ensures the instances' disks
1887
are configured correctly. In this mode, the ``--non-live`` option is
1888
ignored.
1889

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

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

    
1897
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1898
during this operation are ignored.
1899

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

    
1904
If an instance has the backend parameter ``always_failover`` set to
1905
true, then the migration is automatically converted into a failover.
1906

    
1907
See **ganeti**\(7) for a description of ``--submit`` and other common
1908
options.
1909

    
1910
Example (and expected output)::
1911

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

    
1933

    
1934
MOVE
1935
^^^^
1936

    
1937
| **move** [-f] [\--ignore-consistency]
1938
| [-n *node*] [\--shutdown-timeout=*N*] [\--submit] [\--print-job-id]
1939
| [\--ignore-ipolicy]
1940
| {*instance*}
1941

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

    
1945
Note that since this operation is done via data copy, it will take a
1946
long time for big disks (similar to replace-disks for a drbd
1947
instance).
1948

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

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

    
1958
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1959
during this operation are ignored.
1960

    
1961
See **ganeti**\(7) for a description of ``--submit`` and other common
1962
options.
1963

    
1964
Example::
1965

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

    
1968

    
1969
CHANGE-GROUP
1970
^^^^^^^^^^^^
1971

    
1972
| **change-group** [\--submit] [\--print-job-id]
1973
| [\--iallocator *NAME*] [\--to *GROUP*...] {*instance*}
1974

    
1975
This command moves an instance to another node group. The move is
1976
calculated by an iallocator, either given on the command line or as a
1977
cluster default. Note that the iallocator does only consider disk
1978
information of the default disk template, even if the instances'
1979
disk templates differ from that.
1980

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

    
1984
See **ganeti**\(7) for a description of ``--submit`` and other common
1985
options.
1986

    
1987
Example::
1988

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

    
1991

    
1992
Tags
1993
~~~~
1994

    
1995
ADD-TAGS
1996
^^^^^^^^
1997

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

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

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

    
2009
LIST-TAGS
2010
^^^^^^^^^
2011

    
2012
**list-tags** {*instancename*}
2013

    
2014
List the tags of the given instance.
2015

    
2016
REMOVE-TAGS
2017
^^^^^^^^^^^
2018

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

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

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

    
2030
.. vim: set textwidth=72 :
2031
.. Local Variables:
2032
.. mode: rst
2033
.. fill-column: 72
2034
.. End: