Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.rst @ 0d57ce24

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

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

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

    
60
When using the ``adopt`` key in the disk definition, Ganeti will
61
reuse those volumes (instead of creating new ones) as the
62
instance's disks. Ganeti will rename these volumes to the standard
63
format, and (without installing the OS) will use them as-is for the
64
instance. This allows migrating instances from non-managed mode
65
(e.g. plain KVM with LVM) to being managed via Ganeti. Please note that
66
this works only for the \`plain' disk template (see below for
67
template details).
68

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

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

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

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

    
87
If you don't want the instance to automatically start after
88
creation, this is possible via the ``--no-start`` option. This will
89
leave the instance down until a subsequent **gnt-instance start**
90
command.
91

    
92
The NICs of the instances can be specified via the ``--net``
93
option. By default, one NIC is created for the instance, with a
94
random MAC, and set up according the the cluster level nic
95
parameters. Each NIC can take these parameters (all optional):
96

    
97
mac
98
    either a value or 'generate' to generate a new unique MAC
99

    
100
ip
101
    specifies the IP address assigned to the instance from the Ganeti
102
    side (this is not necessarily what the instance will use, but what
103
    the node expects the instance to use)
104

    
105
mode
106
    specifies the connection mode for this nic: routed, bridged or
107
    openvswitch.
108

    
109
link
110
    in bridged or openvswitch mode specifies the interface to attach
111
    this NIC to, in routed mode it's intended to differentiate between
112
    different routing tables/instance groups (but the meaning is
113
    dependent on the network script, see gnt-cluster(8) for more
114
    details). Note that openvswitch support is also hypervisor
115
    dependent.
116

    
117

    
118
Of these "mode" and "link" are nic parameters, and inherit their
119
default at cluster level.  Alternatively, if no network is desired for
120
the instance, you can prevent the default of one NIC with the
121
``--no-nics`` option.
122

    
123
The ``-o (--os-type)`` option specifies the operating system to be
124
installed.  The available operating systems can be listed with
125
**gnt-os list**.  Passing ``--no-install`` will however skip the OS
126
installation, allowing a manual import if so desired. Note that the
127
no-installation mode will automatically disable the start-up of the
128
instance (without an OS, it most likely won't be able to start-up
129
successfully).
130

    
131
The ``-B (--backend-parameters)`` option specifies the backend
132
parameters for the instance. If no such parameters are specified, the
133
values are inherited from the cluster. Possible parameters are:
134

    
135
maxmem
136
    the maximum memory size of the instance; as usual, suffixes can be
137
    used to denote the unit, otherwise the value is taken in mebibytes
138

    
139
minmem
140
    the minimum memory size of the instance; as usual, suffixes can be
141
    used to denote the unit, otherwise the value is taken in mebibytes
142

    
143
vcpus
144
    the number of VCPUs to assign to the instance (if this value makes
145
    sense for the hypervisor)
146

    
147
auto\_balance
148
    whether the instance is considered in the N+1 cluster checks
149
    (enough redundancy in the cluster to survive a node failure)
150

    
151
always\_failover
152
    ``True`` or ``False``, whether the instance must be failed over
153
    (shut down and rebooted) always or it may be migrated (briefly
154
    suspended)
155

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

    
162
The ``-H (--hypervisor-parameters)`` option specified the hypervisor
163
to use for the instance (must be one of the enabled hypervisors on the
164
cluster) and optionally custom parameters for this instance. If not
165
other options are used (i.e. the invocation is just -H *NAME*) the
166
instance will inherit the cluster options. The defaults below show the
167
cluster defaults at cluster creation time.
168

    
169
The possible hypervisor options are as follows:
170

    
171
boot\_order
172
    Valid for the Xen HVM and KVM hypervisors.
173

    
174
    A string value denoting the boot order. This has different meaning
175
    for the Xen HVM hypervisor and for the KVM one.
176

    
177
    For Xen HVM, The boot order is a string of letters listing the boot
178
    devices, with valid device letters being:
179

    
180
    a
181
        floppy drive
182

    
183
    c
184
        hard disk
185

    
186
    d
187
        CDROM drive
188

    
189
    n
190
        network boot (PXE)
191

    
192
    The default is not to set an HVM boot order, which is interpreted
193
    as 'dc'.
194

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

    
202
blockdev\_prefix
203
    Valid for the Xen HVM and PVM hypervisors.
204

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

    
209
floppy\_image\_path
210
    Valid for the KVM hypervisor.
211

    
212
    The path to a floppy disk image to attach to the instance.  This
213
    is useful to install Windows operating systems on Virt/IO disks
214
    because you can specify here the floppy for the drivers at
215
    installation time.
216

    
217
cdrom\_image\_path
218
    Valid for the Xen HVM and KVM hypervisors.
219

    
220
    The path to a CDROM image to attach to the instance.
221

    
222
cdrom2\_image\_path
223
    Valid for the KVM hypervisor.
224

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

    
229
nic\_type
230
    Valid for the Xen HVM and KVM hypervisors.
231

    
232
    This parameter determines the way the network cards are presented
233
    to the instance. The possible options are:
234

    
235
    - rtl8139 (default for Xen HVM) (HVM & KVM)
236
    - ne2k\_isa (HVM & KVM)
237
    - ne2k\_pci (HVM & KVM)
238
    - i82551 (KVM)
239
    - i82557b (KVM)
240
    - i82559er (KVM)
241
    - pcnet (KVM)
242
    - e1000 (KVM)
243
    - paravirtual (default for KVM) (HVM & KVM)
244

    
245
disk\_type
246
    Valid for the Xen HVM and KVM hypervisors.
247

    
248
    This parameter determines the way the disks are presented to the
249
    instance. The possible options are:
250

    
251
    - ioemu [default] (HVM & KVM)
252
    - ide (HVM & KVM)
253
    - scsi (KVM)
254
    - sd (KVM)
255
    - mtd (KVM)
256
    - pflash (KVM)
257

    
258

    
259
cdrom\_disk\_type
260
    Valid for the KVM hypervisor.
261

    
262
    This parameter determines the way the cdroms disks are presented
263
    to the instance. The default behavior is to get the same value of
264
    the earlier parameter (disk_type). The possible options are:
265

    
266
    - paravirtual
267
    - ide
268
    - scsi
269
    - sd
270
    - mtd
271
    - pflash
272

    
273

    
274
vnc\_bind\_address
275
    Valid for the Xen HVM and KVM hypervisors.
276

    
277
    Specifies the address that the VNC listener for this instance
278
    should bind to. Valid values are IPv4 addresses. Use the address
279
    0.0.0.0 to bind to all available interfaces (this is the default)
280
    or specify the address of one of the interfaces on the node to
281
    restrict listening to that interface.
282

    
283
vnc\_tls
284
    Valid for the KVM hypervisor.
285

    
286
    A boolean option that controls whether the VNC connection is
287
    secured with TLS.
288

    
289
vnc\_x509\_path
290
    Valid for the KVM hypervisor.
291

    
292
    If ``vnc_tls`` is enabled, this options specifies the path to the
293
    x509 certificate to use.
294

    
295
vnc\_x509\_verify
296
    Valid for the KVM hypervisor.
297

    
298
spice\_bind
299
    Valid for the KVM hypervisor.
300

    
301
    Specifies the address or interface on which the SPICE server will
302
    listen. Valid values are:
303

    
304
    - IPv4 addresses, including 0.0.0.0 and 127.0.0.1
305
    - IPv6 addresses, including :: and ::1
306
    - names of network interfaces
307

    
308
    If a network interface is specified, the SPICE server will be bound
309
    to one of the addresses of that interface.
310

    
311
spice\_ip\_version
312
    Valid for the KVM hypervisor.
313

    
314
    Specifies which version of the IP protocol should be used by the
315
    SPICE server.
316

    
317
    It is mainly intended to be used for specifying what kind of IP
318
    addresses should be used if a network interface with both IPv4 and
319
    IPv6 addresses is specified via the ``spice_bind`` parameter. In
320
    this case, if the ``spice_ip_version`` parameter is not used, the
321
    default IP version of the cluster will be used.
322

    
323
spice\_password\_file
324
    Valid for the KVM hypervisor.
325

    
326
    Specifies a file containing the password that must be used when
327
    connecting via the SPICE protocol. If the option is not specified,
328
    passwordless connections are allowed.
329

    
330
spice\_image\_compression
331
    Valid for the KVM hypervisor.
332

    
333
    Configures the SPICE lossless image compression. Valid values are:
334

    
335
    - auto_glz
336
    - auto_lz
337
    - quic
338
    - glz
339
    - lz
340
    - off
341

    
342
spice\_jpeg\_wan\_compression
343
    Valid for the KVM hypervisor.
344

    
345
    Configures how SPICE should use the jpeg algorithm for lossy image
346
    compression on slow links. Valid values are:
347

    
348
    - auto
349
    - never
350
    - always
351

    
352
spice\_zlib\_glz\_wan\_compression
353
    Valid for the KVM hypervisor.
354

    
355
    Configures how SPICE should use the zlib-glz algorithm for lossy image
356
    compression on slow links. Valid values are:
357

    
358
    - auto
359
    - never
360
    - always
361

    
362
spice\_streaming\_video
363
    Valid for the KVM hypervisor.
364

    
365
    Configures how SPICE should detect video streams. Valid values are:
366

    
367
    - off
368
    - all
369
    - filter
370

    
371
spice\_playback\_compression
372
    Valid for the KVM hypervisor.
373

    
374
    Configures whether SPICE should compress audio streams or not.
375

    
376
spice\_use\_tls
377
    Valid for the KVM hypervisor.
378

    
379
    Specifies that the SPICE server must use TLS to encrypt all the
380
    traffic with the client.
381

    
382
spice\_tls\_ciphers
383
    Valid for the KVM hypervisor.
384

    
385
    Specifies a list of comma-separated ciphers that SPICE should use
386
    for TLS connections. For the format, see man cipher(1).
387

    
388
spice\_use\_vdagent
389
    Valid for the KVM hypervisor.
390

    
391
    Enables or disables passing mouse events via SPICE vdagent.
392

    
393
cpu\_type
394
    Valid for the KVM hypervisor.
395

    
396
    This parameter determines the emulated cpu for the instance. If this
397
    parameter is empty (which is the default configuration), it will not
398
    be passed to KVM.
399

    
400
    Be aware of setting this parameter to ``"host"`` if you have nodes
401
    with different CPUs from each other. Live migration may stop working
402
    in this situation.
403

    
404
    For more information please refer to the KVM manual.
405

    
406
acpi
407
    Valid for the Xen HVM and KVM hypervisors.
408

    
409
    A boolean option that specifies if the hypervisor should enable
410
    ACPI support for this instance. By default, ACPI is disabled.
411

    
412
pae
413
    Valid for the Xen HVM and KVM hypervisors.
414

    
415
    A boolean option that specifies if the hypervisor should enabled
416
    PAE support for this instance. The default is false, disabling PAE
417
    support.
418

    
419
use\_localtime
420
    Valid for the Xen HVM and KVM hypervisors.
421

    
422
    A boolean option that specifies if the instance should be started
423
    with its clock set to the localtime of the machine (when true) or
424
    to the UTC (When false). The default is false, which is useful for
425
    Linux/Unix machines; for Windows OSes, it is recommended to enable
426
    this parameter.
427

    
428
kernel\_path
429
    Valid for the Xen PVM and KVM hypervisors.
430

    
431
    This option specifies the path (on the node) to the kernel to boot
432
    the instance with. Xen PVM instances always require this, while for
433
    KVM if this option is empty, it will cause the machine to load the
434
    kernel from its disks (and the boot will be done accordingly to
435
    ``boot_order``).
436

    
437
kernel\_args
438
    Valid for the Xen PVM and KVM hypervisors.
439

    
440
    This options specifies extra arguments to the kernel that will be
441
    loaded. device. This is always used for Xen PVM, while for KVM it
442
    is only used if the ``kernel_path`` option is also specified.
443

    
444
    The default setting for this value is simply ``"ro"``, which
445
    mounts the root disk (initially) in read-only one. For example,
446
    setting this to single will cause the instance to start in
447
    single-user mode.
448

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

    
452
    This option specifies the path (on the node) to the initrd to boot
453
    the instance with. Xen PVM instances can use this always, while
454
    for KVM if this option is only used if the ``kernel_path`` option
455
    is also specified. You can pass here either an absolute filename
456
    (the path to the initrd) if you want to use an initrd, or use the
457
    format no\_initrd\_path for no initrd.
458

    
459
root\_path
460
    Valid for the Xen PVM and KVM hypervisors.
461

    
462
    This options specifies the name of the root device. This is always
463
    needed for Xen PVM, while for KVM it is only used if the
464
    ``kernel_path`` option is also specified.
465

    
466
    Please note, that if this setting is an empty string and the
467
    hypervisor is Xen it will not be written to the Xen configuration
468
    file
469

    
470
serial\_console
471
    Valid for the KVM hypervisor.
472

    
473
    This boolean option specifies whether to emulate a serial console
474
    for the instance.
475

    
476
disk\_cache
477
    Valid for the KVM hypervisor.
478

    
479
    The disk cache mode. It can be either default to not pass any
480
    cache option to KVM, or one of the KVM cache modes: none (for
481
    direct I/O), writethrough (to use the host cache but report
482
    completion to the guest only when the host has committed the
483
    changes to disk) or writeback (to use the host cache and report
484
    completion as soon as the data is in the host cache). Note that
485
    there are special considerations for the cache mode depending on
486
    version of KVM used and disk type (always raw file under Ganeti),
487
    please refer to the KVM documentation for more details.
488

    
489
security\_model
490
    Valid for the KVM hypervisor.
491

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

    
496
    Under *user* kvm will drop privileges and become the user
497
    specified by the security\_domain parameter.
498

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

    
503
security\_domain
504
    Valid for the KVM hypervisor.
505

    
506
    Under security model *user* the username to run the instance
507
    under.  It must be a valid username existing on the host.
508

    
509
    Cannot be set under security model *none* or *pool*.
510

    
511
kvm\_flag
512
    Valid for the KVM hypervisor.
513

    
514
    If *enabled* the -enable-kvm flag is passed to kvm. If *disabled*
515
    -disable-kvm is passed. If unset no flag is passed, and the
516
    default running mode for your kvm binary will be used.
517

    
518
mem\_path
519
    Valid for the KVM hypervisor.
520

    
521
    This option passes the -mem-path argument to kvm with the path (on
522
    the node) to the mount point of the hugetlbfs file system, along
523
    with the -mem-prealloc argument too.
524

    
525
use\_chroot
526
    Valid for the KVM hypervisor.
527

    
528
    This boolean option determines whether to run the KVM instance in a
529
    chroot directory.
530

    
531
    If it is set to ``true``, an empty directory is created before
532
    starting the instance and its path is passed via the -chroot flag
533
    to kvm. The directory is removed when the instance is stopped.
534

    
535
    It is set to ``false`` by default.
536

    
537
migration\_downtime
538
    Valid for the KVM hypervisor.
539

    
540
    The maximum amount of time (in ms) a KVM instance is allowed to be
541
    frozen during a live migration, in order to copy dirty memory
542
    pages. Default value is 30ms, but you may need to increase this
543
    value for busy instances.
544

    
545
    This option is only effective with kvm versions >= 87 and qemu-kvm
546
    versions >= 0.11.0.
547

    
548
cpu\_mask
549
    Valid for the Xen, KVM and LXC hypervisors.
550

    
551
    The processes belonging to the given instance are only scheduled
552
    on the specified CPUs.
553

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

    
558
    Second, a comma-separated list of CPU IDs or CPU ID ranges. The
559
    ranges are defined by a lower and higher boundary, separated by a
560
    dash, and the boundaries are inclusive. In this form, all VCPUs of
561
    the instance will be mapped on the selected list of CPUs. Example:
562
    ``0-2,5``, mapping all VCPUs (no matter how many) onto physical CPUs
563
    0, 1, 2 and 5.
564

    
565
    The last form is used for explicit control of VCPU-CPU pinnings. In
566
    this form, the list of VCPU mappings is given as a colon (:)
567
    separated list, whose elements are the possible values for the
568
    second or first form above. In this form, the number of elements in
569
    the colon-separated list _must_ equal the number of VCPUs of the
570
    instance.
571

    
572
    Example:
573

    
574
    .. code-block:: Bash
575

    
576
      # Map the entire instance to CPUs 0-2
577
      gnt-instance modify -H cpu_mask=0-2 my-inst
578

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

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

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

    
589
      # Pin entire VM to CPU 0
590
      gnt-instance modify -H cpu_mask=0 my-inst
591

    
592
      # Turn off CPU pinning (default setting)
593
      gnt-instance modify -H cpu_mask=all my-inst
594

    
595
cpu\_cap
596
    Valid for the Xen hypervisor.
597

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

    
601
cpu\_weight
602
    Valid for the Xen hypervisor.
603

    
604
    Set the cpu time ratio to be allocated to the VM. Valid values are
605
    between 1 and 65535. Default weight is 256.
606

    
607
usb\_mouse
608
    Valid for the KVM hypervisor.
609

    
610
    This option specifies the usb mouse type to be used. It can be
611
    "mouse" or "tablet". When using VNC it's recommended to set it to
612
    "tablet".
613

    
614
keymap
615
    Valid for the KVM hypervisor.
616

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

    
620
reboot\_behavior
621
    Valid for Xen PVM, Xen HVM and KVM hypervisors.
622

    
623
    Normally if an instance reboots, the hypervisor will restart it. If
624
    this option is set to ``exit``, the hypervisor will treat a reboot
625
    as a shutdown instead.
626

    
627
    It is set to ``reboot`` by default.
628

    
629

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

    
635
    gnt-instance add -O dhcp=yes ...
636

    
637
The ``-I (--iallocator)`` option specifies the instance allocator plugin
638
to use (``.`` means the default allocator). If you pass in this option
639
the allocator will select nodes for this instance automatically, so you
640
don't need to pass them with the ``-n`` option. For more information
641
please refer to the instance allocator documentation.
642

    
643
The ``-t (--disk-template)`` options specifies the disk layout type
644
for the instance.  The available choices are:
645

    
646
diskless
647
    This creates an instance with no disks. Its useful for testing only
648
    (or other special cases).
649

    
650
file
651
    Disk devices will be regular files.
652

    
653
plain
654
    Disk devices will be logical volumes.
655

    
656
drbd
657
    Disk devices will be drbd (version 8.x) on top of lvm volumes.
658

    
659
rbd
660
    Disk devices will be rbd volumes residing inside a RADOS cluster.
661

    
662

    
663
The optional second value of the ``-n (--node)`` is used for the drbd
664
template type and specifies the remote node.
665

    
666
If you do not want gnt-instance to wait for the disk mirror to be
667
synced, use the ``--no-wait-for-sync`` option.
668

    
669
The ``--file-storage-dir`` specifies the relative path under the
670
cluster-wide file storage directory to store file-based disks. It is
671
useful for having different subdirectories for different
672
instances. The full path of the directory where the disk files are
673
stored will consist of cluster-wide file storage directory + optional
674
subdirectory + instance name. Example:
675
``@RPL_FILE_STORAGE_DIR@``*/mysubdir/instance1.example.com*. This
676
option is only relevant for instances using the file storage backend.
677

    
678
The ``--file-driver`` specifies the driver to use for file-based
679
disks. Note that currently these drivers work with the xen hypervisor
680
only. This option is only relevant for instances using the file
681
storage backend. The available choices are:
682

    
683
loop
684
    Kernel loopback driver. This driver uses loopback devices to
685
    access the filesystem within the file. However, running I/O
686
    intensive applications in your instance using the loop driver
687
    might result in slowdowns. Furthermore, if you use the loopback
688
    driver consider increasing the maximum amount of loopback devices
689
    (on most systems it's 8) using the max\_loop param.
690

    
691
blktap
692
    The blktap driver (for Xen hypervisors). In order to be able to
693
    use the blktap driver you should check if the 'blktapctrl' user
694
    space disk agent is running (usually automatically started via
695
    xend).  This user-level disk I/O interface has the advantage of
696
    better performance. Especially if you use a network file system
697
    (e.g. NFS) to store your instances this is the recommended choice.
698

    
699
If ``--ignore-ipolicy`` is given any instance policy violations occuring
700
during this operation are ignored.
701

    
702
See **ganeti(7)** for a description of ``--submit`` and other common
703
options.
704

    
705
Example::
706

    
707
    # gnt-instance add -t file --disk 0:size=30g -B maxmem=512 -o debian-etch \
708
      -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
709
    # gnt-instance add -t plain --disk 0:size=30g -B maxmem=1024,minmem=512 \
710
      -o debian-etch -n node1.example.com instance1.example.com
711
    # gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
712
      -B maxmem=512 -o debian-etch -n node1.example.com instance1.example.com
713
    # gnt-instance add -t drbd --disk 0:size=30g -B maxmem=512 -o debian-etch \
714
      -n node1.example.com:node2.example.com instance2.example.com
715

    
716

    
717
BATCH-CREATE
718
^^^^^^^^^^^^
719

    
720
**batch-create** {instances\_file.json}
721

    
722
This command (similar to the Ganeti 1.2 **batcher** tool) submits
723
multiple instance creation jobs based on a definition file. The
724
instance configurations do not encompass all the possible options for
725
the **add** command, but only a subset.
726

    
727
The instance file should be a valid-formed JSON file, containing a
728
dictionary with instance name and instance parameters. The accepted
729
parameters are:
730

    
731
disk\_size
732
    The size of the disks of the instance.
733

    
734
disk\_template
735
    The disk template to use for the instance, the same as in the
736
    **add** command.
737

    
738
backend
739
    A dictionary of backend parameters.
740

    
741
hypervisor
742
    A dictionary with a single key (the hypervisor name), and as value
743
    the hypervisor options. If not passed, the default hypervisor and
744
    hypervisor options will be inherited.
745

    
746
mac, ip, mode, link
747
    Specifications for the one NIC that will be created for the
748
    instance. 'bridge' is also accepted as a backwards compatible
749
    key.
750

    
751
nics
752
    List of nics that will be created for the instance. Each entry
753
    should be a dict, with mac, ip, mode and link as possible keys.
754
    Please don't provide the "mac, ip, mode, link" parent keys if you
755
    use this method for specifying nics.
756

    
757
primary\_node, secondary\_node
758
    The primary and optionally the secondary node to use for the
759
    instance (in case an iallocator script is not used).
760

    
761
iallocator
762
    Instead of specifying the nodes, an iallocator script can be used
763
    to automatically compute them.
764

    
765
start
766
    whether to start the instance
767

    
768
ip\_check
769
    Skip the check for already-in-use instance; see the description in
770
    the **add** command for details.
771

    
772
name\_check
773
    Skip the name check for instances; see the description in the
774
    **add** command for details.
775

    
776
file\_storage\_dir, file\_driver
777
    Configuration for the file disk type, see the **add** command for
778
    details.
779

    
780

    
781
A simple definition for one instance can be (with most of the
782
parameters taken from the cluster defaults)::
783

    
784
    {
785
      "instance3": {
786
        "template": "drbd",
787
        "os": "debootstrap",
788
        "disk_size": ["25G"],
789
        "iallocator": "dumb"
790
      },
791
      "instance5": {
792
        "template": "drbd",
793
        "os": "debootstrap",
794
        "disk_size": ["25G"],
795
        "iallocator": "dumb",
796
        "hypervisor": "xen-hvm",
797
        "hvparams": {"acpi": true},
798
        "backend": {"maxmem": 512, "minmem": 256}
799
      }
800
    }
801

    
802
The command will display the job id for each submitted instance, as
803
follows::
804

    
805
    # gnt-instance batch-create instances.json
806
    instance3: 11224
807
    instance5: 11225
808

    
809
REMOVE
810
^^^^^^
811

    
812
**remove** [\--ignore-failures] [\--shutdown-timeout=*N*] [\--submit]
813
[\--force] {*instance*}
814

    
815
Remove an instance. This will remove all data from the instance and
816
there is *no way back*. If you are not sure if you use an instance
817
again, use **shutdown** first and leave it in the shutdown state for a
818
while.
819

    
820
The ``--ignore-failures`` option will cause the removal to proceed
821
even in the presence of errors during the removal of the instance
822
(e.g. during the shutdown or the disk removal). If this option is not
823
given, the command will stop at the first error.
824

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

    
830
The ``--force`` option is used to skip the interactive confirmation.
831

    
832
See **ganeti(7)** for a description of ``--submit`` and other common
833
options.
834

    
835
Example::
836

    
837
    # gnt-instance remove instance1.example.com
838

    
839

    
840
LIST
841
^^^^
842

    
843
| **list**
844
| [\--no-headers] [\--separator=*SEPARATOR*] [\--units=*UNITS*] [-v]
845
| [{-o|\--output} *[+]FIELD,...*] [\--filter] [instance...]
846

    
847
Shows the currently configured instances with memory usage, disk
848
usage, the node they are running on, and their run status.
849

    
850
The ``--no-headers`` option will skip the initial header line. The
851
``--separator`` option takes an argument which denotes what will be
852
used between the output fields. Both these options are to help
853
scripting.
854

    
855
The units used to display the numeric values in the output varies,
856
depending on the options given. By default, the values will be
857
formatted in the most appropriate unit. If the ``--separator`` option
858
is given, then the values are shown in mebibytes to allow parsing by
859
scripts. In both cases, the ``--units`` option can be used to enforce
860
a given output unit.
861

    
862
The ``-v`` option activates verbose mode, which changes the display of
863
special field states (see **ganeti(7)**).
864

    
865
The ``-o (--output)`` option takes a comma-separated list of output
866
fields. The available fields and their meaning are:
867

    
868
@QUERY_FIELDS_INSTANCE@
869

    
870
If the value of the option starts with the character ``+``, the new
871
field(s) will be added to the default list. This allows one to quickly
872
see the default list plus a few other fields, instead of retyping the
873
entire list of fields.
874

    
875
There is a subtle grouping about the available output fields: all
876
fields except for ``oper_state``, ``oper_ram``, ``oper_vcpus`` and
877
``status`` are configuration value and not run-time values. So if you
878
don't select any of the these fields, the query will be satisfied
879
instantly from the cluster configuration, without having to ask the
880
remote nodes for the data. This can be helpful for big clusters when
881
you only want some data and it makes sense to specify a reduced set of
882
output fields.
883

    
884
If exactly one argument is given and it appears to be a query filter
885
(see **ganeti(7)**), the query result is filtered accordingly. For
886
ambiguous cases (e.g. a single field name as a filter) the ``--filter``
887
(``-F``) option forces the argument to be treated as a filter (e.g.
888
``gnt-instance list -F admin_state``).
889

    
890
The default output field list is: ``name``, ``os``, ``pnode``,
891
``admin_state``, ``oper_state``, ``oper_ram``.
892

    
893

    
894
LIST-FIELDS
895
~~~~~~~~~~~
896

    
897
**list-fields** [field...]
898

    
899
Lists available fields for instances.
900

    
901

    
902
INFO
903
^^^^
904

    
905
**info** [-s \| \--static] [\--roman] {\--all \| *instance*}
906

    
907
Show detailed information about the given instance(s). This is
908
different from **list** as it shows detailed data about the instance's
909
disks (especially useful for the drbd disk template).
910

    
911
If the option ``-s`` is used, only information available in the
912
configuration file is returned, without querying nodes, making the
913
operation faster.
914

    
915
Use the ``--all`` to get info about all instances, rather than
916
explicitly passing the ones you're interested in.
917

    
918
The ``--roman`` option can be used to cause envy among people who like
919
ancient cultures, but are stuck with non-latin-friendly cluster
920
virtualization technologies.
921

    
922
MODIFY
923
^^^^^^
924

    
925
| **modify**
926
| [{-H|\--hypervisor-parameters} *HYPERVISOR\_PARAMETERS*]
927
| [{-B|\--backend-parameters} *BACKEND\_PARAMETERS*]
928
| [{-m|\--runtime-memory} *SIZE*]
929
| [\--net add*[:options]* \| \--net [*N*:]remove \| \--net *N:options*]
930
| [\--disk add:size=*SIZE*[,vg=*VG*][,metavg=*VG*] \| \--disk [*N*:]remove \|
931
|  \--disk *N*:mode=*MODE*]
932
| [{-t|\--disk-template} plain | {-t|\--disk-template} drbd -n *new_secondary*] [\--no-wait-for-sync]
933
| [\--os-type=*OS* [\--force-variant]]
934
| [{-O|\--os-parameters} *param*=*value*... ]
935
| [\--offline \| \--online]
936
| [\--submit]
937
| [\--ignore-ipolicy]
938
| {*instance*}
939

    
940
Modifies the memory size, number of vcpus, ip address, MAC address
941
and/or nic parameters for an instance. It can also add and remove
942
disks and NICs to/from the instance. Note that you need to give at
943
least one of the arguments, otherwise the command complains.
944

    
945
The ``-H (--hypervisor-parameters)``, ``-B (--backend-parameters)``
946
and ``-O (--os-parameters)`` options specifies hypervisor, backend and
947
OS parameter options in the form of name=value[,...]. For details
948
which options can be specified, see the **add** command.
949

    
950
The ``-t (--disk-template)`` option will change the disk template of
951
the instance.  Currently only conversions between the plain and drbd
952
disk templates are supported, and the instance must be stopped before
953
attempting the conversion. When changing from the plain to the drbd
954
disk template, a new secondary node must be specified via the ``-n``
955
option. The option ``--no-wait-for-sync`` can be used when converting
956
to the ``drbd`` template in order to make the instance available for
957
startup before DRBD has finished resyncing.
958

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

    
963
The ``--disk add:size=``*SIZE* option adds a disk to the instance. The
964
optional ``vg=``*VG* option specifies an LVM volume group other than
965
the default volume group to create the disk on. For DRBD disks, the
966
``metavg=``*VG* option specifies the volume group for the metadata
967
device. ``--disk`` *N*``:add,size=``**SIZE** can be used to add a
968
disk at a specific index. The ``--disk remove`` option will remove the
969
last disk of the instance. Use ``--disk `` *N*``:remove`` to remove a
970
disk by its index. The ``--disk`` *N*``:mode=``*MODE* option will change
971
the mode of the Nth disk of the instance between read-only (``ro``) and
972
read-write (``rw``).
973

    
974
The ``--net add:``*options* and ``--net`` *N*``:add,``*options* option
975
will add a new network interface to the instance. The available options
976
are the same as in the **add** command (``mac``, ``ip``, ``link``,
977
``mode``). The ``--net remove`` will remove the last network interface
978
of the instance (``--net`` *N*``:remove`` for a specific index), while
979
the ``--net`` *N*``:``*options* option will change the parameters of the Nth
980
instance network interface.
981

    
982
The option ``-o (--os-type)`` will change the OS name for the instance
983
(without reinstallation). In case an OS variant is specified that is
984
not found, then by default the modification is refused, unless
985
``--force-variant`` is passed. An invalid OS will also be refused,
986
unless the ``--force`` option is given.
987

    
988
The ``--online`` and ``--offline`` options are used to transition an
989
instance into and out of the ``offline`` state. An instance can be
990
turned offline only if it was previously down. The ``--online`` option
991
fails if the instance was not in the ``offline`` state, otherwise it
992
changes instance's state to ``down``. These modifications take effect
993
immediately.
994

    
995
If ``--ignore-ipolicy`` is given any instance policy violations occuring
996
during this operation are ignored.
997

    
998
See **ganeti(7)** for a description of ``--submit`` and other common
999
options.
1000

    
1001
Most of the changes take effect at the next restart. If the instance is
1002
running, there is no effect on the instance.
1003

    
1004
REINSTALL
1005
^^^^^^^^^
1006

    
1007
| **reinstall** [{-o|\--os-type} *os-type*] [\--select-os] [-f *force*]
1008
| [\--force-multiple]
1009
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all]
1010
| [{-O|\--os-parameters} *OS\_PARAMETERS*] [\--submit] {*instance*...}
1011

    
1012
Reinstalls the operating system on the given instance(s). The
1013
instance(s) must be stopped when running this command. If the ``-o
1014
(--os-type)`` is specified, the operating system is changed.
1015

    
1016
The ``--select-os`` option switches to an interactive OS reinstall.
1017
The user is prompted to select the OS template from the list of
1018
available OS templates. OS parameters can be overridden using ``-O
1019
(--os-parameters)`` (more documentation for this option under the
1020
**add** command).
1021

    
1022
Since this is a potentially dangerous command, the user will be
1023
required to confirm this action, unless the ``-f`` flag is passed.
1024
When multiple instances are selected (either by passing multiple
1025
arguments or by using the ``--node``, ``--primary``, ``--secondary``
1026
or ``--all`` options), the user must pass the ``--force-multiple``
1027
options to skip the interactive confirmation.
1028

    
1029
See **ganeti(7)** for a description of ``--submit`` and other common
1030
options.
1031

    
1032
RENAME
1033
^^^^^^
1034

    
1035
| **rename** [\--no-ip-check] [\--no-name-check] [\--submit]
1036
| {*instance*} {*new\_name*}
1037

    
1038
Renames the given instance. The instance must be stopped when running
1039
this command. The requirements for the new name are the same as for
1040
adding an instance: the new name must be resolvable and the IP it
1041
resolves to must not be reachable (in order to prevent duplicate IPs
1042
the next time the instance is started). The IP test can be skipped if
1043
the ``--no-ip-check`` option is passed.
1044

    
1045
Note that you can rename an instance to its same name, to force
1046
re-executing the os-specific rename script for that instance, if
1047
needed.
1048

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

    
1055
See **ganeti(7)** for a description of ``--submit`` and other common
1056
options.
1057

    
1058
Starting/stopping/connecting to console
1059
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1060

    
1061
STARTUP
1062
^^^^^^^
1063

    
1064
| **startup**
1065
| [\--force] [\--ignore-offline]
1066
| [\--force-multiple] [\--no-remember]
1067
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1068
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1069
| [{-H|\--hypervisor-parameters} ``key=value...``]
1070
| [{-B|\--backend-parameters} ``key=value...``]
1071
| [\--submit] [\--paused]
1072
| {*name*...}
1073

    
1074
Starts one or more instances, depending on the following options.  The
1075
four available modes are:
1076

    
1077
\--instance
1078
    will start the instances given as arguments (at least one argument
1079
    required); this is the default selection
1080

    
1081
\--node
1082
    will start the instances who have the given node as either primary
1083
    or secondary
1084

    
1085
\--primary
1086
    will start all instances whose primary node is in the list of nodes
1087
    passed as arguments (at least one node required)
1088

    
1089
\--secondary
1090
    will start all instances whose secondary node is in the list of
1091
    nodes passed as arguments (at least one node required)
1092

    
1093
\--all
1094
    will start all instances in the cluster (no arguments accepted)
1095

    
1096
\--tags
1097
    will start all instances in the cluster with the tags given as
1098
    arguments
1099

    
1100
\--node-tags
1101
    will start all instances in the cluster on nodes with the tags
1102
    given as arguments
1103

    
1104
\--pri-node-tags
1105
    will start all instances in the cluster on primary nodes with the
1106
    tags given as arguments
1107

    
1108
\--sec-node-tags
1109
    will start all instances in the cluster on secondary nodes with the
1110
    tags given as arguments
1111

    
1112
Note that although you can pass more than one selection option, the
1113
last one wins, so in order to guarantee the desired result, don't pass
1114
more than one such option.
1115

    
1116
Use ``--force`` to start even if secondary disks are failing.
1117
``--ignore-offline`` can be used to ignore offline primary nodes and
1118
mark the instance as started even if the primary is not available.
1119

    
1120
The ``--force-multiple`` will skip the interactive confirmation in the
1121
case the more than one instance will be affected.
1122

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

    
1129
The ``-H (--hypervisor-parameters)`` and ``-B (--backend-parameters)``
1130
options specify temporary hypervisor and backend parameters that can
1131
be used to start an instance with modified parameters. They can be
1132
useful for quick testing without having to modify an instance back and
1133
forth, e.g.::
1134

    
1135
    # gnt-instance start -H kernel_args="single" instance1
1136
    # gnt-instance start -B maxmem=2048 instance2
1137

    
1138

    
1139
The first form will start the instance instance1 in single-user mode,
1140
and the instance instance2 with 2GB of RAM (this time only, unless
1141
that is the actual instance memory size already). Note that the values
1142
override the instance parameters (and not extend them): an instance
1143
with "kernel\_args=ro" when started with -H kernel\_args=single will
1144
result in "single", not "ro single".
1145

    
1146
The ``--paused`` option is only valid for Xen and kvm hypervisors.  This
1147
pauses the instance at the start of bootup, awaiting ``gnt-instance
1148
console`` to unpause it, allowing the entire boot process to be
1149
monitored for debugging.
1150

    
1151
See **ganeti(7)** for a description of ``--submit`` and other common
1152
options.
1153

    
1154
Example::
1155

    
1156
    # gnt-instance start instance1.example.com
1157
    # gnt-instance start --node node1.example.com node2.example.com
1158
    # gnt-instance start --all
1159

    
1160

    
1161
SHUTDOWN
1162
^^^^^^^^
1163

    
1164
| **shutdown**
1165
| [\--timeout=*N*]
1166
| [\--force] [\--force-multiple] [\--ignore-offline] [\--no-remember]
1167
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1168
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1169
| [\--submit]
1170
| {*name*...}
1171

    
1172
Stops one or more instances. If the instance cannot be cleanly stopped
1173
during a hardcoded interval (currently 2 minutes), it will forcibly
1174
stop the instance (equivalent to switching off the power on a physical
1175
machine).
1176

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

    
1182
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1183
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1184
``--sec-node-tags`` options are similar as for the **startup** command
1185
and they influence the actual instances being shutdown.
1186

    
1187
``--ignore-offline`` can be used to ignore offline primary nodes and
1188
force the instance to be marked as stopped. This option should be used
1189
with care as it can lead to an inconsistent cluster state.
1190

    
1191
Use ``--force`` to be able to shutdown an instance even when it's marked
1192
as offline. This is useful is an offline instance ends up in the
1193
``ERROR_up`` state, for example.
1194

    
1195
The ``--no-remember`` option will perform the shutdown but not change
1196
the state of the instance in the configuration file (if it was running
1197
before, Ganeti will still thinks it needs to be running). This can be
1198
useful for a cluster-wide shutdown, where some instances are marked as
1199
up and some as down, and you don't want to change the running state:
1200
you just need to disable the watcher, shutdown all instances with
1201
``--no-remember``, and when the watcher is activated again it will
1202
restore the correct runtime state for all instances.
1203

    
1204
See **ganeti(7)** for a description of ``--submit`` and other common
1205
options.
1206

    
1207
Example::
1208

    
1209
    # gnt-instance shutdown instance1.example.com
1210
    # gnt-instance shutdown --all
1211

    
1212

    
1213
REBOOT
1214
^^^^^^
1215

    
1216
| **reboot**
1217
| [{-t|\--type} *REBOOT-TYPE*]
1218
| [\--ignore-secondaries]
1219
| [\--shutdown-timeout=*N*]
1220
| [\--force-multiple]
1221
| [\--instance \| \--node \| \--primary \| \--secondary \| \--all \|
1222
| \--tags \| \--node-tags \| \--pri-node-tags \| \--sec-node-tags]
1223
| [\--submit]
1224
| [*name*...]
1225

    
1226
Reboots one or more instances. The type of reboot depends on the value
1227
of ``-t (--type)``. A soft reboot does a hypervisor reboot, a hard reboot
1228
does a instance stop, recreates the hypervisor config for the instance
1229
and starts the instance. A full reboot does the equivalent of
1230
**gnt-instance shutdown && gnt-instance startup**.  The default is
1231
hard reboot.
1232

    
1233
For the hard reboot the option ``--ignore-secondaries`` ignores errors
1234
for the secondary node while re-assembling the instance disks.
1235

    
1236
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1237
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1238
``--sec-node-tags`` options are similar as for the **startup** command
1239
and they influence the actual instances being rebooted.
1240

    
1241
The ``--shutdown-timeout`` is used to specify how much time to wait
1242
before forcing the shutdown (xm destroy in xen, killing the kvm
1243
process, for kvm). By default two minutes are given to each instance
1244
to stop.
1245

    
1246
The ``--force-multiple`` will skip the interactive confirmation in the
1247
case the more than one instance will be affected.
1248

    
1249
See **ganeti(7)** for a description of ``--submit`` and other common
1250
options.
1251

    
1252
Example::
1253

    
1254
    # gnt-instance reboot instance1.example.com
1255
    # gnt-instance reboot --type=full instance1.example.com
1256

    
1257

    
1258
CONSOLE
1259
^^^^^^^
1260

    
1261
**console** [\--show-cmd] {*instance*}
1262

    
1263
Connects to the console of the given instance. If the instance is not
1264
up, an error is returned. Use the ``--show-cmd`` option to display the
1265
command instead of executing it.
1266

    
1267
For HVM instances, this will attempt to connect to the serial console
1268
of the instance. To connect to the virtualized "physical" console of a
1269
HVM instance, use a VNC client with the connection info from the
1270
**info** command.
1271

    
1272
For Xen/kvm instances, if the instance is paused, this attempts to
1273
unpause the instance after waiting a few seconds for the connection to
1274
the console to be made.
1275

    
1276
Example::
1277

    
1278
    # gnt-instance console instance1.example.com
1279

    
1280

    
1281
Disk management
1282
~~~~~~~~~~~~~~~
1283

    
1284
REPLACE-DISKS
1285
^^^^^^^^^^^^^
1286

    
1287
**replace-disks** [\--submit] [\--early-release] [\--ignore-ipolicy] {-p}
1288
[\--disks *idx*] {*instance*}
1289

    
1290
**replace-disks** [\--submit] [\--early-release] [\--ignore-ipolicy] {-s}
1291
[\--disks *idx*] {*instance*}
1292

    
1293
**replace-disks** [\--submit] [\--early-release] [\--ignore-ipolicy]
1294
{{-I\|\--iallocator} *name* \| {{-n|\--new-secondary} *node* } {*instance*}
1295

    
1296
**replace-disks** [\--submit] [\--early-release] [\--ignore-ipolicy]
1297
{-a\|\--auto} {*instance*}
1298

    
1299
This command is a generalized form for replacing disks. It is
1300
currently only valid for the mirrored (DRBD) disk template.
1301

    
1302
The first form (when passing the ``-p`` option) will replace the disks
1303
on the primary, while the second form (when passing the ``-s`` option
1304
will replace the disks on the secondary node. For these two cases (as
1305
the node doesn't change), it is possible to only run the replace for a
1306
subset of the disks, using the option ``--disks`` which takes a list
1307
of comma-delimited disk indices (zero-based), e.g. 0,2 to replace only
1308
the first and third disks.
1309

    
1310
The third form (when passing either the ``--iallocator`` or the
1311
``--new-secondary`` option) is designed to change secondary node of the
1312
instance. Specifying ``--iallocator`` makes the new secondary be
1313
selected automatically by the specified allocator plugin (use ``.`` to
1314
indicate the default allocator), otherwise the new secondary node will
1315
be the one chosen manually via the ``--new-secondary`` option.
1316

    
1317
Note that it is not possible to select an offline or drained node as a
1318
new secondary.
1319

    
1320
The fourth form (when using ``--auto``) will automatically determine
1321
which disks of an instance are faulty and replace them within the same
1322
node. The ``--auto`` option works only when an instance has only
1323
faulty disks on either the primary or secondary node; it doesn't work
1324
when both sides have faulty disks.
1325

    
1326
The ``--early-release`` changes the code so that the old storage on
1327
secondary node(s) is removed early (before the resync is completed)
1328
and the internal Ganeti locks for the current (and new, if any)
1329
secondary node are also released, thus allowing more parallelism in
1330
the cluster operation. This should be used only when recovering from a
1331
disk failure on the current secondary (thus the old storage is already
1332
broken) or when the storage on the primary node is known to be fine
1333
(thus we won't need the old storage for potential recovery).
1334

    
1335
The ``--ignore-ipolicy`` let the command ignore instance policy
1336
violations if replace-disks changes groups and the instance would
1337
violate the new groups instance policy.
1338

    
1339
See **ganeti(7)** for a description of ``--submit`` and other common
1340
options.
1341

    
1342
ACTIVATE-DISKS
1343
^^^^^^^^^^^^^^
1344

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

    
1347
Activates the block devices of the given instance. If successful, the
1348
command will show the location and name of the block devices::
1349

    
1350
    node1.example.com:disk/0:/dev/drbd0
1351
    node1.example.com:disk/1:/dev/drbd1
1352

    
1353

    
1354
In this example, *node1.example.com* is the name of the node on which
1355
the devices have been activated. The *disk/0* and *disk/1* are the
1356
Ganeti-names of the instance disks; how they are visible inside the
1357
instance is hypervisor-specific. */dev/drbd0* and */dev/drbd1* are the
1358
actual block devices as visible on the node.
1359

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

    
1367
The ``--wait-for-sync`` option will ensure that the command returns only
1368
after the instance's disks are synchronised (mostly for DRBD); this can
1369
be useful to ensure consistency, as otherwise there are no commands that
1370
can wait until synchronisation is done. However when passing this
1371
option, the command will have additional output, making it harder to
1372
parse the disk information.
1373

    
1374
Note that it is safe to run this command while the instance is already
1375
running.
1376

    
1377
See **ganeti(7)** for a description of ``--submit`` and other common
1378
options.
1379

    
1380
DEACTIVATE-DISKS
1381
^^^^^^^^^^^^^^^^
1382

    
1383
**deactivate-disks** [-f] [\--submit] {*instance*}
1384

    
1385
De-activates the block devices of the given instance. Note that if you
1386
run this command for an instance with a drbd disk template, while it
1387
is running, it will not be able to shutdown the block devices on the
1388
primary node, but it will shutdown the block devices on the secondary
1389
nodes, thus breaking the replication.
1390

    
1391
The ``-f``/``--force`` option will skip checks that the instance is
1392
down; in case the hypervisor is confused and we can't talk to it,
1393
normally Ganeti will refuse to deactivate the disks, but with this
1394
option passed it will skip this check and directly try to deactivate
1395
the disks. This can still fail due to the instance actually running or
1396
other issues.
1397

    
1398
See **ganeti(7)** for a description of ``--submit`` and other common
1399
options.
1400

    
1401
GROW-DISK
1402
^^^^^^^^^
1403

    
1404
| **grow-disk** [\--no-wait-for-sync] [\--submit] [\--absolute]
1405
| {*instance*} {*disk*} {*amount*}
1406

    
1407
Grows an instance's disk. This is only possible for instances having a
1408
plain, drbd or rbd disk template.
1409

    
1410
Note that this command only change the block device size; it will not
1411
grow the actual filesystems, partitions, etc. that live on that
1412
disk. Usually, you will need to:
1413

    
1414
#. use **gnt-instance grow-disk**
1415

    
1416
#. reboot the instance (later, at a convenient time)
1417

    
1418
#. use a filesystem resizer, such as ext2online(8) or
1419
   xfs\_growfs(8) to resize the filesystem, or use fdisk(8) to change
1420
   the partition table on the disk
1421

    
1422
The *disk* argument is the index of the instance disk to grow. The
1423
*amount* argument is given as a number which can have a suffix (like the
1424
disk size in instance create); if the suffix is missing, the value will
1425
be interpreted as mebibytes.
1426

    
1427
By default, the *amount* value represents the desired increase in the
1428
disk size (e.g. an amount of 1G will take a disk of size 3G to 4G). If
1429
the optional ``--absolute`` parameter is passed, then the *amount*
1430
argument doesn't represent the delta, but instead the desired final disk
1431
size (e.g. an amount of 8G will take a disk of size 4G to 8G).
1432

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

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

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

    
1444
Example (increase the first disk for instance1 by 16GiB)::
1445

    
1446
    # gnt-instance grow-disk instance1.example.com 0 16g
1447

    
1448
Example for increasing the disk size to a certain size::
1449

    
1450
   # gnt-instance grow-disk --absolute instance1.example.com 0 32g
1451

    
1452
Also note that disk shrinking is not supported; use **gnt-backup
1453
export** and then **gnt-backup import** to reduce the disk size of an
1454
instance.
1455

    
1456
RECREATE-DISKS
1457
^^^^^^^^^^^^^^
1458

    
1459
| **recreate-disks** [\--submit]
1460
| [{-n node1:[node2] \| {-I\|\--iallocator *name*}}]
1461
| [\--disk=*N*[:[size=*VAL*][,mode=*ro\|rw*]]] {*instance*}
1462

    
1463
Recreates all or a subset of disks of the given instance.
1464

    
1465
Note that this functionality should only be used for missing disks; if
1466
any of the given disks already exists, the operation will fail.  While
1467
this is suboptimal, recreate-disks should hopefully not be needed in
1468
normal operation and as such the impact of this is low.
1469

    
1470
If only a subset should be recreated, any number of ``disk`` options can
1471
be specified. It expects a disk index and an optional list of disk
1472
parameters to change. Only ``size`` and ``mode`` can be changed while
1473
recreating disks. To recreate all disks while changing parameters on
1474
a subset only, a ``--disk`` option must be given for every disk of the
1475
instance.
1476

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

    
1486
Another method of choosing which nodes to place the instance on is by
1487
using the specified iallocator, passing the ``--iallocator`` option.
1488
The primary and secondary nodes will be chosen by the specified
1489
iallocator plugin, or by the default allocator if ``.`` is specified.
1490

    
1491
See **ganeti(7)** for a description of ``--submit`` and other common
1492
options.
1493

    
1494
Recovery
1495
~~~~~~~~
1496

    
1497
FAILOVER
1498
^^^^^^^^
1499

    
1500
| **failover** [-f] [\--ignore-consistency] [\--ignore-ipolicy]
1501
| [\--shutdown-timeout=*N*]
1502
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*]
1503
| [\--submit]
1504
| {*instance*}
1505

    
1506
Failover will stop the instance (if running), change its primary node,
1507
and if it was originally running it will start it again (on the new
1508
primary). This only works for instances with drbd template (in which
1509
case you can only fail to the secondary node) and for externally
1510
mirrored templates (blockdev and rbd) (which can change to any other
1511
node).
1512

    
1513
If the instance's disk template is of type blockdev or rbd, then you
1514
can explicitly specify the target node (which can be any node) using
1515
the ``-n`` or ``--target-node`` option, or specify an iallocator plugin
1516
using the ``-I`` or ``--iallocator`` option. If you omit both, the default
1517
iallocator will be used to specify the target node.
1518

    
1519
Normally the failover will check the consistency of the disks before
1520
failing over the instance. If you are trying to migrate instances off
1521
a dead node, this will fail. Use the ``--ignore-consistency`` option
1522
for this purpose. Note that this option can be dangerous as errors in
1523
shutting down the instance will be ignored, resulting in possibly
1524
having the instance running on two machines in parallel (on
1525
disconnected DRBD drives).
1526

    
1527
The ``--shutdown-timeout`` is used to specify how much time to wait
1528
before forcing the shutdown (xm destroy in xen, killing the kvm
1529
process, for kvm). By default two minutes are given to each instance
1530
to stop.
1531

    
1532
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1533
during this operation are ignored.
1534

    
1535
See **ganeti(7)** for a description of ``--submit`` and other common
1536
options.
1537

    
1538
Example::
1539

    
1540
    # gnt-instance failover instance1.example.com
1541

    
1542

    
1543
MIGRATE
1544
^^^^^^^
1545

    
1546
| **migrate** [-f] [\--allow-failover] [\--non-live]
1547
| [\--migration-mode=live\|non-live] [\--ignore-ipolicy]
1548
| [\--no-runtime-changes] [\--submit]
1549
| [{-n|\--target-node} *node* \| {-I|\--iallocator} *name*] {*instance*}
1550

    
1551
| **migrate** [-f] \--cleanup [\--submit] {*instance*}
1552

    
1553
Migrate will move the instance to its secondary node without shutdown.
1554
As with failover, it only works for instances having the drbd disk
1555
template or an externally mirrored disk template type such as blockdev
1556
or rbd.
1557

    
1558
If the instance's disk template is of type blockdev or rbd, then you can
1559
explicitly specify the target node (which can be any node) using the
1560
``-n`` or ``--target-node`` option, or specify an iallocator plugin
1561
using the ``-I`` or ``--iallocator`` option. If you omit both, the
1562
default iallocator will be used to specify the target node.
1563
Alternatively, the default iallocator can be requested by specifying
1564
``.`` as the name of the plugin.
1565

    
1566
The migration command needs a perfectly healthy instance, as we rely
1567
on the dual-master capability of drbd8 and the disks of the instance
1568
are not allowed to be degraded.
1569

    
1570
The ``--non-live`` and ``--migration-mode=non-live`` options will
1571
switch (for the hypervisors that support it) between a "fully live"
1572
(i.e. the interruption is as minimal as possible) migration and one in
1573
which the instance is frozen, its state saved and transported to the
1574
remote node, and then resumed there. This all depends on the
1575
hypervisor support for two different methods. In any case, it is not
1576
an error to pass this parameter (it will just be ignored if the
1577
hypervisor doesn't support it). The option ``--migration-mode=live``
1578
option will request a fully-live migration. The default, when neither
1579
option is passed, depends on the hypervisor parameters (and can be
1580
viewed with the **gnt-cluster info** command).
1581

    
1582
If the ``--cleanup`` option is passed, the operation changes from
1583
migration to attempting recovery from a failed previous migration.  In
1584
this mode, Ganeti checks if the instance runs on the correct node (and
1585
updates its configuration if not) and ensures the instances' disks
1586
are configured correctly. In this mode, the ``--non-live`` option is
1587
ignored.
1588

    
1589
The option ``-f`` will skip the prompting for confirmation.
1590

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

    
1596
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1597
during this operation are ignored.
1598

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

    
1603
If an instance has the backend parameter ``always\_failover`` set to
1604
true, then the migration is automatically converted into a failover.
1605

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

    
1609
Example (and expected output)::
1610

    
1611
    # gnt-instance migrate instance1
1612
    Instance instance1 will be migrated. Note that migration
1613
    might impact the instance if anything goes wrong (e.g. due to bugs in
1614
    the hypervisor). Continue?
1615
    y/[n]/?: y
1616
    Migrating instance instance1.example.com
1617
    * checking disk consistency between source and target
1618
    * switching node node2.example.com to secondary mode
1619
    * changing into standalone mode
1620
    * changing disks into dual-master mode
1621
    * wait until resync is done
1622
    * preparing node2.example.com to accept the instance
1623
    * migrating instance to node2.example.com
1624
    * switching node node1.example.com to secondary mode
1625
    * wait until resync is done
1626
    * changing into standalone mode
1627
    * changing disks into single-master mode
1628
    * wait until resync is done
1629
    * done
1630
    #
1631

    
1632

    
1633
MOVE
1634
^^^^
1635

    
1636
| **move** [-f] [\--ignore-consistency]
1637
| [-n *node*] [\--shutdown-timeout=*N*] [\--submit] [\--ignore-ipolicy]
1638
| {*instance*}
1639

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

    
1643
Note that since this operation is done via data copy, it will take a
1644
long time for big disks (similar to replace-disks for a drbd
1645
instance).
1646

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

    
1652
The ``--ignore-consistency`` option will make Ganeti ignore any errors
1653
in trying to shutdown the instance on its node; useful if the
1654
hypervisor is broken and you want to recuperate the data.
1655

    
1656
If ``--ignore-ipolicy`` is given any instance policy violations occuring
1657
during this operation are ignored.
1658

    
1659
See **ganeti(7)** for a description of ``--submit`` and other common
1660
options.
1661

    
1662
Example::
1663

    
1664
    # gnt-instance move -n node3.example.com instance1.example.com
1665

    
1666

    
1667
CHANGE-GROUP
1668
~~~~~~~~~~~~
1669

    
1670
| **change-group** [\--submit]
1671
| [\--iallocator *NAME*] [\--to *GROUP*...] {*instance*}
1672

    
1673
This command moves an instance to another node group. The move is
1674
calculated by an iallocator, either given on the command line or as a
1675
cluster default.
1676

    
1677
If no specific destination groups are specified using ``--to``, all
1678
groups except the one containing the instance are considered.
1679

    
1680
See **ganeti(7)** for a description of ``--submit`` and other common
1681
options.
1682

    
1683
Example::
1684

    
1685
    # gnt-instance change-group -I hail --to rack2 inst1.example.com
1686

    
1687

    
1688
TAGS
1689
~~~~
1690

    
1691
ADD-TAGS
1692
^^^^^^^^
1693

    
1694
**add-tags** [\--from *file*] {*instancename*} {*tag*...}
1695

    
1696
Add tags to the given instance. If any of the tags contains invalid
1697
characters, the entire operation will abort.
1698

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

    
1705
LIST-TAGS
1706
^^^^^^^^^
1707

    
1708
**list-tags** {*instancename*}
1709

    
1710
List the tags of the given instance.
1711

    
1712
REMOVE-TAGS
1713
^^^^^^^^^^^
1714

    
1715
**remove-tags** [\--from *file*] {*instancename*} {*tag*...}
1716

    
1717
Remove tags from the given instance. If any of the tags are not
1718
existing on the node, the entire operation will abort.
1719

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

    
1726
.. vim: set textwidth=72 :
1727
.. Local Variables:
1728
.. mode: rst
1729
.. fill-column: 72
1730
.. End: