Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.rst @ e19f7095

History | View | Annotate | Download (66.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* \| adopt=*LV*}[,vg=*VG*][,metavg=*VG*][,mode=*ro\|rw*]
32
|  \| {size=*VAL*,provider=*PROVIDER*}[,param=*value*... ][,mode=*ro\|rw*]
33
|  \| {-s|\--os-size} *SIZE*}
34
| [\--no-ip-check] [\--no-name-check] [\--no-start] [\--no-install]
35
| [\--net=*N* [:options...] \| \--no-nics]
36
| [{-B|\--backend-parameters} *BEPARAMS*]
37
| [{-H|\--hypervisor-parameters} *HYPERVISOR* [: option=*value*... ]]
38
| [{-O|\--os-parameters} *param*=*value*... ]
39
| [\--file-storage-dir *dir\_path*] [\--file-driver {loop \| blktap}]
40
| {{-n|\--node} *node[:secondary-node]* \| {-I|\--iallocator} *name*}
41
| {{-o|\--os-type} *os-type*}
42
| [\--submit]
43
| [\--ignore-ipolicy]
44
| {*instance*}
45

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

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

    
63
When creating ExtStorage disks, also arbitrary parameters can be passed,
64
to the ExtStorage provider. Those parameters are passed as additional
65
comma separated options. Therefore, an ExtStorage disk provided by
66
provider ``pvdr1`` with parameters ``param1``, ``param2`` would be
67
passed as ``--disk 0:size=10G,provider=pvdr1,param1=val1,param2=val2``.
68

    
69
When using the ``adopt`` key in the disk definition, Ganeti will
70
reuse those volumes (instead of creating new ones) as the
71
instance's disks. Ganeti will rename these volumes to the standard
72
format, and (without installing the OS) will use them as-is for the
73
instance. This allows migrating instances from non-managed mode
74
(e.g. plain KVM with LVM) to being managed via Ganeti. Please note that
75
this works only for the \`plain' disk template (see below for
76
template details).
77

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

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

    
87
The minimum information needed to specify an ExtStorage disk are the
88
``size`` and the ``provider``. For example:
89
``--disk 0:size=20G,provider=pvdr1``.
90

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

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

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

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

    
110
mac
111
    either a value or 'generate' to generate a new unique MAC
112

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

    
118
mode
119
    specifies the connection mode for this NIC: routed, bridged or
120
    openvswitch.
121

    
122
link
123
    in bridged or openvswitch mode specifies the interface to attach
124
    this NIC to, in routed mode it's intended to differentiate between
125
    different routing tables/instance groups (but the meaning is
126
    dependent on the network script, see **gnt-cluster**\(8) for more
127
    details). Note that openvswitch support is also hypervisor
128
    dependent.
129

    
130
network
131
    derives the mode and the link from the settings of the network
132
    which is identified by its name. If the network option is chosen,
133
    link and mode must not be specified. Note that the mode and link
134
    depend on the network-to-nodegroup connection, thus allowing
135
    different nodegroups to be connected to the same network in
136
    different ways.
137

    
138

    
139
Of these "mode" and "link" are NIC parameters, and inherit their
140
default at cluster level.  Alternatively, if no network is desired for
141
the instance, you can prevent the default of one NIC with the
142
``--no-nics`` option.
143

    
144
The ``-o (--os-type)`` option specifies the operating system to be
145
installed.  The available operating systems can be listed with
146
**gnt-os list**.  Passing ``--no-install`` will however skip the OS
147
installation, allowing a manual import if so desired. Note that the
148
no-installation mode will automatically disable the start-up of the
149
instance (without an OS, it most likely won't be able to start-up
150
successfully).
151

    
152
The ``-B (--backend-parameters)`` option specifies the backend
153
parameters for the instance. If no such parameters are specified, the
154
values are inherited from the cluster. Possible parameters are:
155

    
156
maxmem
157
    the maximum memory size of the instance; as usual, suffixes can be
158
    used to denote the unit, otherwise the value is taken in mebibytes
159

    
160
minmem
161
    the minimum memory size of the instance; as usual, suffixes can be
162
    used to denote the unit, otherwise the value is taken in mebibytes
163

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

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

    
172
always\_failover
173
    ``True`` or ``False``, whether the instance must be failed over
174
    (shut down and rebooted) always or it may be migrated (briefly
175
    suspended)
176

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

    
183
The ``-H (--hypervisor-parameters)`` option specified the hypervisor
184
to use for the instance (must be one of the enabled hypervisors on the
185
cluster) and optionally custom parameters for this instance. If not
186
other options are used (i.e. the invocation is just -H *NAME*) the
187
instance will inherit the cluster options. The defaults below show the
188
cluster defaults at cluster creation time.
189

    
190
The possible hypervisor options are as follows:
191

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

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

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

    
201
    a
202
        floppy drive
203

    
204
    c
205
        hard disk
206

    
207
    d
208
        CDROM drive
209

    
210
    n
211
        network boot (PXE)
212

    
213
    The default is not to set an HVM boot order, which is interpreted
214
    as 'dc'.
215

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

    
223
blockdev\_prefix
224
    Valid for the Xen HVM and PVM hypervisors.
225

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

    
230
floppy\_image\_path
231
    Valid for the KVM hypervisor.
232

    
233
    The path to a floppy disk image to attach to the instance.  This
234
    is useful to install Windows operating systems on Virt/IO disks
235
    because you can specify here the floppy for the drivers at
236
    installation time.
237

    
238
cdrom\_image\_path
239
    Valid for the Xen HVM and KVM hypervisors.
240

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

    
243
cdrom2\_image\_path
244
    Valid for the KVM hypervisor.
245

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

    
250
nic\_type
251
    Valid for the Xen HVM and KVM hypervisors.
252

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

    
256
    - rtl8139 (default for Xen HVM) (HVM & KVM)
257
    - ne2k\_isa (HVM & KVM)
258
    - ne2k\_pci (HVM & KVM)
259
    - i82551 (KVM)
260
    - i82557b (KVM)
261
    - i82559er (KVM)
262
    - pcnet (KVM)
263
    - e1000 (KVM)
264
    - paravirtual (default for KVM) (HVM & KVM)
265

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

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

    
272
    - ioemu [default] (HVM & KVM)
273
    - ide (HVM & KVM)
274
    - scsi (KVM)
275
    - sd (KVM)
276
    - mtd (KVM)
277
    - pflash (KVM)
278

    
279

    
280
cdrom\_disk\_type
281
    Valid for the KVM hypervisor.
282

    
283
    This parameter determines the way the cdroms disks are presented
284
    to the instance. The default behavior is to get the same value of
285
    the earlier parameter (disk_type). The possible options are:
286

    
287
    - paravirtual
288
    - ide
289
    - scsi
290
    - sd
291
    - mtd
292
    - pflash
293

    
294

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

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

    
304
vnc\_tls
305
    Valid for the KVM hypervisor.
306

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

    
310
vnc\_x509\_path
311
    Valid for the KVM hypervisor.
312

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

    
316
vnc\_x509\_verify
317
    Valid for the KVM hypervisor.
318

    
319
spice\_bind
320
    Valid for the KVM hypervisor.
321

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

    
325
    - IPv4 addresses, including 0.0.0.0 and 127.0.0.1
326
    - IPv6 addresses, including :: and ::1
327
    - names of network interfaces
328

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

    
332
spice\_ip\_version
333
    Valid for the KVM hypervisor.
334

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

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

    
344
spice\_password\_file
345
    Valid for the KVM hypervisor.
346

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

    
351
spice\_image\_compression
352
    Valid for the KVM hypervisor.
353

    
354
    Configures the SPICE lossless image compression. Valid values are:
355

    
356
    - auto_glz
357
    - auto_lz
358
    - quic
359
    - glz
360
    - lz
361
    - off
362

    
363
spice\_jpeg\_wan\_compression
364
    Valid for the KVM hypervisor.
365

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

    
369
    - auto
370
    - never
371
    - always
372

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

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

    
379
    - auto
380
    - never
381
    - always
382

    
383
spice\_streaming\_video
384
    Valid for the KVM hypervisor.
385

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

    
388
    - off
389
    - all
390
    - filter
391

    
392
spice\_playback\_compression
393
    Valid for the KVM hypervisor.
394

    
395
    Configures whether SPICE should compress audio streams or not.
396

    
397
spice\_use\_tls
398
    Valid for the KVM hypervisor.
399

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

    
403
spice\_tls\_ciphers
404
    Valid for the KVM hypervisor.
405

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

    
409
spice\_use\_vdagent
410
    Valid for the KVM hypervisor.
411

    
412
    Enables or disables passing mouse events via SPICE vdagent.
413

    
414
cpu\_type
415
    Valid for the KVM hypervisor.
416

    
417
    This parameter determines the emulated cpu for the instance. If this
418
    parameter is empty (which is the default configuration), it will not
419
    be passed to KVM.
420

    
421
    Be aware of setting this parameter to ``"host"`` if you have nodes
422
    with different CPUs from each other. Live migration may stop working
423
    in this situation.
424

    
425
    For more information please refer to the KVM manual.
426

    
427
acpi
428
    Valid for the Xen HVM and KVM hypervisors.
429

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

    
433
pae
434
    Valid for the Xen HVM and KVM hypervisors.
435

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

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

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

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

    
452
    This option specifies the path (on the node) to the kernel to boot
453
    the instance with. Xen PVM instances always require this, while for
454
    KVM if this option is empty, it will cause the machine to load the
455
    kernel from its disks (and the boot will be done accordingly to
456
    ``boot_order``).
457

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

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

    
465
    The default setting for this value is simply ``"ro"``, which
466
    mounts the root disk (initially) in read-only one. For example,
467
    setting this to single will cause the instance to start in
468
    single-user mode.
469

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

    
473
    This option specifies the path (on the node) to the initrd to boot
474
    the instance with. Xen PVM instances can use this always, while
475
    for KVM if this option is only used if the ``kernel_path`` option
476
    is also specified. You can pass here either an absolute filename
477
    (the path to the initrd) if you want to use an initrd, or use the
478
    format no\_initrd\_path for no initrd.
479

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

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

    
487
    Please note, that if this setting is an empty string and the
488
    hypervisor is Xen it will not be written to the Xen configuration
489
    file
490

    
491
serial\_console
492
    Valid for the KVM hypervisor.
493

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

    
497
serial\_speed
498
    Valid for the KVM hypervisor.
499

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

    
505
disk\_cache
506
    Valid for the KVM hypervisor.
507

    
508
    The disk cache mode. It can be either default to not pass any
509
    cache option to KVM, or one of the KVM cache modes: none (for
510
    direct I/O), writethrough (to use the host cache but report
511
    completion to the guest only when the host has committed the
512
    changes to disk) or writeback (to use the host cache and report
513
    completion as soon as the data is in the host cache). Note that
514
    there are special considerations for the cache mode depending on
515
    version of KVM used and disk type (always raw file under Ganeti),
516
    please refer to the KVM documentation for more details.
517

    
518
security\_model
519
    Valid for the KVM hypervisor.
520

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

    
525
    Under *user* kvm will drop privileges and become the user
526
    specified by the security\_domain parameter.
527

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

    
532
security\_domain
533
    Valid for the KVM hypervisor.
534

    
535
    Under security model *user* the username to run the instance
536
    under.  It must be a valid username existing on the host.
537

    
538
    Cannot be set under security model *none* or *pool*.
539

    
540
kvm\_flag
541
    Valid for the KVM hypervisor.
542

    
543
    If *enabled* the -enable-kvm flag is passed to kvm. If *disabled*
544
    -disable-kvm is passed. If unset no flag is passed, and the
545
    default running mode for your kvm binary will be used.
546

    
547
mem\_path
548
    Valid for the KVM hypervisor.
549

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

    
554
use\_chroot
555
    Valid for the KVM hypervisor.
556

    
557
    This boolean option determines whether to run the KVM instance in a
558
    chroot directory.
559

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

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

    
566
migration\_downtime
567
    Valid for the KVM hypervisor.
568

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

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

    
577
cpu\_mask
578
    Valid for the Xen, KVM and LXC hypervisors.
579

    
580
    The processes belonging to the given instance are only scheduled
581
    on the specified CPUs.
582

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

    
587
    Second, a comma-separated list of CPU IDs or CPU ID ranges. The
588
    ranges are defined by a lower and higher boundary, separated by a
589
    dash, and the boundaries are inclusive. In this form, all VCPUs of
590
    the instance will be mapped on the selected list of CPUs. Example:
591
    ``0-2,5``, mapping all VCPUs (no matter how many) onto physical CPUs
592
    0, 1, 2 and 5.
593

    
594
    The last form is used for explicit control of VCPU-CPU pinnings. In
595
    this form, the list of VCPU mappings is given as a colon (:)
596
    separated list, whose elements are the possible values for the
597
    second or first form above. In this form, the number of elements in
598
    the colon-separated list _must_ equal the number of VCPUs of the
599
    instance.
600

    
601
    Example:
602

    
603
    .. code-block:: bash
604

    
605
      # Map the entire instance to CPUs 0-2
606
      gnt-instance modify -H cpu_mask=0-2 my-inst
607

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

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

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

    
618
      # Pin entire VM to CPU 0
619
      gnt-instance modify -H cpu_mask=0 my-inst
620

    
621
      # Turn off CPU pinning (default setting)
622
      gnt-instance modify -H cpu_mask=all my-inst
623

    
624
cpu\_cap
625
    Valid for the Xen hypervisor.
626

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

    
630
cpu\_weight
631
    Valid for the Xen hypervisor.
632

    
633
    Set the cpu time ratio to be allocated to the VM. Valid values are
634
    between 1 and 65535. Default weight is 256.
635

    
636
usb\_mouse
637
    Valid for the KVM hypervisor.
638

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

    
643
keymap
644
    Valid for the KVM hypervisor.
645

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

    
649
reboot\_behavior
650
    Valid for Xen PVM, Xen HVM and KVM hypervisors.
651

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

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

    
658
cpu\_cores
659
    Valid for the KVM hypervisor.
660

    
661
    Number of emulated CPU cores.
662

    
663
cpu\_threads
664
    Valid for the KVM hypervisor.
665

    
666
    Number of emulated CPU threads.
667

    
668
cpu\_sockets
669
    Valid for the KVM hypervisor.
670

    
671
    Number of emulated CPU sockets.
672

    
673
soundhw
674
    Valid for the KVM hypervisor.
675

    
676
    Comma separated list of emulated sounds cards, or "all" to enable
677
    all the available ones.
678

    
679
usb\_devices
680
    Valid for the KVM hypervisor.
681

    
682
    Comma separated list of usb devices. These can be emulated devices
683
    or passthrough ones, and each one gets passed to kvm with its own
684
    ``-usbdevice`` option. See the **qemu**\(1) manpage for the syntax
685
    of the possible components.
686

    
687
vga
688
    Valid for the KVM hypervisor.
689

    
690
    Emulated vga mode, passed the the kvm -vga option.
691

    
692
kvm\_extra
693
    Valid for the KVM hypervisor.
694

    
695
    Any other option to the KVM hypervisor, useful tweaking anything
696
    that Ganeti doesn't support.
697

    
698
machine\_version
699
    Valid for the KVM hypervisor.
700

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

    
705
kvm\_path
706
    Valid for the KVM hypervisor.
707

    
708
    Path to the userspace KVM (or qemu) program.
709

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

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

    
717
The ``-I (--iallocator)`` option specifies the instance allocator plugin
718
to use (``.`` means the default allocator). If you pass in this option
719
the allocator will select nodes for this instance automatically, so you
720
don't need to pass them with the ``-n`` option. For more information
721
please refer to the instance allocator documentation.
722

    
723
The ``-t (--disk-template)`` options specifies the disk layout type
724
for the instance.  The available choices are:
725

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

    
730
file
731
    Disk devices will be regular files.
732

    
733
sharedfile
734
    Disk devices will be regulare files on a shared directory.
735

    
736
plain
737
    Disk devices will be logical volumes.
738

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

    
742
rbd
743
    Disk devices will be rbd volumes residing inside a RADOS cluster.
744

    
745
blockdev
746
    Disk devices will be adopted pre-existent block devices.
747

    
748
ext
749
    Disk devices will be provided by external shared storage,
750
    through the ExtStorage Interface using ExtStorage providers.
751

    
752
The optional second value of the ``-n (--node)`` is used for the drbd
753
template type and specifies the remote node.
754

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

    
758
The ``--file-storage-dir`` specifies the relative path under the
759
cluster-wide file storage directory to store file-based disks. It is
760
useful for having different subdirectories for different
761
instances. The full path of the directory where the disk files are
762
stored will consist of cluster-wide file storage directory + optional
763
subdirectory + instance name. Example:
764
``@RPL_FILE_STORAGE_DIR@/mysubdir/instance1.example.com``. This
765
option is only relevant for instances using the file storage backend.
766

    
767
The ``--file-driver`` specifies the driver to use for file-based
768
disks. Note that currently these drivers work with the xen hypervisor
769
only. This option is only relevant for instances using the file
770
storage backend. The available choices are:
771

    
772
loop
773
    Kernel loopback driver. This driver uses loopback devices to
774
    access the filesystem within the file. However, running I/O
775
    intensive applications in your instance using the loop driver
776
    might result in slowdowns. Furthermore, if you use the loopback
777
    driver consider increasing the maximum amount of loopback devices
778
    (on most systems it's 8) using the max\_loop param.
779

    
780
blktap
781
    The blktap driver (for Xen hypervisors). In order to be able to
782
    use the blktap driver you should check if the 'blktapctrl' user
783
    space disk agent is running (usually automatically started via
784
    xend).  This user-level disk I/O interface has the advantage of
785
    better performance. Especially if you use a network file system
786
    (e.g. NFS) to store your instances this is the recommended choice.
787

    
788
If ``--ignore-ipolicy`` is given any instance policy violations occuring
789
during this operation are ignored.
790

    
791
See **ganeti**\(7) for a description of ``--submit`` and other common
792
options.
793

    
794
Example::
795

    
796
    # gnt-instance add -t file --disk 0:size=30g -B maxmem=512 -o debian-etch \
797
      -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
798
    # gnt-instance add -t plain --disk 0:size=30g -B maxmem=1024,minmem=512 \
799
      -o debian-etch -n node1.example.com instance1.example.com
800
    # gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
801
      -B maxmem=512 -o debian-etch -n node1.example.com instance1.example.com
802
    # gnt-instance add -t drbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
803
      -n node1.example.com:node2.example.com instance2.example.com
804
    # gnt-instance add -t rbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
805
      -n node1.example.com instance1.example.com
806
    # gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1 -B maxmem=512 \
807
      -o debian-etch -n node1.example.com instance1.example.com
808
    # gnt-instance add -t ext --disk 0:size=30g,provider=pvdr1,param1=val1 \
809
      --disk 1:size=40g,provider=pvdr2,param2=val2,param3=val3 -B maxmem=512 \
810
      -o debian-etch -n node1.example.com instance1.example.com
811

    
812

    
813
BATCH-CREATE
814
^^^^^^^^^^^^
815

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

    
818
This command (similar to the Ganeti 1.2 **batcher** tool) submits
819
multiple instance creation jobs based on a definition file. The
820
instance configurations do not encompass all the possible options for
821
the **add** command, but only a subset.
822

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

    
827
disk\_size
828
    The size of the disks of the instance.
829

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

    
834
backend
835
    A dictionary of backend parameters.
836

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

    
842
mac, ip, mode, link
843
    Specifications for the one NIC that will be created for the
844
    instance. 'bridge' is also accepted as a backwards compatible
845
    key.
846

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

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

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

    
861
start
862
    whether to start the instance
863

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

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

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

    
876

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

    
880
    {
881
      "instance3": {
882
        "template": "drbd",
883
        "os": "debootstrap",
884
        "disk_size": ["25G"],
885
        "iallocator": "dumb"
886
      },
887
      "instance5": {
888
        "template": "drbd",
889
        "os": "debootstrap",
890
        "disk_size": ["25G"],
891
        "iallocator": "dumb",
892
        "hypervisor": "xen-hvm",
893
        "hvparams": {"acpi": true},
894
        "backend": {"maxmem": 512, "minmem": 256}
895
      }
896
    }
897

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

    
901
    # gnt-instance batch-create instances.json
902
    instance3: 11224
903
    instance5: 11225
904

    
905
REMOVE
906
^^^^^^
907

    
908
**remove** [\--ignore-failures] [\--shutdown-timeout=*N*] [\--submit]
909
[\--force] {*instance*}
910

    
911
Remove an instance. This will remove all data from the instance and
912
there is *no way back*. If you are not sure if you use an instance
913
again, use **shutdown** first and leave it in the shutdown state for a
914
while.
915

    
916
The ``--ignore-failures`` option will cause the removal to proceed
917
even in the presence of errors during the removal of the instance
918
(e.g. during the shutdown or the disk removal). If this option is not
919
given, the command will stop at the first error.
920

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

    
926
The ``--force`` option is used to skip the interactive confirmation.
927

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

    
931
Example::
932

    
933
    # gnt-instance remove instance1.example.com
934

    
935

    
936
LIST
937
^^^^
938

    
939
| **list**
940
| [\--no-headers] [\--separator=*SEPARATOR*] [\--units=*UNITS*] [-v]
941
| [{-o|\--output} *[+]FIELD,...*] [\--filter] [instance...]
942

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

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

    
951
The units used to display the numeric values in the output varies,
952
depending on the options given. By default, the values will be
953
formatted in the most appropriate unit. If the ``--separator`` option
954
is given, then the values are shown in mebibytes to allow parsing by
955
scripts. In both cases, the ``--units`` option can be used to enforce
956
a given output unit.
957

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

    
961
The ``-o (--output)`` option takes a comma-separated list of output
962
fields. The available fields and their meaning are:
963

    
964
@QUERY_FIELDS_INSTANCE@
965

    
966
If the value of the option starts with the character ``+``, the new
967
field(s) will be added to the default list. This allows one to quickly
968
see the default list plus a few other fields, instead of retyping the
969
entire list of fields.
970

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

    
980
If exactly one argument is given and it appears to be a query filter
981
(see **ganeti**\(7)), the query result is filtered accordingly. For
982
ambiguous cases (e.g. a single field name as a filter) the ``--filter``
983
(``-F``) option forces the argument to be treated as a filter (e.g.
984
``gnt-instance list -F admin_state``).
985

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

    
989

    
990
LIST-FIELDS
991
^^^^^^^^^^^
992

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

    
995
Lists available fields for instances.
996

    
997

    
998
INFO
999
^^^^
1000

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

    
1003
Show detailed information about the given instance(s). This is
1004
different from **list** as it shows detailed data about the instance's
1005
disks (especially useful for the drbd disk template).
1006

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

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

    
1014
The ``--roman`` option can be used to cause envy among people who like
1015
ancient cultures, but are stuck with non-latin-friendly cluster
1016
virtualization technologies.
1017

    
1018
MODIFY
1019
^^^^^^
1020

    
1021
| **modify**
1022
| [{-H|\--hypervisor-parameters} *HYPERVISOR\_PARAMETERS*]
1023
| [{-B|\--backend-parameters} *BACKEND\_PARAMETERS*]
1024
| [{-m|\--runtime-memory} *SIZE*]
1025
| [\--net add*[:options]* \| \--net [*N*:]remove \| \--net *N:options*]
1026
| [\--disk add:size=*SIZE*[,vg=*VG*][,metavg=*VG*] \|
1027
|  \--disk add:size=*SIZE*,provider=*PROVIDER*[,param=*value*... ] \|
1028
|  \--disk [*N*:]remove \|
1029
|  \--disk *N*:mode=*MODE*]
1030
| [{-t|\--disk-template} plain | {-t|\--disk-template} drbd -n *new_secondary*] [\--no-wait-for-sync]
1031
| [\--os-type=*OS* [\--force-variant]]
1032
| [{-O|\--os-parameters} *param*=*value*... ]
1033
| [\--offline \| \--online]
1034
| [\--submit]
1035
| [\--ignore-ipolicy]
1036
| {*instance*}
1037

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

    
1043
The ``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``
1044
and ``-O (--os-parameters)`` options specifies hypervisor, backend and
1045
OS parameter options in the form of name=value[,...]. For details
1046
which options can be specified, see the **add** command.
1047

    
1048
The ``-t (--disk-template)`` option will change the disk template of
1049
the instance.  Currently only conversions between the plain and drbd
1050
disk templates are supported, and the instance must be stopped before
1051
attempting the conversion. When changing from the plain to the drbd
1052
disk template, a new secondary node must be specified via the ``-n``
1053
option. The option ``--no-wait-for-sync`` can be used when converting
1054
to the ``drbd`` template in order to make the instance available for
1055
startup before DRBD has finished resyncing.
1056

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

    
1061
The ``--disk add:size=``*SIZE* option adds a disk to the instance. The
1062
optional ``vg=``*VG* option specifies an LVM volume group other than the
1063
default volume group to create the disk on. For DRBD disks, the
1064
``metavg=``*VG* option specifies the volume group for the metadata
1065
device. When adding an ExtStorage disk the ``provider=``*PROVIDER*
1066
option is also mandatory and specifies the ExtStorage provider. Also,
1067
for ExtStorage disks arbitrary parameters can be passed as additional
1068
comma separated options, same as in the **add** command. ``--disk``
1069
*N*``:add,size=``**SIZE** can be used to add a disk at a specific index.
1070
The ``--disk remove`` option will remove the last disk of the instance.
1071
Use ``--disk `` *N*``:remove`` to remove a disk by its index. The
1072
``--disk`` *N*``:mode=``*MODE* option will change the mode of the Nth
1073
disk of the instance between read-only (``ro``) and read-write (``rw``).
1074

    
1075
The ``--net add:``*options* and ``--net`` *N*``:add,``*options* option
1076
will add a new network interface to the instance. The available options
1077
are the same as in the **add** command (``mac``, ``ip``, ``link``,
1078
``mode``, ``network``). The ``--net remove`` will remove the last network
1079
interface of the instance (``--net`` *N*``:remove`` for a specific index),
1080
while the ``--net`` *N*``:``*options* option will change the parameters of
1081
the Nth instance network interface.
1082

    
1083
The option ``-o (--os-type)`` will change the OS name for the instance
1084
(without reinstallation). In case an OS variant is specified that is
1085
not found, then by default the modification is refused, unless
1086
``--force-variant`` is passed. An invalid OS will also be refused,
1087
unless the ``--force`` option is given.
1088

    
1089
The ``--online`` and ``--offline`` options are used to transition an
1090
instance into and out of the ``offline`` state. An instance can be
1091
turned offline only if it was previously down. The ``--online`` option
1092
fails if the instance was not in the ``offline`` state, otherwise it
1093
changes instance's state to ``down``. These modifications take effect
1094
immediately.
1095

    
1096
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1097
during this operation are ignored.
1098

    
1099
See **ganeti**\(7) for a description of ``--submit`` and other common
1100
options.
1101

    
1102
Most of the changes take effect at the next restart. If the instance is
1103
running, there is no effect on the instance.
1104

    
1105
REINSTALL
1106
^^^^^^^^^
1107

    
1108
| **reinstall** [{-o|\--os-type} *os-type*] [\--select-os] [-f *force*]
1109
| [\--force-multiple]
1110
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all]
1111
| [{-O|\--os-parameters} *OS\_PARAMETERS*] [\--submit] {*instance*...}
1112

    
1113
Reinstalls the operating system on the given instance(s). The
1114
instance(s) must be stopped when running this command. If the ``-o
1115
(--os-type)`` is specified, the operating system is changed.
1116

    
1117
The ``--select-os`` option switches to an interactive OS reinstall.
1118
The user is prompted to select the OS template from the list of
1119
available OS templates. OS parameters can be overridden using ``-O
1120
(--os-parameters)`` (more documentation for this option under the
1121
**add** command).
1122

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

    
1130
See **ganeti**\(7) for a description of ``--submit`` and other common
1131
options.
1132

    
1133
RENAME
1134
^^^^^^
1135

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

    
1139
Renames the given instance. The instance must be stopped when running
1140
this command. The requirements for the new name are the same as for
1141
adding an instance: the new name must be resolvable and the IP it
1142
resolves to must not be reachable (in order to prevent duplicate IPs
1143
the next time the instance is started). The IP test can be skipped if
1144
the ``--no-ip-check`` option is passed.
1145

    
1146
Note that you can rename an instance to its same name, to force
1147
re-executing the os-specific rename script for that instance, if
1148
needed.
1149

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

    
1156
See **ganeti**\(7) for a description of ``--submit`` and other common
1157
options.
1158

    
1159
Starting/stopping/connecting to console
1160
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1161

    
1162
STARTUP
1163
^^^^^^^
1164

    
1165
| **startup**
1166
| [\--force] [\--ignore-offline]
1167
| [\--force-multiple] [\--no-remember]
1168
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1169
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1170
| [{-H|\--hypervisor-parameters} ``key=value...``]
1171
| [{-B|\--backend-parameters} ``key=value...``]
1172
| [\--submit] [\--paused]
1173
| {*name*...}
1174

    
1175
Starts one or more instances, depending on the following options.  The
1176
four available modes are:
1177

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

    
1182
\--node
1183
    will start the instances who have the given node as either primary
1184
    or secondary
1185

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

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

    
1194
\--all
1195
    will start all instances in the cluster (no arguments accepted)
1196

    
1197
\--tags
1198
    will start all instances in the cluster with the tags given as
1199
    arguments
1200

    
1201
\--node-tags
1202
    will start all instances in the cluster on nodes with the tags
1203
    given as arguments
1204

    
1205
\--pri-node-tags
1206
    will start all instances in the cluster on primary nodes with the
1207
    tags given as arguments
1208

    
1209
\--sec-node-tags
1210
    will start all instances in the cluster on secondary nodes with the
1211
    tags given as arguments
1212

    
1213
Note that although you can pass more than one selection option, the
1214
last one wins, so in order to guarantee the desired result, don't pass
1215
more than one such option.
1216

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

    
1221
The ``--force-multiple`` will skip the interactive confirmation in the
1222
case the more than one instance will be affected.
1223

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

    
1230
The ``-H (--hypervisor-parameters)`` and ``-B (--backend-parameters)``
1231
options specify temporary hypervisor and backend parameters that can
1232
be used to start an instance with modified parameters. They can be
1233
useful for quick testing without having to modify an instance back and
1234
forth, e.g.::
1235

    
1236
    # gnt-instance start -H kernel_args="single" instance1
1237
    # gnt-instance start -B maxmem=2048 instance2
1238

    
1239

    
1240
The first form will start the instance instance1 in single-user mode,
1241
and the instance instance2 with 2GB of RAM (this time only, unless
1242
that is the actual instance memory size already). Note that the values
1243
override the instance parameters (and not extend them): an instance
1244
with "kernel\_args=ro" when started with -H kernel\_args=single will
1245
result in "single", not "ro single".
1246

    
1247
The ``--paused`` option is only valid for Xen and kvm hypervisors.  This
1248
pauses the instance at the start of bootup, awaiting ``gnt-instance
1249
console`` to unpause it, allowing the entire boot process to be
1250
monitored for debugging.
1251

    
1252
See **ganeti**\(7) for a description of ``--submit`` and other common
1253
options.
1254

    
1255
Example::
1256

    
1257
    # gnt-instance start instance1.example.com
1258
    # gnt-instance start --node node1.example.com node2.example.com
1259
    # gnt-instance start --all
1260

    
1261

    
1262
SHUTDOWN
1263
^^^^^^^^
1264

    
1265
| **shutdown**
1266
| [\--timeout=*N*]
1267
| [\--force] [\--force-multiple] [\--ignore-offline] [\--no-remember]
1268
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1269
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1270
| [\--submit]
1271
| {*name*...}
1272

    
1273
Stops one or more instances. If the instance cannot be cleanly stopped
1274
during a hardcoded interval (currently 2 minutes), it will forcibly
1275
stop the instance (equivalent to switching off the power on a physical
1276
machine).
1277

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

    
1283
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1284
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1285
``--sec-node-tags`` options are similar as for the **startup** command
1286
and they influence the actual instances being shutdown.
1287

    
1288
``--ignore-offline`` can be used to ignore offline primary nodes and
1289
force the instance to be marked as stopped. This option should be used
1290
with care as it can lead to an inconsistent cluster state.
1291

    
1292
Use ``--force`` to be able to shutdown an instance even when it's marked
1293
as offline. This is useful is an offline instance ends up in the
1294
``ERROR_up`` state, for example.
1295

    
1296
The ``--no-remember`` option will perform the shutdown but not change
1297
the state of the instance in the configuration file (if it was running
1298
before, Ganeti will still thinks it needs to be running). This can be
1299
useful for a cluster-wide shutdown, where some instances are marked as
1300
up and some as down, and you don't want to change the running state:
1301
you just need to disable the watcher, shutdown all instances with
1302
``--no-remember``, and when the watcher is activated again it will
1303
restore the correct runtime state for all instances.
1304

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

    
1308
Example::
1309

    
1310
    # gnt-instance shutdown instance1.example.com
1311
    # gnt-instance shutdown --all
1312

    
1313

    
1314
REBOOT
1315
^^^^^^
1316

    
1317
| **reboot**
1318
| [{-t|\--type} *REBOOT-TYPE*]
1319
| [\--ignore-secondaries]
1320
| [\--shutdown-timeout=*N*]
1321
| [\--force-multiple]
1322
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1323
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1324
| [\--submit]
1325
| [*name*...]
1326

    
1327
Reboots one or more instances. The type of reboot depends on the value
1328
of ``-t (--type)``. A soft reboot does a hypervisor reboot, a hard reboot
1329
does a instance stop, recreates the hypervisor config for the instance
1330
and starts the instance. A full reboot does the equivalent of
1331
**gnt-instance shutdown && gnt-instance startup**.  The default is
1332
hard reboot.
1333

    
1334
For the hard reboot the option ``--ignore-secondaries`` ignores errors
1335
for the secondary node while re-assembling the instance disks.
1336

    
1337
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1338
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1339
``--sec-node-tags`` options are similar as for the **startup** command
1340
and they influence the actual instances being rebooted.
1341

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

    
1347
The ``--force-multiple`` will skip the interactive confirmation in the
1348
case the more than one instance will be affected.
1349

    
1350
See **ganeti**\(7) for a description of ``--submit`` and other common
1351
options.
1352

    
1353
Example::
1354

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

    
1358

    
1359
CONSOLE
1360
^^^^^^^
1361

    
1362
**console** [\--show-cmd] {*instance*}
1363

    
1364
Connects to the console of the given instance. If the instance is not
1365
up, an error is returned. Use the ``--show-cmd`` option to display the
1366
command instead of executing it.
1367

    
1368
For HVM instances, this will attempt to connect to the serial console
1369
of the instance. To connect to the virtualized "physical" console of a
1370
HVM instance, use a VNC client with the connection info from the
1371
**info** command.
1372

    
1373
For Xen/kvm instances, if the instance is paused, this attempts to
1374
unpause the instance after waiting a few seconds for the connection to
1375
the console to be made.
1376

    
1377
Example::
1378

    
1379
    # gnt-instance console instance1.example.com
1380

    
1381

    
1382
Disk management
1383
~~~~~~~~~~~~~~~
1384

    
1385
REPLACE-DISKS
1386
^^^^^^^^^^^^^
1387

    
1388
**replace-disks** [\--submit] [\--early-release] [\--ignore-ipolicy] {-p}
1389
[\--disks *idx*] {*instance*}
1390

    
1391
**replace-disks** [\--submit] [\--early-release] [\--ignore-ipolicy] {-s}
1392
[\--disks *idx*] {*instance*}
1393

    
1394
**replace-disks** [\--submit] [\--early-release] [\--ignore-ipolicy]
1395
{{-I\|\--iallocator} *name* \| {{-n|\--new-secondary} *node* } {*instance*}
1396

    
1397
**replace-disks** [\--submit] [\--early-release] [\--ignore-ipolicy]
1398
{-a\|\--auto} {*instance*}
1399

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

    
1403
The first form (when passing the ``-p`` option) will replace the disks
1404
on the primary, while the second form (when passing the ``-s`` option
1405
will replace the disks on the secondary node. For these two cases (as
1406
the node doesn't change), it is possible to only run the replace for a
1407
subset of the disks, using the option ``--disks`` which takes a list
1408
of comma-delimited disk indices (zero-based), e.g. 0,2 to replace only
1409
the first and third disks.
1410

    
1411
The third form (when passing either the ``--iallocator`` or the
1412
``--new-secondary`` option) is designed to change secondary node of the
1413
instance. Specifying ``--iallocator`` makes the new secondary be
1414
selected automatically by the specified allocator plugin (use ``.`` to
1415
indicate the default allocator), otherwise the new secondary node will
1416
be the one chosen manually via the ``--new-secondary`` option.
1417

    
1418
Note that it is not possible to select an offline or drained node as a
1419
new secondary.
1420

    
1421
The fourth form (when using ``--auto``) will automatically determine
1422
which disks of an instance are faulty and replace them within the same
1423
node. The ``--auto`` option works only when an instance has only
1424
faulty disks on either the primary or secondary node; it doesn't work
1425
when both sides have faulty disks.
1426

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

    
1436
The ``--ignore-ipolicy`` let the command ignore instance policy
1437
violations if replace-disks changes groups and the instance would
1438
violate the new groups instance policy.
1439

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

    
1443
ACTIVATE-DISKS
1444
^^^^^^^^^^^^^^
1445

    
1446
**activate-disks** [\--submit] [\--ignore-size] [\--wait-for-sync] {*instance*}
1447

    
1448
Activates the block devices of the given instance. If successful, the
1449
command will show the location and name of the block devices::
1450

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

    
1454

    
1455
In this example, *node1.example.com* is the name of the node on which
1456
the devices have been activated. The *disk/0* and *disk/1* are the
1457
Ganeti-names of the instance disks; how they are visible inside the
1458
instance is hypervisor-specific. */dev/drbd0* and */dev/drbd1* are the
1459
actual block devices as visible on the node.
1460

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

    
1468
The ``--wait-for-sync`` option will ensure that the command returns only
1469
after the instance's disks are synchronised (mostly for DRBD); this can
1470
be useful to ensure consistency, as otherwise there are no commands that
1471
can wait until synchronisation is done. However when passing this
1472
option, the command will have additional output, making it harder to
1473
parse the disk information.
1474

    
1475
Note that it is safe to run this command while the instance is already
1476
running.
1477

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

    
1481
DEACTIVATE-DISKS
1482
^^^^^^^^^^^^^^^^
1483

    
1484
**deactivate-disks** [-f] [\--submit] {*instance*}
1485

    
1486
De-activates the block devices of the given instance. Note that if you
1487
run this command for an instance with a drbd disk template, while it
1488
is running, it will not be able to shutdown the block devices on the
1489
primary node, but it will shutdown the block devices on the secondary
1490
nodes, thus breaking the replication.
1491

    
1492
The ``-f``/``--force`` option will skip checks that the instance is
1493
down; in case the hypervisor is confused and we can't talk to it,
1494
normally Ganeti will refuse to deactivate the disks, but with this
1495
option passed it will skip this check and directly try to deactivate
1496
the disks. This can still fail due to the instance actually running or
1497
other issues.
1498

    
1499
See **ganeti**\(7) for a description of ``--submit`` and other common
1500
options.
1501

    
1502
GROW-DISK
1503
^^^^^^^^^
1504

    
1505
| **grow-disk** [\--no-wait-for-sync] [\--submit] [\--absolute]
1506
| {*instance*} {*disk*} {*amount*}
1507

    
1508
Grows an instance's disk. This is only possible for instances having a
1509
plain, drbd, file, sharedfile, rbd or ext disk template. For the ext
1510
template to work, the ExtStorage provider should also support growing.
1511
This means having a ``grow`` script that actually grows the volume of
1512
the external shared storage.
1513

    
1514
Note that this command only change the block device size; it will not
1515
grow the actual filesystems, partitions, etc. that live on that
1516
disk. Usually, you will need to:
1517

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

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

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

    
1526
The *disk* argument is the index of the instance disk to grow. The
1527
*amount* argument is given as a number which can have a suffix (like the
1528
disk size in instance create); if the suffix is missing, the value will
1529
be interpreted as mebibytes.
1530

    
1531
By default, the *amount* value represents the desired increase in the
1532
disk size (e.g. an amount of 1G will take a disk of size 3G to 4G). If
1533
the optional ``--absolute`` parameter is passed, then the *amount*
1534
argument doesn't represent the delta, but instead the desired final disk
1535
size (e.g. an amount of 8G will take a disk of size 4G to 8G).
1536

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

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

    
1545
See **ganeti**\(7) for a description of ``--submit`` and other common
1546
options.
1547

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

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

    
1552
Example for increasing the disk size to a certain size::
1553

    
1554
   # gnt-instance grow-disk --absolute instance1.example.com 0 32g
1555

    
1556
Also note that disk shrinking is not supported; use **gnt-backup
1557
export** and then **gnt-backup import** to reduce the disk size of an
1558
instance.
1559

    
1560
RECREATE-DISKS
1561
^^^^^^^^^^^^^^
1562

    
1563
| **recreate-disks** [\--submit]
1564
| [{-n node1:[node2] \| {-I\|\--iallocator *name*}}]
1565
| [\--disk=*N*[:[size=*VAL*][,mode=*ro\|rw*]]] {*instance*}
1566

    
1567
Recreates all or a subset of disks of the given instance.
1568

    
1569
Note that this functionality should only be used for missing disks; if
1570
any of the given disks already exists, the operation will fail.  While
1571
this is suboptimal, recreate-disks should hopefully not be needed in
1572
normal operation and as such the impact of this is low.
1573

    
1574
If only a subset should be recreated, any number of ``disk`` options can
1575
be specified. It expects a disk index and an optional list of disk
1576
parameters to change. Only ``size`` and ``mode`` can be changed while
1577
recreating disks. To recreate all disks while changing parameters on
1578
a subset only, a ``--disk`` option must be given for every disk of the
1579
instance.
1580

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

    
1590
Another method of choosing which nodes to place the instance on is by
1591
using the specified iallocator, passing the ``--iallocator`` option.
1592
The primary and secondary nodes will be chosen by the specified
1593
iallocator plugin, or by the default allocator if ``.`` is specified.
1594

    
1595
See **ganeti**\(7) for a description of ``--submit`` and other common
1596
options.
1597

    
1598
Recovery/moving
1599
~~~~~~~~~~~~~~~
1600

    
1601
FAILOVER
1602
^^^^^^^^
1603

    
1604
| **failover** [-f] [\--ignore-consistency] [\--ignore-ipolicy]
1605
| [\--shutdown-timeout=*N*]
1606
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*]
1607
| [\--submit]
1608
| {*instance*}
1609

    
1610
Failover will stop the instance (if running), change its primary node,
1611
and if it was originally running it will start it again (on the new
1612
primary). This works for instances with drbd template (in which case you
1613
can only fail to the secondary node) and for externally mirrored
1614
templates (sharedfile, blockdev, rbd and ext) (in which case you can
1615
fail to any other node).
1616

    
1617
If the instance's disk template is of type sharedfile, blockdev, rbd or
1618
ext, then you can explicitly specify the target node (which can be any
1619
node) using the ``-n`` or ``--target-node`` option, or specify an
1620
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1621
omit both, the default iallocator will be used to specify the target
1622
node.
1623

    
1624
If the instance's disk template is of type drbd, the target node is
1625
automatically selected as the drbd's secondary node. Changing the
1626
secondary node is possible with a replace-disks operation.
1627

    
1628
Normally the failover will check the consistency of the disks before
1629
failing over the instance. If you are trying to migrate instances off
1630
a dead node, this will fail. Use the ``--ignore-consistency`` option
1631
for this purpose. Note that this option can be dangerous as errors in
1632
shutting down the instance will be ignored, resulting in possibly
1633
having the instance running on two machines in parallel (on
1634
disconnected DRBD drives).
1635

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

    
1641
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1642
during this operation are ignored.
1643

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

    
1647
Example::
1648

    
1649
    # gnt-instance failover instance1.example.com
1650

    
1651
For externally mirrored templates also ``-n`` is available::
1652

    
1653
    # gnt-instance failover -n node3.example.com instance1.example.com
1654

    
1655

    
1656
MIGRATE
1657
^^^^^^^
1658

    
1659
| **migrate** [-f] [\--allow-failover] [\--non-live]
1660
| [\--migration-mode=live\|non-live] [\--ignore-ipolicy]
1661
| [\--no-runtime-changes] [\--submit]
1662
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*] {*instance*}
1663

    
1664
| **migrate** [-f] \--cleanup [\--submit] {*instance*}
1665

    
1666
Migrate will move the instance to its secondary node without shutdown.
1667
As with failover, it works for instances having the drbd disk template
1668
or an externally mirrored disk template type such as sharedfile,
1669
blockdev, rbd or ext.
1670

    
1671
If the instance's disk template is of type sharedfile, blockdev, rbd or
1672
ext, then you can explicitly specify the target node (which can be any
1673
node) using the ``-n`` or ``--target-node`` option, or specify an
1674
iallocator plugin using the ``-I`` or ``--iallocator`` option. If you
1675
omit both, the default iallocator will be used to specify the target
1676
node.  Alternatively, the default iallocator can be requested by
1677
specifying ``.`` as the name of the plugin.
1678

    
1679
If the instance's disk template is of type drbd, the target node is
1680
automatically selected as the drbd's secondary node. Changing the
1681
secondary node is possible with a replace-disks operation.
1682

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

    
1687
The ``--non-live`` and ``--migration-mode=non-live`` options will
1688
switch (for the hypervisors that support it) between a "fully live"
1689
(i.e. the interruption is as minimal as possible) migration and one in
1690
which the instance is frozen, its state saved and transported to the
1691
remote node, and then resumed there. This all depends on the
1692
hypervisor support for two different methods. In any case, it is not
1693
an error to pass this parameter (it will just be ignored if the
1694
hypervisor doesn't support it). The option ``--migration-mode=live``
1695
option will request a fully-live migration. The default, when neither
1696
option is passed, depends on the hypervisor parameters (and can be
1697
viewed with the **gnt-cluster info** command).
1698

    
1699
If the ``--cleanup`` option is passed, the operation changes from
1700
migration to attempting recovery from a failed previous migration. In
1701
this mode, Ganeti checks if the instance runs on the correct node (and
1702
updates its configuration if not) and ensures the instances' disks
1703
are configured correctly. In this mode, the ``--non-live`` option is
1704
ignored.
1705

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

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

    
1713
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1714
during this operation are ignored.
1715

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

    
1720
If an instance has the backend parameter ``always_failover`` set to
1721
true, then the migration is automatically converted into a failover.
1722

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

    
1726
Example (and expected output)::
1727

    
1728
    # gnt-instance migrate instance1
1729
    Instance instance1 will be migrated. Note that migration
1730
    might impact the instance if anything goes wrong (e.g. due to bugs in
1731
    the hypervisor). Continue?
1732
    y/[n]/?: y
1733
    Migrating instance instance1.example.com
1734
    * checking disk consistency between source and target
1735
    * switching node node2.example.com to secondary mode
1736
    * changing into standalone mode
1737
    * changing disks into dual-master mode
1738
    * wait until resync is done
1739
    * preparing node2.example.com to accept the instance
1740
    * migrating instance to node2.example.com
1741
    * switching node node1.example.com to secondary mode
1742
    * wait until resync is done
1743
    * changing into standalone mode
1744
    * changing disks into single-master mode
1745
    * wait until resync is done
1746
    * done
1747
    #
1748

    
1749

    
1750
MOVE
1751
^^^^
1752

    
1753
| **move** [-f] [\--ignore-consistency]
1754
| [-n *node*] [\--shutdown-timeout=*N*] [\--submit] [\--ignore-ipolicy]
1755
| {*instance*}
1756

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

    
1760
Note that since this operation is done via data copy, it will take a
1761
long time for big disks (similar to replace-disks for a drbd
1762
instance).
1763

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

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

    
1773
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1774
during this operation are ignored.
1775

    
1776
See **ganeti**\(7) for a description of ``--submit`` and other common
1777
options.
1778

    
1779
Example::
1780

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

    
1783

    
1784
CHANGE-GROUP
1785
^^^^^^^^^^^^
1786

    
1787
| **change-group** [\--submit]
1788
| [\--iallocator *NAME*] [\--to *GROUP*...] {*instance*}
1789

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

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

    
1797
See **ganeti**\(7) for a description of ``--submit`` and other common
1798
options.
1799

    
1800
Example::
1801

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

    
1804

    
1805
Tags
1806
~~~~
1807

    
1808
ADD-TAGS
1809
^^^^^^^^
1810

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

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

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

    
1822
LIST-TAGS
1823
^^^^^^^^^
1824

    
1825
**list-tags** {*instancename*}
1826

    
1827
List the tags of the given instance.
1828

    
1829
REMOVE-TAGS
1830
^^^^^^^^^^^
1831

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

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

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

    
1843
.. vim: set textwidth=72 :
1844
.. Local Variables:
1845
.. mode: rst
1846
.. fill-column: 72
1847
.. End: