Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.rst @ 525011bc

History | View | Annotate | Download (49 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 {diskless | file \| plain \| drbd}}
31
| {--disk=*N*: {size=*VAL* \| adopt=*LV*}[,vg=*VG*][,mode=*ro\|rw*]
32
|  \| -s *SIZE*}
33
| [--no-ip-check] [--no-name-check] [--no-start] [--no-install]
34
| [--net=*N* [:options...] \| --no-nics]
35
| [-B *BEPARAMS*]
36
| [-H *HYPERVISOR* [: option=*value*... ]]
37
| [--file-storage-dir *dir\_path*] [--file-driver {loop \| blktap}]
38
| {-n *node[:secondary-node]* \| --iallocator *name*}
39
| {-o *os-type*}
40
| [--submit]
41
| {*instance*}
42

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

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

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

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

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

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

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

    
83
If you don't wat the instance to automatically start after
84
creation, this is possible via the ``--no-start`` option. This will
85
leave the instance down until a subsequent **gnt-instance start**
86
command.
87

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

    
93

    
94

    
95
mac
96
    either a value or 'generate' to generate a new unique MAC
97

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

    
103
mode
104
    specifies the connection mode for this nic: routed or bridged.
105

    
106
link
107
    in bridged mode specifies the bridge to attach this NIC to, in
108
    routed mode it's intended to differentiate between different
109
    routing tables/instance groups (but the meaning is dependent on the
110
    network script, see gnt-cluster(8) for more details)
111

    
112

    
113
Of these "mode" and "link" are nic parameters, and inherit their
114
default at cluster level.
115
Alternatively, if no network is desired for the instance, you can
116
prevent the default of one NIC with the ``--no-nics`` option.
117

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

    
126
The ``-B`` option specifies the backend parameters for the
127
instance. If no such parameters are specified, the values are
128
inherited from the cluster. Possible parameters are:
129

    
130

    
131

    
132
memory
133
    the memory size of the instance; as usual, suffixes can be used to
134
    denote the unit, otherwise the value is taken in mebibites
135

    
136
vcpus
137
    the number of VCPUs to assign to the instance (if this value makes
138
    sense for the hypervisor)
139

    
140
auto\_balance
141
    whether the instance is considered in the N+1 cluster checks
142
    (enough redundancy in the cluster to survive a node failure)
143

    
144

    
145
The ``-H`` option specified the hypervisor to use for the instance
146
(must be one of the enabled hypervisors on the cluster) and
147
optionally custom parameters for this instance. If not other
148
options are used (i.e. the invocation is just -H *NAME*) the
149
instance will inherit the cluster options. The defaults below show
150
the cluster defaults at cluster creation time.
151

    
152
The possible hypervisor options are as follows:
153

    
154

    
155

    
156
boot\_order
157
    Valid for the Xen HVM and KVM hypervisors.
158

    
159
    A string value denoting the boot order. This has different meaning
160
    for the Xen HVM hypervisor and for the KVM one.
161

    
162
    For Xen HVM, The boot order is a string of letters listing the boot
163
    devices, with valid device letters being:
164

    
165

    
166

    
167
    a
168
        floppy drive
169

    
170
    c
171
        hard disk
172

    
173
    d
174
        CDROM drive
175

    
176
    n
177
        network boot (PXE)
178

    
179

    
180
    The default is not to set an HVM boot order which is interpreted as
181
    'dc'.
182

    
183
    For KVM the boot order is either "cdrom", "disk" or "network".
184
    Please note that older versions of KVM couldn't netboot from virtio
185
    interfaces. This has been fixed in more recent versions and is
186
    confirmed to work at least with qemu-kvm 0.11.1.
187

    
188
blockdev\_prefix
189
    Valid for the Xen HVM and PVM hypervisors.
190

    
191
    Relevant to nonpvops guest kernels, in which the disk device names are
192
    given by the host.  Allows to specify 'xvd', which helps run Red Hat based
193
    installers, driven by anaconda.
194

    
195
cdrom\_image\_path
196
    Valid for the Xen HVM and KVM hypervisors.
197

    
198
    The path to a CDROM image to attach to the instance.
199

    
200
nic\_type
201
    Valid for the Xen HVM and KVM hypervisors.
202

    
203
    This parameter determines the way the network cards are presented
204
    to the instance. The possible options are:
205

    
206

    
207

    
208
    rtl8139 (default for Xen HVM) (HVM & KVM)
209
    ne2k\_isa (HVM & KVM)
210
    ne2k\_pci (HVM & KVM)
211
    i82551 (KVM)
212
    i82557b (KVM)
213
    i82559er (KVM)
214
    pcnet (KVM)
215
    e1000 (KVM)
216
    paravirtual (default for KVM) (HVM & KVM)
217

    
218

    
219
disk\_type
220
    Valid for the Xen HVM and KVM hypervisors.
221

    
222
    This parameter determines the way the disks are presented to the
223
    instance. The possible options are:
224

    
225

    
226

    
227
    ioemu (default for HVM & KVM) (HVM & KVM)
228
    ide (HVM & KVM)
229
    scsi (KVM)
230
    sd (KVM)
231
    mtd (KVM)
232
    pflash (KVM)
233

    
234

    
235
vnc\_bind\_address
236
    Valid for the Xen HVM and KVM hypervisors.
237

    
238
    Specifies the address that the VNC listener for this instance
239
    should bind to. Valid values are IPv4 addresses. Use the address
240
    0.0.0.0 to bind to all available interfaces (this is the default)
241
    or specify the address of one of the interfaces on the node to
242
    restrict listening to that interface.
243

    
244
vnc\_tls
245
    Valid for the KVM hypervisor.
246

    
247
    A boolean option that controls whether the VNC connection is
248
    secured with TLS.
249

    
250
vnc\_x509\_path
251
    Valid for the KVM hypervisor.
252

    
253
    If ``vnc_tls`` is enabled, this options specifies the path to the
254
    x509 certificate to use.
255

    
256
vnc\_x509\_verify
257
    Valid for the KVM hypervisor.
258

    
259
acpi
260
    Valid for the Xen HVM and KVM hypervisors.
261

    
262
    A boolean option that specifies if the hypervisor should enable
263
    ACPI support for this instance. By default, ACPI is disabled.
264

    
265
pae
266
    Valid for the Xen HVM and KVM hypervisors.
267

    
268
    A boolean option that specifies if the hypervisor should enabled
269
    PAE support for this instance. The default is false, disabling PAE
270
    support.
271

    
272
use\_localtime
273
    Valid for the Xen HVM and KVM hypervisors.
274

    
275
    A boolean option that specifies if the instance should be started
276
    with its clock set to the localtime of the machine (when true) or
277
    to the UTC (When false). The default is false, which is useful for
278
    Linux/Unix machines; for Windows OSes, it is recommended to enable
279
    this parameter.
280

    
281
kernel\_path
282
    Valid for the Xen PVM and KVM hypervisors.
283

    
284
    This option specifies the path (on the node) to the kernel to boot
285
    the instance with. Xen PVM instances always require this, while for
286
    KVM if this option is empty, it will cause the machine to load the
287
    kernel from its disks.
288

    
289
kernel\_args
290
    Valid for the Xen PVM and KVM hypervisors.
291

    
292
    This options specifies extra arguments to the kernel that will be
293
    loaded. device. This is always used for Xen PVM, while for KVM it
294
    is only used if the ``kernel_path`` option is also specified.
295

    
296
    The default setting for this value is simply ``"ro"``, which mounts
297
    the root disk (initially) in read-only one. For example, setting
298
    this to single will cause the instance to start in single-user
299
    mode.
300

    
301
initrd\_path
302
    Valid for the Xen PVM and KVM hypervisors.
303

    
304
    This option specifies the path (on the node) to the initrd to boot
305
    the instance with. Xen PVM instances can use this always, while for
306
    KVM if this option is only used if the ``kernel_path`` option is
307
    also specified. You can pass here either an absolute filename (the
308
    path to the initrd) if you want to use an initrd, or use the format
309
    no\_initrd\_path for no initrd.
310

    
311
root\_path
312
    Valid for the Xen PVM and KVM hypervisors.
313

    
314
    This options specifies the name of the root device. This is always
315
    needed for Xen PVM, while for KVM it is only used if the
316
    ``kernel_path`` option is also specified.
317

    
318
serial\_console
319
    Valid for the KVM hypervisor.
320

    
321
    This boolean option specifies whether to emulate a serial console
322
    for the instance.
323

    
324
disk\_cache
325
    Valid for the KVM hypervisor.
326

    
327
    The disk cache mode. It can be either default to not pass any cache
328
    option to KVM, or one of the KVM cache modes: none (for direct
329
    I/O), writethrough (to use the host cache but report completion to
330
    the guest only when the host has committed the changes to disk) or
331
    writeback (to use the host cache and report completion as soon as
332
    the data is in the host cache). Note that there are special
333
    considerations for the cache mode depending on version of KVM used
334
    and disk type (always raw file under Ganeti), please refer to the
335
    KVM documentation for more details.
336

    
337
security\_model
338
    Valid for the KVM hypervisor.
339

    
340
    The security model for kvm. Currently one of "none", "user" or
341
    "pool". Under "none", the default, nothing is done and instances
342
    are run as the Ganeti daemon user (normally root).
343

    
344
    Under "user" kvm will drop privileges and become the user specified
345
    by the security\_domain parameter.
346

    
347
    Under "pool" a global cluster pool of users will be used, making
348
    sure no two instances share the same user on the same node. (this
349
    mode is not implemented yet)
350

    
351
security\_domain
352
    Valid for the KVM hypervisor.
353

    
354
    Under security model "user" the username to run the instance under.
355
    It must be a valid username existing on the host.
356

    
357
    Cannot be set under security model "none" or "pool".
358

    
359
kvm\_flag
360
    Valid for the KVM hypervisor.
361

    
362
    If "enabled" the -enable-kvm flag is passed to kvm. If "disabled"
363
    -disable-kvm is passed. If unset no flag is passed, and the default
364
    running mode for your kvm binary will be used.
365

    
366
mem\_path
367
    Valid for the KVM hypervisor.
368

    
369
    This option passes the -mem-path argument to kvm with the path (on
370
    the node) to the mount point of the hugetlbfs file system, along
371
    with the -mem-prealloc argument too.
372

    
373
use\_chroot
374
    Valid for the KVM hypervisor.
375

    
376
    This boolean option determines wether to run the KVM instance in a
377
    chroot directory.
378

    
379
    If it is set to ``true``, an empty directory is created before
380
    starting the instance and its path is passed via the -chroot flag
381
    to kvm. The directory is removed when the instance is stopped.
382

    
383
    It is set to ``false`` by default.
384

    
385
migration\_downtime
386
    Valid for the KVM hypervisor.
387

    
388
    The maximum amount of time (in ms) a KVM instance is allowed to be
389
    frozen during a live migration, in order to copy dirty memory
390
    pages. Default value is 30ms, but you may need to increase this
391
    value for busy instances.
392

    
393
    This option is only effective with kvm versions >= 87 and qemu-kvm
394
    versions >= 0.11.0.
395

    
396
cpu\_mask
397
    Valid for the LXC hypervisor.
398

    
399
    The processes belonging to the given instance are only scheduled on
400
    the specified CPUs.
401

    
402
    The parameter format is a comma-separated list of CPU IDs or CPU ID
403
    ranges. The ranges are defined by a lower and higher boundary,
404
    separated by a dash. The boundaries are inclusive.
405

    
406
usb\_mouse
407
    Valid for the KVM hypervisor.
408

    
409
    This option specifies the usb mouse type to be used. It can be
410
    "mouse" or "tablet". When using VNC it's recommended to set it to
411
    "tablet".
412

    
413

    
414
The ``--iallocator`` option specifies the instance allocator plugin
415
to use. If you pass in this option the allocator will select nodes
416
for this instance automatically, so you don't need to pass them
417
with the ``-n`` option. For more information please refer to the
418
instance allocator documentation.
419

    
420
The ``-t`` options specifies the disk layout type for the instance.
421
The available choices are:
422

    
423

    
424

    
425
diskless
426
    This creates an instance with no disks. Its useful for testing only
427
    (or other special cases).
428

    
429
file
430
    Disk devices will be regular files.
431

    
432
plain
433
    Disk devices will be logical volumes.
434

    
435
drbd
436
    Disk devices will be drbd (version 8.x) on top of lvm volumes.
437

    
438

    
439
The optional second value of the ``--node`` is used for the drbd
440
template type and specifies the remote node.
441

    
442
If you do not want gnt-instance to wait for the disk mirror to be
443
synced, use the ``--no-wait-for-sync`` option.
444

    
445
The ``--file-storage-dir`` specifies the relative path under the
446
cluster-wide file storage directory to store file-based disks. It is
447
useful for having different subdirectories for different
448
instances. The full path of the directory where the disk files are
449
stored will consist of cluster-wide file storage directory + optional
450
subdirectory + instance name. Example:
451
``@RPL_FILE_STORAGE_DIR@``*/mysubdir/instance1.example.com*. This
452
option is only relevant for instances using the file storage backend.
453

    
454
The ``--file-driver`` specifies the driver to use for file-based
455
disks. Note that currently these drivers work with the xen
456
hypervisor only. This option is only relevant for instances using
457
the file storage backend. The available choices are:
458

    
459

    
460

    
461
loop
462
    Kernel loopback driver. This driver uses loopback devices to access
463
    the filesystem within the file. However, running I/O intensive
464
    applications in your instance using the loop driver might result in
465
    slowdowns. Furthermore, if you use the loopback driver consider
466
    increasing the maximum amount of loopback devices (on most systems
467
    it's 8) using the max\_loop param.
468

    
469
blktap
470
    The blktap driver (for Xen hypervisors). In order to be able to use
471
    the blktap driver you should check if the 'blktapctrl' user space
472
    disk agent is running (usually automatically started via xend).
473
    This user-level disk I/O interface has the advantage of better
474
    performance. Especially if you use a network file system (e.g. NFS)
475
    to store your instances this is the recommended choice.
476

    
477

    
478
The ``--submit`` option is used to send the job to the master
479
daemon but not wait for its completion. The job ID will be shown so
480
that it can be examined via **gnt-job info**.
481

    
482
Example::
483

    
484
    # gnt-instance add -t file --disk 0:size=30g -B memory=512 -o debian-etch \
485
      -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
486
    # gnt-instance add -t plain --disk 0:size=30g -B memory=512 -o debian-etch \
487
      -n node1.example.com instance1.example.com
488
    # gnt-instance add -t plain --disk 0:size=30g --disk 1:size=100g,vg=san \
489
      -B memory=512 -o debian-etch -n node1.example.com instance1.example.com
490
    # gnt-instance add -t drbd --disk 0:size=30g -B memory=512 -o debian-etch \
491
      -n node1.example.com:node2.example.com instance2.example.com
492

    
493

    
494
BATCH-CREATE
495
^^^^^^^^^^^^
496

    
497
**batch-create** {instances\_file.json}
498

    
499
This command (similar to the Ganeti 1.2 **batcher** tool) submits
500
multiple instance creation jobs based on a definition file. The
501
instance configurations do not encompass all the possible options
502
for the **add** command, but only a subset.
503

    
504
The instance file should be a valid-formed JSON file, containing a
505
dictionary with instance name and instance parameters. The accepted
506
parameters are:
507

    
508

    
509

    
510
disk\_size
511
    The size of the disks of the instance.
512

    
513
disk\_template
514
    The disk template to use for the instance, the same as in the
515
    **add** command.
516

    
517
backend
518
    A dictionary of backend parameters.
519

    
520
hypervisor
521
    A dictionary with a single key (the hypervisor name), and as value
522
    the hypervisor options. If not passed, the default hypervisor and
523
    hypervisor options will be inherited.
524

    
525
mac, ip, mode, link
526
    Specifications for the one NIC that will be created for the
527
    instance. 'bridge' is also accepted as a backwards compatibile
528
    key.
529

    
530
nics
531
    List of nics that will be created for the instance. Each entry
532
    should be a dict, with mac, ip, mode and link as possible keys.
533
    Please don't provide the "mac, ip, mode, link" parent keys if you
534
    use this method for specifying nics.
535

    
536
primary\_node, secondary\_node
537
    The primary and optionally the secondary node to use for the
538
    instance (in case an iallocator script is not used).
539

    
540
iallocator
541
    Instead of specifying the nodes, an iallocator script can be used
542
    to automatically compute them.
543

    
544
start
545
    whether to start the instance
546

    
547
ip\_check
548
    Skip the check for already-in-use instance; see the description in
549
    the **add** command for details.
550

    
551
name\_check
552
    Skip the name check for instances; see the description in the
553
    **add** command for details.
554

    
555
file\_storage\_dir, file\_driver
556
    Configuration for the file disk type, see the **add** command for
557
    details.
558

    
559

    
560
A simple definition for one instance can be (with most of the
561
parameters taken from the cluster defaults)::
562

    
563
    {
564
      "instance3": {
565
        "template": "drbd",
566
        "os": "debootstrap",
567
        "disk_size": ["25G"],
568
        "iallocator": "dumb"
569
      },
570
      "instance5": {
571
        "template": "drbd",
572
        "os": "debootstrap",
573
        "disk_size": ["25G"],
574
        "iallocator": "dumb",
575
        "hypervisor": "xen-hvm",
576
        "hvparams": {"acpi": true},
577
        "backend": {"memory": 512}
578
      }
579
    }
580

    
581
The command will display the job id for each submitted instance, as
582
follows::
583

    
584
    # gnt-instance batch-create instances.json
585
    instance3: 11224
586
    instance5: 11225
587

    
588
REMOVE
589
^^^^^^
590

    
591
**remove** [--ignore-failures] [--shutdown-timeout=*N*] [--submit]
592
{*instance*}
593

    
594
Remove an instance. This will remove all data from the instance and
595
there is *no way back*. If you are not sure if you use an instance
596
again, use **shutdown** first and leave it in the shutdown state
597
for a while.
598

    
599
The ``--ignore-failures`` option will cause the removal to proceed
600
even in the presence of errors during the removal of the instance
601
(e.g. during the shutdown or the disk removal). If this option is
602
not given, the command will stop at the first error.
603

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

    
609
The ``--submit`` option is used to send the job to the master
610
daemon but not wait for its completion. The job ID will be shown so
611
that it can be examined via **gnt-job info**.
612

    
613
Example::
614

    
615
    # gnt-instance remove instance1.example.com
616

    
617

    
618
LIST
619
^^^^
620

    
621
| **list**
622
| [--no-headers] [--separator=*SEPARATOR*] [--units=*UNITS*]
623
| [-o *[+]FIELD,...*] [--roman] [instance...]
624

    
625
Shows the currently configured instances with memory usage, disk
626
usage, the node they are running on, and their run status.
627

    
628
The ``--no-headers`` option will skip the initial header line. The
629
``--separator`` option takes an argument which denotes what will be
630
used between the output fields. Both these options are to help
631
scripting.
632

    
633
The units used to display the numeric values in the output varies,
634
depending on the options given. By default, the values will be
635
formatted in the most appropriate unit. If the ``--separator``
636
option is given, then the values are shown in mebibytes to allow
637
parsing by scripts. In both cases, the ``--units`` option can be
638
used to enforce a given output unit.
639

    
640
The ``--roman`` option allows latin people to better understand the
641
cluster instances' status.
642

    
643
The ``-o`` option takes a comma-separated list of output fields.
644
The available fields and their meaning are:
645

    
646

    
647

    
648
name
649
    the instance name
650

    
651
os
652
    the OS of the instance
653

    
654
pnode
655
    the primary node of the instance
656

    
657
snodes
658
    comma-separated list of secondary nodes for the instance; usually
659
    this will be just one node
660

    
661
admin\_state
662
    the desired state of the instance (either "yes" or "no" denoting
663
    the instance should run or not)
664

    
665
disk\_template
666
    the disk template of the instance
667

    
668
oper\_state
669
    the actual state of the instance; can be one of the values
670
    "running", "stopped", "(node down)"
671

    
672
status
673
    combined form of admin\_state and oper\_stat; this can be one of:
674
    ERROR\_nodedown if the node of the instance is down, ERROR\_down if
675
    the instance should run but is down, ERROR\_up if the instance
676
    should be stopped but is actually running, ADMIN\_down if the
677
    instance has been stopped (and is stopped) and running if the
678
    instance is set to be running (and is running)
679

    
680
oper\_ram
681
    the actual memory usage of the instance as seen by the hypervisor
682

    
683
oper\_vcpus
684
    the actual number of VCPUs the instance is using as seen by the
685
    hypervisor
686

    
687
ip
688
    the ip address Ganeti recognizes as associated with the first
689
    instance interface
690

    
691
mac
692
    the first instance interface MAC address
693

    
694
nic\_mode
695
    the mode of the first instance NIC (routed or bridged)
696

    
697
nic\_link
698
    the link of the first instance NIC
699

    
700
sda\_size
701
    the size of the instance's first disk
702

    
703
sdb\_size
704
    the size of the instance's second disk, if any
705

    
706
vcpus
707
    the number of VCPUs allocated to the instance
708

    
709
tags
710
    comma-separated list of the instances's tags
711

    
712
serial\_no
713
    the so called 'serial number' of the instance; this is a numeric
714
    field that is incremented each time the instance is modified, and
715
    it can be used to track modifications
716

    
717
ctime
718
    the creation time of the instance; note that this field contains
719
    spaces and as such it's harder to parse
720

    
721
    if this attribute is not present (e.g. when upgrading from older
722
    versions), then "N/A" will be shown instead
723

    
724
mtime
725
    the last modification time of the instance; note that this field
726
    contains spaces and as such it's harder to parse
727

    
728
    if this attribute is not present (e.g. when upgrading from older
729
    versions), then "N/A" will be shown instead
730

    
731
uuid
732
    Show the UUID of the instance (generated automatically by Ganeti)
733

    
734
network\_port
735
    If the instance has a network port assigned to it (e.g. for VNC
736
    connections), this will be shown, otherwise - will be displayed.
737

    
738
beparams
739
    A text format of the entire beparams for the instance. It's more
740
    useful to select individual fields from this dictionary, see
741
    below.
742

    
743
disk.count
744
    The number of instance disks.
745

    
746
disk.size/N
747
    The size of the instance's Nth disk. This is a more generic form of
748
    the sda\_size and sdb\_size fields.
749

    
750
disk.sizes
751
    A comma-separated list of the disk sizes for this instance.
752

    
753
disk\_usage
754
    The total disk space used by this instance on each of its nodes.
755
    This is not the instance-visible disk size, but the actual disk
756
    "cost" of the instance.
757

    
758
nic.mac/N
759
    The MAC of the Nth instance NIC.
760

    
761
nic.ip/N
762
    The IP address of the Nth instance NIC.
763

    
764
nic.mode/N
765
    The mode of the Nth instance NIC
766

    
767
nic.link/N
768
    The link of the Nth instance NIC
769

    
770
nic.macs
771
    A comma-separated list of all the MACs of the instance's NICs.
772

    
773
nic.ips
774
    A comma-separated list of all the IP addresses of the instance's
775
    NICs.
776

    
777
nic.modes
778
    A comma-separated list of all the modes of the instance's NICs.
779

    
780
nic.links
781
    A comma-separated list of all the link parameters of the instance's
782
    NICs.
783

    
784
nic.count
785
    The number of instance nics.
786

    
787
hv/*NAME*
788
    The value of the hypervisor parameter called *NAME*. For details of
789
    what hypervisor parameters exist and their meaning, see the **add**
790
    command.
791

    
792
be/memory
793
    The configured memory for the instance.
794

    
795
be/vcpus
796
    The configured number of VCPUs for the instance.
797

    
798
be/auto\_balance
799
    Whether the instance is considered in N+1 checks.
800

    
801

    
802
If the value of the option starts with the character ``+``, the new
803
field(s) will be added to the default list. This allows to quickly
804
see the default list plus a few other fields, instead of retyping
805
the entire list of fields.
806

    
807
There is a subtle grouping about the available output fields: all
808
fields except for ``oper_state``, ``oper_ram``, ``oper_vcpus`` and
809
``status`` are configuration value and not run-time values. So if
810
you don't select any of the these fields, the query will be
811
satisfied instantly from the cluster configuration, without having
812
to ask the remote nodes for the data. This can be helpful for big
813
clusters when you only want some data and it makes sense to specify
814
a reduced set of output fields.
815

    
816
The default output field list is: name, os, pnode, admin\_state,
817
oper\_state, oper\_ram.
818

    
819
INFO
820
^^^^
821

    
822
**info** [-s \| --static] [--roman] {--all \| *instance*}
823

    
824
Show detailed information about the given instance(s). This is
825
different from **list** as it shows detailed data about the
826
instance's disks (especially useful for the drbd disk template).
827

    
828
If the option ``-s`` is used, only information available in the
829
configuration file is returned, without querying nodes, making the
830
operation faster.
831

    
832
Use the ``--all`` to get info about all instances, rather than
833
explicitly passing the ones you're interested in.
834

    
835
The ``--roman`` option can be used to cause envy among people who
836
like ancient cultures, but are stuck with non-latin-friendly
837
cluster virtualization technologies.
838

    
839
MODIFY
840
^^^^^^
841

    
842
| **modify**
843
| [-H *HYPERVISOR\_PARAMETERS*]
844
| [-B *BACKEND\_PARAMETERS*]
845
| [--net add*[:options]* \| --net remove \| --net *N:options*]
846
| [--disk add:size=*SIZE*[,vg=*VG*] \| --disk remove \|
847
|  --disk *N*:mode=*MODE*]
848
| [-t plain | -t drbd -n *new_secondary*]
849
| [--os-name=*OS* [--force-variant]]
850
| [--submit]
851
| {*instance*}
852

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

    
858
The ``-H`` option specifies hypervisor options in the form of
859
name=value[,...]. For details which options can be specified, see
860
the **add** command.
861

    
862
The ``-t`` option will change the disk template of the instance.
863
Currently only conversions between the plain and drbd disk templates
864
are supported, and the instance must be stopped before attempting the
865
conversion. When changing from the plain to the drbd disk template, a
866
new secondary node must be specified via the ``-n`` option.
867

    
868
The ``--disk add:size=``*SIZE* option adds a disk to the instance. The
869
optional ``vg=``*VG* option specifies LVM volume group other than default
870
vg to create disk on. The ``--disk remove`` option will remove the last
871
disk of the instance. The ``--disk`` *N*``:mode=``*MODE* option will change
872
the mode of the Nth disk of the instance between read-only (``ro``) and
873
read-write (``rw``).
874

    
875
The ``--net add:``*options* option will add a new NIC to the
876
instance. The available options are the same as in the **add** command
877
(mac, ip, link, mode). The ``--net remove`` will remove the last NIC
878
of the instance, while the ``--net`` *N*:*options* option will
879
change the parameters of the Nth instance NIC.
880

    
881
The option ``--os-name`` will change the OS name for the instance
882
(without reinstallation). In case an OS variant is specified that
883
is not found, then by default the modification is refused, unless
884
``--force-variant`` is passed. An invalid OS will also be refused,
885
unless the ``--force`` option is given.
886

    
887
The ``--submit`` option is used to send the job to the master
888
daemon but not wait for its completion. The job ID will be shown so
889
that it can be examined via **gnt-job info**.
890

    
891
All the changes take effect at the next restart. If the instance is
892
running, there is no effect on the instance.
893

    
894
REINSTALL
895
^^^^^^^^^
896

    
897
| **reinstall** [-o *os-type*] [--select-os] [-f *force*]
898
| [--force-multiple]
899
| [--instance \| --node \| --primary \| --secondary \| --all]
900
| [-O *OS\_PARAMETERS*] [--submit] {*instance*...}
901

    
902
Reinstalls the operating system on the given instance(s). The
903
instance(s) must be stopped when running this command. If the
904
``--os-type`` is specified, the operating system is changed.
905

    
906
The ``--select-os`` option switches to an interactive OS reinstall.
907
The user is prompted to select the OS template from the list of
908
available OS templates. OS parameters can be overridden using
909
``-O``.
910

    
911
Since this is a potentially dangerous command, the user will be
912
required to confirm this action, unless the ``-f`` flag is passed.
913
When multiple instances are selected (either by passing multiple
914
arguments or by using the ``--node``, ``--primary``,
915
``--secondary`` or ``--all`` options), the user must pass the
916
``--force-multiple`` options to skip the interactive confirmation.
917

    
918
The ``--submit`` option is used to send the job to the master
919
daemon but not wait for its completion. The job ID will be shown so
920
that it can be examined via **gnt-job info**.
921

    
922
RENAME
923
^^^^^^
924

    
925
| **rename** [--no-ip-check] [--no-name-check] [--submit]
926
| {*instance*} {*new\_name*}
927

    
928
Renames the given instance. The instance must be stopped when
929
running this command. The requirements for the new name are the
930
same as for adding an instance: the new name must be resolvable and
931
the IP it resolves to must not be reachable (in order to prevent
932
duplicate IPs the next time the instance is started). The IP test
933
can be skipped if the ``--no-ip-check`` option is passed.
934

    
935
The ``--no-name-check`` skips the check for the new instance name
936
via the resolver (e.g. in DNS or /etc/hosts, depending on your
937
setup). Since the name check is used to compute the IP address, if
938
you pass this option you must also pass the ``--no-ip-check``
939
option.
940

    
941
The ``--submit`` option is used to send the job to the master
942
daemon but not wait for its completion. The job ID will be shown so
943
that it can be examined via **gnt-job info**.
944

    
945
Starting/stopping/connecting to console
946
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
947

    
948
STARTUP
949
^^^^^^^
950

    
951
| **startup**
952
| [--force] [--ignore-offline]
953
| [--force-multiple]
954
| [--instance \| --node \| --primary \| --secondary \| --all \|
955
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
956
| [-H ``key=value...``] [-B ``key=value...``]
957
| [--submit]
958
| {*name*...}
959

    
960
Starts one or more instances, depending on the following options.
961
The four available modes are:
962

    
963

    
964
--instance
965
    will start the instances given as arguments (at least one argument
966
    required); this is the default selection
967

    
968
--node
969
    will start the instances who have the given node as either primary
970
    or secondary
971

    
972
--primary
973
    will start all instances whose primary node is in the list of nodes
974
    passed as arguments (at least one node required)
975

    
976
--secondary
977
    will start all instances whose secondary node is in the list of
978
    nodes passed as arguments (at least one node required)
979

    
980
--all
981
    will start all instances in the cluster (no arguments accepted)
982

    
983
--tags
984
    will start all instances in the cluster with the tags given as
985
    arguments
986

    
987
--node-tags
988
    will start all instances in the cluster on nodes with the tags
989
    given as arguments
990

    
991
--pri-node-tags
992
    will start all instances in the cluster on primary nodes with the
993
    tags given as arguments
994

    
995
--sec-node-tags
996
    will start all instances in the cluster on secondary nodes with the
997
    tags given as arguments
998

    
999

    
1000
Note that although you can pass more than one selection option, the
1001
last one wins, so in order to guarantee the desired result, don't
1002
pass more than one such option.
1003

    
1004
Use ``--force`` to start even if secondary disks are failing.
1005
``--ignore-offline`` can be used to ignore offline primary nodes
1006
and mark the instance as started even if the primary is not
1007
available.
1008

    
1009
The ``--force-multiple`` will skip the interactive confirmation in
1010
the case the more than one instance will be affected.
1011

    
1012
The ``-H`` and ``-B`` options specify temporary hypervisor and
1013
backend parameters that can be used to start an instance with
1014
modified parameters. They can be useful for quick testing without
1015
having to modify an instance back and forth, e.g.::
1016

    
1017
    # gnt-instance start -H root_args="single" instance1
1018
    # gnt-instance start -B memory=2048 instance2
1019

    
1020

    
1021
The first form will start the instance instance1 in single-user
1022
mode, and the instance instance2 with 2GB of RAM (this time only,
1023
unless that is the actual instance memory size already). Note that
1024
the values override the instance parameters (and not extend them):
1025
an instance with "root\_args=ro" when started with -H
1026
root\_args=single will result in "single", not "ro single".
1027
The ``--submit`` option is used to send the job to the master
1028
daemon but not wait for its completion. The job ID will be shown so
1029
that it can be examined via **gnt-job info**.
1030

    
1031
Example::
1032

    
1033
    # gnt-instance start instance1.example.com
1034
    # gnt-instance start --node node1.example.com node2.example.com
1035
    # gnt-instance start --all
1036

    
1037

    
1038
SHUTDOWN
1039
^^^^^^^^
1040

    
1041
| **shutdown**
1042
| [--timeout=*N*]
1043
| [--force-multiple] [--ignore-offline]
1044
| [--instance \| --node \| --primary \| --secondary \| --all \|
1045
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
1046
| [--submit]
1047
| {*name*...}
1048

    
1049
Stops one or more instances. If the instance cannot be cleanly
1050
stopped during a hardcoded interval (currently 2 minutes), it will
1051
forcibly stop the instance (equivalent to switching off the power
1052
on a physical machine).
1053

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

    
1059
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1060
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1061
``--sec-node-tags`` options are similar as for the **startup**
1062
command and they influence the actual instances being shutdown.
1063

    
1064
The ``--submit`` option is used to send the job to the master
1065
daemon but not wait for its completion. The job ID will be shown so
1066
that it can be examined via **gnt-job info**.
1067

    
1068
``--ignore-offline`` can be used to ignore offline primary nodes
1069
and force the instance to be marked as stopped. This option should
1070
be used with care as it can lead to an inconsistent cluster state.
1071

    
1072
Example::
1073

    
1074
    # gnt-instance shutdown instance1.example.com
1075
    # gnt-instance shutdown --all
1076

    
1077

    
1078
REBOOT
1079
^^^^^^
1080

    
1081
| **reboot**
1082
| [--type=*REBOOT-TYPE*]
1083
| [--ignore-secondaries]
1084
| [--shutdown-timeout=*N*]
1085
| [--force-multiple]
1086
| [--instance \| --node \| --primary \| --secondary \| --all \|
1087
| --tags \| --node-tags \| --pri-node-tags \| --sec-node-tags]
1088
| [--submit]
1089
| [*name*...]
1090

    
1091
Reboots one or more instances. The type of reboot depends on the
1092
value of ``--type``. A soft reboot does a hypervisor reboot, a hard
1093
reboot does a instance stop, recreates the hypervisor config for
1094
the instance and starts the instance. A full reboot does the
1095
equivalent of **gnt-instance shutdown && gnt-instance startup**.
1096
The default is hard reboot.
1097

    
1098
For the hard reboot the option ``--ignore-secondaries`` ignores
1099
errors for the secondary node while re-assembling the instance
1100
disks.
1101

    
1102
The ``--instance``, ``--node``, ``--primary``, ``--secondary``,
1103
``--all``, ``--tags``, ``--node-tags``, ``--pri-node-tags`` and
1104
``--sec-node-tags`` options are similar as for the **startup**
1105
command and they influence the actual instances being rebooted.
1106

    
1107
The ``--shutdown-timeout`` is used to specify how much time to wait
1108
before forcing the shutdown (xm destroy in xen, killing the kvm
1109
process, for kvm). By default two minutes are given to each
1110
instance to stop.
1111

    
1112
The ``--force-multiple`` will skip the interactive confirmation in
1113
the case the more than one instance will be affected.
1114

    
1115
Example::
1116

    
1117
    # gnt-instance reboot instance1.example.com
1118
    # gnt-instance reboot --type=full instance1.example.com
1119

    
1120

    
1121
CONSOLE
1122
^^^^^^^
1123

    
1124
**console** [--show-cmd] {*instance*}
1125

    
1126
Connects to the console of the given instance. If the instance is
1127
not up, an error is returned. Use the ``--show-cmd`` option to
1128
display the command instead of executing it.
1129

    
1130
For HVM instances, this will attempt to connect to the serial
1131
console of the instance. To connect to the virtualized "physical"
1132
console of a HVM instance, use a VNC client with the connection
1133
info from the **info** command.
1134

    
1135
Example::
1136

    
1137
    # gnt-instance console instance1.example.com
1138

    
1139

    
1140
Disk management
1141
~~~~~~~~~~~~~~~
1142

    
1143
REPLACE-DISKS
1144
^^^^^^^^^^^^^
1145

    
1146
**replace-disks** [--submit] [--early-release] {-p} [--disks *idx*]
1147
{*instance*}
1148

    
1149
**replace-disks** [--submit] [--early-release] {-s} [--disks *idx*]
1150
{*instance*}
1151

    
1152
**replace-disks** [--submit] [--early-release] {--iallocator *name*
1153
\| --new-secondary *NODE*} {*instance*}
1154

    
1155
**replace-disks** [--submit] [--early-release] {--auto}
1156
{*instance*}
1157

    
1158
This command is a generalized form for replacing disks. It is
1159
currently only valid for the mirrored (DRBD) disk template.
1160

    
1161
The first form (when passing the ``-p`` option) will replace the
1162
disks on the primary, while the second form (when passing the
1163
``-s`` option will replace the disks on the secondary node. For
1164
these two cases (as the node doesn't change), it is possible to
1165
only run the replace for a subset of the disks, using the option
1166
``--disks`` which takes a list of comma-delimited disk indices
1167
(zero-based), e.g. 0,2 to replace only the first and third disks.
1168

    
1169
The third form (when passing either the ``--iallocator`` or the
1170
``--new-secondary`` option) is designed to change secondary node of
1171
the instance. Specifying ``--iallocator`` makes the new secondary
1172
be selected automatically by the specified allocator plugin,
1173
otherwise the new secondary node will be the one chosen manually
1174
via the ``--new-secondary`` option.
1175

    
1176
The fourth form (when using ``--auto``) will automatically
1177
determine which disks of an instance are faulty and replace them
1178
within the same node. The ``--auto`` option works only when an
1179
instance has only faulty disks on either the primary or secondary
1180
node; it doesn't work when both sides have faulty disks.
1181

    
1182
The ``--submit`` option is used to send the job to the master
1183
daemon but not wait for its completion. The job ID will be shown so
1184
that it can be examined via **gnt-job info**.
1185

    
1186
The ``--early-release`` changes the code so that the old storage on
1187
secondary node(s) is removed early (before the resync is completed)
1188
and the internal Ganeti locks for the current (and new, if any)
1189
secondary node are also released, thus allowing more parallelism in
1190
the cluster operation. This should be used only when recovering
1191
from a disk failure on the current secondary (thus the old storage
1192
is already broken) or when the storage on the primary node is known
1193
to be fine (thus we won't need the old storage for potential
1194
recovery).
1195

    
1196
Note that it is not possible to select an offline or drained node
1197
as a new secondary.
1198

    
1199
ACTIVATE-DISKS
1200
^^^^^^^^^^^^^^
1201

    
1202
**activate-disks** [--submit] [--ignore-size] {*instance*}
1203

    
1204
Activates the block devices of the given instance. If successful,
1205
the command will show the location and name of the block devices::
1206

    
1207
    node1.example.com:disk/0:/dev/drbd0
1208
    node1.example.com:disk/1:/dev/drbd1
1209

    
1210

    
1211
In this example, *node1.example.com* is the name of the node on
1212
which the devices have been activated. The *disk/0* and *disk/1*
1213
are the Ganeti-names of the instance disks; how they are visible
1214
inside the instance is hypervisor-specific. */dev/drbd0* and
1215
*/dev/drbd1* are the actual block devices as visible on the node.
1216
The ``--submit`` option is used to send the job to the master
1217
daemon but not wait for its completion. The job ID will be shown so
1218
that it can be examined via **gnt-job info**.
1219

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

    
1227
Note that it is safe to run this command while the instance is
1228
already running.
1229

    
1230
DEACTIVATE-DISKS
1231
^^^^^^^^^^^^^^^^
1232

    
1233
**deactivate-disks** [--submit] {*instance*}
1234

    
1235
De-activates the block devices of the given instance. Note that if
1236
you run this command for an instance with a drbd disk template,
1237
while it is running, it will not be able to shutdown the block
1238
devices on the primary node, but it will shutdown the block devices
1239
on the secondary nodes, thus breaking the replication.
1240

    
1241
The ``--submit`` option is used to send the job to the master
1242
daemon but not wait for its completion. The job ID will be shown so
1243
that it can be examined via **gnt-job info**.
1244

    
1245
GROW-DISK
1246
^^^^^^^^^
1247

    
1248
**grow-disk** [--no-wait-for-sync] [--submit] {*instance*} {*disk*}
1249
{*amount*}
1250

    
1251
Grows an instance's disk. This is only possible for instances
1252
having a plain or drbd disk template.
1253

    
1254
Note that this command only change the block device size; it will
1255
not grow the actual filesystems, partitions, etc. that live on that
1256
disk. Usually, you will need to:
1257

    
1258

    
1259

    
1260

    
1261
#. use **gnt-instance grow-disk**
1262

    
1263
#. reboot the instance (later, at a convenient time)
1264

    
1265
#. use a filesystem resizer, such as ext2online(8) or
1266
   xfs\_growfs(8) to resize the filesystem, or use fdisk(8) to change
1267
   the partition table on the disk
1268

    
1269

    
1270
The *disk* argument is the index of the instance disk to grow. The
1271
*amount* argument is given either as a number (and it represents
1272
the amount to increase the disk with in mebibytes) or can be given
1273
similar to the arguments in the create instance operation, with a
1274
suffix denoting the unit.
1275

    
1276
Note that the disk grow operation might complete on one node but
1277
fail on the other; this will leave the instance with
1278
different-sized LVs on the two nodes, but this will not create
1279
problems (except for unused space).
1280

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

    
1284
The ``--submit`` option is used to send the job to the master
1285
daemon but not wait for its completion. The job ID will be shown so
1286
that it can be examined via **gnt-job info**.
1287

    
1288
Example (increase the first disk for instance1 by 16GiB)::
1289

    
1290
    # gnt-instance grow-disk instance1.example.com 0 16g
1291

    
1292

    
1293
Also note that disk shrinking is not supported; use
1294
**gnt-backup export** and then **gnt-backup import** to reduce the
1295
disk size of an instance.
1296

    
1297
RECREATE-DISKS
1298
^^^^^^^^^^^^^^
1299

    
1300
**recreate-disks** [--submit] [--disks=``indices``] {*instance*}
1301

    
1302
Recreates the disks of the given instance, or only a subset of the
1303
disks (if the option ``disks`` is passed, which must be a
1304
comma-separated list of disk indices, starting from zero).
1305

    
1306
Note that this functionality should only be used for missing disks;
1307
if any of the given disks already exists, the operation will fail.
1308
While this is suboptimal, recreate-disks should hopefully not be
1309
needed in normal operation and as such the impact of this is low.
1310

    
1311
The ``--submit`` option is used to send the job to the master
1312
daemon but not wait for its completion. The job ID will be shown so
1313
that it can be examined via **gnt-job info**.
1314

    
1315
Recovery
1316
~~~~~~~~
1317

    
1318
FAILOVER
1319
^^^^^^^^
1320

    
1321
**failover** [-f] [--ignore-consistency] [--shutdown-timeout=*N*]
1322
[--submit] {*instance*}
1323

    
1324
Failover will fail the instance over its secondary node. This works
1325
only for instances having a drbd disk template.
1326

    
1327
Normally the failover will check the consistency of the disks
1328
before failing over the instance. If you are trying to migrate
1329
instances off a dead node, this will fail. Use the
1330
``--ignore-consistency`` option for this purpose. Note that this
1331
option can be dangerous as errors in shutting down the instance
1332
will be ignored, resulting in possibly having the instance running
1333
on two machines in parallel (on disconnected DRBD drives).
1334

    
1335
The ``--shutdown-timeout`` is used to specify how much time to wait
1336
before forcing the shutdown (xm destroy in xen, killing the kvm
1337
process, for kvm). By default two minutes are given to each
1338
instance to stop.
1339

    
1340
The ``--submit`` option is used to send the job to the master
1341
daemon but not wait for its completion. The job ID will be shown so
1342
that it can be examined via **gnt-job info**.
1343

    
1344
Example::
1345

    
1346
    # gnt-instance failover instance1.example.com
1347

    
1348

    
1349
MIGRATE
1350
^^^^^^^
1351

    
1352
**migrate** [-f] {--cleanup} {*instance*}
1353

    
1354
**migrate** [-f] [--non-live] [--migration-mode=live\|non-live]
1355
{*instance*}
1356

    
1357
Migrate will move the instance to its secondary node without
1358
shutdown. It only works for instances having the drbd8 disk
1359
template type.
1360

    
1361
The migration command needs a perfectly healthy instance, as we
1362
rely on the dual-master capability of drbd8 and the disks of the
1363
instance are not allowed to be degraded.
1364

    
1365
The ``--non-live`` and ``--migration-mode=non-live`` options will
1366
switch (for the hypervisors that support it) between a "fully live"
1367
(i.e. the interruption is as minimal as possible) migration and one
1368
in which the instance is frozen, its state saved and transported to
1369
the remote node, and then resumed there. This all depends on the
1370
hypervisor support for two different methods. In any case, it is
1371
not an error to pass this parameter (it will just be ignored if the
1372
hypervisor doesn't support it). The option
1373
``--migration-mode=live`` option will request a fully-live
1374
migration. The default, when neither option is passed, depends on
1375
the hypervisor parameters (and can be viewed with the
1376
**gnt-cluster info** command).
1377

    
1378
If the ``--cleanup`` option is passed, the operation changes from
1379
migration to attempting recovery from a failed previous migration.
1380
In this mode, Ganeti checks if the instance runs on the correct
1381
node (and updates its configuration if not) and ensures the
1382
instances's disks are configured correctly. In this mode, the
1383
``--non-live`` option is ignored.
1384

    
1385
The option ``-f`` will skip the prompting for confirmation.
1386

    
1387
Example (and expected output)::
1388

    
1389
    # gnt-instance migrate instance1
1390
    Migrate will happen to the instance instance1. Note that migration is
1391
    **experimental** in this version. This might impact the instance if
1392
    anything goes wrong. Continue?
1393
    y/[n]/?: y
1394
    * checking disk consistency between source and target
1395
    * ensuring the target is in secondary mode
1396
    * changing disks into dual-master mode
1397
     - INFO: Waiting for instance instance1 to sync disks.
1398
     - INFO: Instance instance1's disks are in sync.
1399
    * migrating instance to node2.example.com
1400
    * changing the instance's disks on source node to secondary
1401
     - INFO: Waiting for instance instance1 to sync disks.
1402
     - INFO: Instance instance1's disks are in sync.
1403
    * changing the instance's disks to single-master
1404
    #
1405

    
1406

    
1407
MOVE
1408
^^^^
1409

    
1410
**move** [-f] [-n *node*] [--shutdown-timeout=*N*] [--submit]
1411
{*instance*}
1412

    
1413
Move will move the instance to an arbitrary node in the cluster.
1414
This works only for instances having a plain or file disk
1415
template.
1416

    
1417
Note that since this operation is done via data copy, it will take
1418
a long time for big disks (similar to replace-disks for a drbd
1419
instance).
1420

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

    
1426
The ``--submit`` option is used to send the job to the master
1427
daemon but not wait for its completion. The job ID will be shown so
1428
that it can be examined via **gnt-job info**.
1429

    
1430
Example::
1431

    
1432
    # gnt-instance move -n node3.example.com instance1.example.com
1433

    
1434

    
1435
TAGS
1436
~~~~
1437

    
1438
ADD-TAGS
1439
^^^^^^^^
1440

    
1441
**add-tags** [--from *file*] {*instancename*} {*tag*...}
1442

    
1443
Add tags to the given instance. If any of the tags contains invalid
1444
characters, the entire operation will abort.
1445

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

    
1452
LIST-TAGS
1453
^^^^^^^^^
1454

    
1455
**list-tags** {*instancename*}
1456

    
1457
List the tags of the given instance.
1458

    
1459
REMOVE-TAGS
1460
^^^^^^^^^^^
1461

    
1462
**remove-tags** [--from *file*] {*instancename*} {*tag*...}
1463

    
1464
Remove tags from the given instance. If any of the tags are not
1465
existing on the node, the entire operation will abort.
1466

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