Statistics
| Branch: | Tag: | Revision:

root / man / gnt-instance.sgml @ 0b063b42

History | View | Annotate | Download (74.1 kB)

1
<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
2

    
3
  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
4
  <!-- Please adjust the date whenever revising the manpage. -->
5
  <!ENTITY dhdate      "<date>February 11, 2009</date>">
6
  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
7
       allowed: see man(7), man(1). -->
8
  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
9
  <!ENTITY dhucpackage "<refentrytitle>gnt-instance</refentrytitle>">
10
  <!ENTITY dhpackage   "gnt-instance">
11

    
12
  <!ENTITY debian      "<productname>Debian</productname>">
13
  <!ENTITY gnu         "<acronym>GNU</acronym>">
14
  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
15
  <!ENTITY footer SYSTEM "footer.sgml">
16
]>
17

    
18
<refentry>
19
  <refentryinfo>
20
    <copyright>
21
      <year>2006</year>
22
      <year>2007</year>
23
      <year>2008</year>
24
      <year>2009</year>
25
      <holder>Google Inc.</holder>
26
    </copyright>
27
    &dhdate;
28
  </refentryinfo>
29
  <refmeta>
30
    &dhucpackage;
31

    
32
    &dhsection;
33
    <refmiscinfo>ganeti 2.0</refmiscinfo>
34
  </refmeta>
35
  <refnamediv>
36
    <refname>&dhpackage;</refname>
37

    
38
    <refpurpose>ganeti instance administration</refpurpose>
39
  </refnamediv>
40
  <refsynopsisdiv>
41
    <cmdsynopsis>
42
      <command>&dhpackage; </command>
43

    
44
      <arg choice="req">command</arg>
45
      <arg>arguments...</arg>
46
    </cmdsynopsis>
47
  </refsynopsisdiv>
48
  <refsect1>
49
    <title>DESCRIPTION</title>
50

    
51
    <para>
52
      The <command>&dhpackage;</command> is used for instance
53
      administration in the ganeti system.
54
    </para>
55

    
56
  </refsect1>
57
  <refsect1>
58
    <title>COMMANDS</title>
59

    
60
    <refsect2>
61
      <title>Creation/removal/querying</title>
62

    
63
      <refsect3>
64
        <title>ADD</title>
65
        <cmdsynopsis>
66
          <command>add</command>
67
          <sbr>
68
          <arg choice="req">-t<group choice="req">
69
              <arg>diskless</arg>
70
              <arg>file</arg>
71
              <arg>plain</arg>
72
              <arg>drbd</arg>
73
            </group></arg>
74
          <sbr>
75

    
76
          <group choice="req">
77
            <arg rep="repeat">--disk=<replaceable>N</replaceable>:size=<replaceable>VAL</replaceable><arg>,mode=<replaceable>ro|rw</replaceable></arg></arg>
78
            <arg>-s <replaceable>SIZE</replaceable></arg>
79
          </group>
80
          <sbr>
81
          <group>
82
            <arg rep="repeat">--net=<replaceable>N</replaceable><arg rep="repeat">:options</arg></arg>
83
            <arg>--no-nics</arg>
84
          </group>
85
          <sbr>
86
          <arg>-B <replaceable>BEPARAMS</replaceable></arg>
87
          <sbr>
88

    
89
          <arg>-H <replaceable>HYPERVISOR</replaceable><arg>:<arg choice="plain" rep="repeat">option=<replaceable>value</replaceable></arg></arg></arg>
90
          <sbr>
91

    
92
          <arg>--file-storage-dir <replaceable>dir_path</replaceable></arg>
93
          <arg>--file-driver<group choice="req">
94
              <arg>loop</arg>
95
              <arg>blktap</arg>
96
            </group></arg>
97
          <sbr>
98

    
99
          <group choice="req">
100
            <arg>-n <replaceable>node<optional>:secondary-node</optional></replaceable></arg>
101
            <arg>--iallocator <replaceable>name</replaceable></arg>
102
          </group>
103
          <sbr>
104

    
105
          <arg choice="req">-o <replaceable>os-type</replaceable></arg>
106
          <sbr>
107
          <arg>--submit</arg>
108
          <sbr>
109

    
110
          <arg choice="req"><replaceable>instance</replaceable></arg>
111
        </cmdsynopsis>
112

    
113
        <para>
114
          Creates a new instance on the specified host. The
115
          <replaceable>instance</replaceable> argument must be in DNS,
116
          but depending on the bridge/routing setup, need not be in
117
          the same network as the nodes in the cluster.
118
        </para>
119

    
120
        <para>
121
          The <option>disk</option> option specifies the parameters
122
          for the disks of the instance. The numbering of disks starts
123
          at zero, and at least one disk needs to be passed. For each
124
          disk, at least the size needs to be given, and optionally
125
          the access mode (read-only or the default of read-write) can
126
          also be specified.  The size is interpreted (when no unit is
127
          given) in mebibytes. You can also use one of the suffixes
128
          <literal>m</literal>, <literal>g</literal> or
129
          <literal>t</literal> to specificy the exact the units used;
130
          these suffixes map to mebibytes, gibibytes and tebibytes.
131
        </para>
132

    
133
        <para>
134
          Alternatively, a single-disk instance can be created via the
135
          <option>-s</option> option which takes a single argument,
136
          the size of the disk. This is similar to the Ganeti 1.2
137
          version (but will only create one disk).
138
        </para>
139

    
140
        <para>
141
          The minimum disk specification is therefore
142
          <userinput>--disk 0:size=20G</userinput> (or <userinput>-s
143
          20G</userinput> when using the <option>-s</option> option),
144
          and a three-disk instance can be specified as
145
          <userinput>--disk 0:size=20G --disk 1:size=4G --disk
146
          2:size=100G</userinput>.
147
        </para>
148

    
149
        <para>
150
          The NICs of the instances can be specified via the
151
          <option>--net</option> option. By default, one NIC is
152
          created for the instance, with a random MAC, and set
153
          up according the the cluster level nic parameters.
154
          Each NIC can take these parameters (all optional):
155
          <variablelist>
156
            <varlistentry>
157
              <term>mac</term>
158
              <listitem>
159
                <simpara>either a value or <constant>GENERATE</constant>
160
                  to generate a new unique MAC</simpara>
161
              </listitem>
162
            </varlistentry>
163
            <varlistentry>
164
              <term>ip</term>
165
              <listitem>
166
                <simpara>specifies the IP address assigned to the
167
                  instance from the Ganeti side (this is not necessarily
168
                  what the instance will use, but what the node expects
169
                  the instance to use)</simpara>
170
              </listitem>
171
            </varlistentry>
172
            <varlistentry>
173
              <term>mode</term>
174
              <listitem>
175
                <simpara>specifies the connection mode for this nic:
176
                  routed or bridged.</simpara>
177
              </listitem>
178
            </varlistentry>
179
            <varlistentry>
180
              <term>link</term>
181
              <listitem>
182
                <simpara>in bridged mode specifies the bridge to attach
183
                  this NIC to, in routed mode it's intended to
184
                  differentiate between different routing tables/instance
185
                  groups (but the meaning is dependent on the network
186
                  script)</simpara>
187
              </listitem>
188
            </varlistentry>
189
          </variablelist>
190
          Of these "mode" and "link" are nic parameters, and inherit their
191
          default at cluster level.
192
        </para>
193

    
194
        <para>
195
          Alternatively, if no network is desired for the instance, you
196
          can prevent the default of one NIC with the
197
          <option>--no-nics</option> option.
198
        </para>
199

    
200
        <para>
201
          The <option>-o</option> options specifies the operating
202
          system to be installed. The available operating systems can
203
          be listed with <command>gnt-os list</command>.
204
        </para>
205

    
206
        <para>
207
          The <option>-B</option> option specifies the backend
208
          parameters for the instance. If no such parameters are
209
          specified, the values are inherited from the cluster. Possible
210
          parameters are:
211
          <variablelist>
212
            <varlistentry>
213
              <term>memory</term>
214
              <listitem>
215
                <simpara>the memory size of the instance; as usual,
216
                  suffixes can be used to denote the unit, otherwise the
217
                  value is taken in mebibites</simpara>
218
              </listitem>
219
            </varlistentry>
220
            <varlistentry>
221
              <term>vcpus</term>
222
              <listitem>
223
                <simpara>the number of VCPUs to assign to the instance
224
                  (if this value makes sense for the hypervisor)</simpara>
225
              </listitem>
226
            </varlistentry>
227
            <varlistentry>
228
              <term>auto_balance</term>
229
              <listitem>
230
                <simpara>whether the instance is considered in the N+1
231
                  cluster checks (enough redundancy in the cluster to
232
                  survive a node failure)</simpara>
233
              </listitem>
234
            </varlistentry>
235
          </variablelist>
236
        </para>
237

    
238
        <para>
239
          The <option>-H</option> option specified the hypervisor to
240
          use for the instance (must be one of the enabled hypervisors
241
          on the cluster) and optionally custom parameters for this
242
          instance. If not other options are used (i.e. the invocation
243
          is just <userinput>-H
244
          <replaceable>NAME</replaceable></userinput>) the instance
245
          will inherit the cluster options. The defaults below show
246
          the cluster defaults at cluster creation time.
247
        </para>
248

    
249
        <para>
250
          The possible hypervisor options are as follows:
251
          <variablelist>
252
            <varlistentry>
253
              <term>boot_order</term>
254
              <listitem>
255
                <simpara>Valid for the Xen HVM and KVM
256
                hypervisors.</simpara>
257

    
258
                <simpara>A string value denoting the boot order. This
259
                has different meaning for the Xen HVM hypervisor and
260
                for the KVM one.</simpara>
261

    
262
                <simpara>
263
                  For Xen HVM, The boot order is a string of letters
264
                  listing the boot devices, with valid device letters
265
                  being:
266
                </simpara>
267
                  <variablelist>
268
                    <varlistentry>
269
                      <term>a</term>
270
                      <listitem>
271
                        <para>
272
                          floppy drive
273
                        </para>
274
                      </listitem>
275
                    </varlistentry>
276
                    <varlistentry>
277
                      <term>c</term>
278
                      <listitem>
279
                        <para>
280
                          hard disk
281
                        </para>
282
                      </listitem>
283
                    </varlistentry>
284
                    <varlistentry>
285
                      <term>d</term>
286
                      <listitem>
287
                        <para>
288
                          CDROM drive
289
                        </para>
290
                      </listitem>
291
                    </varlistentry>
292
                    <varlistentry>
293
                      <term>n</term>
294
                      <listitem>
295
                        <para>
296
                          network boot (PXE)
297
                        </para>
298
                      </listitem>
299
                    </varlistentry>
300
                  </variablelist>
301
                <simpara>
302
                  The default is not to set an HVM boot order which is
303
                  interpreted as 'dc'.
304
                </simpara>
305

    
306
              </listitem>
307
            </varlistentry>
308
            <varlistentry>
309
              <term>cdrom_image_path</term>
310
              <listitem>
311
                <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
312

    
313
                <simpara>The path to a CDROM image to attach to the
314
                instance.</simpara>
315

    
316
              </listitem>
317
            </varlistentry>
318
            <varlistentry>
319
              <term>nic_type</term>
320
              <listitem>
321
                <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
322

    
323
                <para>
324
                  This parameter determines the way the network cards
325
                  are presented to the instance. The possible options are:
326
                  <simplelist>
327
                    <member>rtl8139 (default for Xen HVM) (HVM & KVM)</member>
328
                    <member>ne2k_isa (HVM & KVM)</member>
329
                    <member>ne2k_pci (HVM & KVM)</member>
330
                    <member>i82551 (KVM)</member>
331
                    <member>i82557b (KVM)</member>
332
                    <member>i82559er (KVM)</member>
333
                    <member>pcnet (KVM)</member>
334
                    <member>e1000 (KVM)</member>
335
                    <member>paravirtual (default for KVM) (HVM & KVM)</member>
336
                  </simplelist>
337
                </para>
338
              </listitem>
339
            </varlistentry>
340
            <varlistentry>
341
              <term>disk_type</term>
342
              <listitem>
343
                <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
344

    
345
                <para>
346
                  This parameter determines the way the disks are
347
                  presented to the instance. The possible options are:
348
                  <simplelist>
349
                    <member>ioemu (default for HVM & KVM) (HVM & KVM)</member>
350
                    <member>ide (HVM & KVM)</member>
351
                    <member>scsi (KVM)</member>
352
                    <member>sd (KVM)</member>
353
                    <member>mtd (KVM)</member>
354
                    <member>pflash (KVM)</member>
355
                  </simplelist>
356
                </para>
357
              </listitem>
358
            </varlistentry>
359
            <varlistentry>
360
              <term>vnc_bind_address</term>
361
              <listitem>
362
                <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
363

    
364
                <para>Specifies the address that the VNC listener for
365
                this instance should bind to. Valid values are IPv4
366
                addresses. Use the address 0.0.0.0 to bind to all
367
                available interfaces (this is the default) or specify
368
                the address of one of the interfaces on the node to
369
                restrict listening to that interface.</para>
370
              </listitem>
371
            </varlistentry>
372

    
373
            <varlistentry>
374
              <term>vnc_tls</term>
375
              <listitem>
376
                <simpara>Valid for the KVM hypervisor.</simpara>
377

    
378
                <simpara>A boolean option that controls whether the
379
                VNC connection is secured with TLS.</simpara>
380
              </listitem>
381
            </varlistentry>
382

    
383
            <varlistentry>
384
              <term>vnc_x509_path</term>
385
              <listitem>
386
                <simpara>Valid for the KVM hypervisor.</simpara>
387

    
388
                <para>If <option>vnc_tls</option> is enabled, this
389
                options specifies the path to the x509 certificate to
390
                use.</para>
391
              </listitem>
392
            </varlistentry>
393

    
394
            <varlistentry>
395
              <term>vnc_x509_verify</term>
396
              <listitem>
397
                <simpara>Valid for the KVM hypervisor.</simpara>
398
              </listitem>
399
            </varlistentry>
400

    
401
            <varlistentry>
402
              <term>acpi</term>
403
              <listitem>
404
                <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
405

    
406
                <para>
407
                  A boolean option that specifies if the hypervisor
408
                  should enable ACPI support for this instance. By
409
                  default, ACPI is disabled.
410
                </para>
411
              </listitem>
412
            </varlistentry>
413

    
414
            <varlistentry>
415
              <term>pae</term>
416
              <listitem>
417
                <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
418

    
419
                <para>
420
                  A boolean option that specifies if the hypervisor
421
                  should enabled PAE support for this instance. The
422
                  default is false, disabling PAE support.
423
                </para>
424
              </listitem>
425
            </varlistentry>
426

    
427
            <varlistentry>
428
              <term>kernel_path</term>
429
              <listitem>
430
                <simpara>Valid for the Xen PVM and KVM hypervisors.</simpara>
431

    
432
                <para>
433
                  This option specifies the path (on the node) to the
434
                  kernel to boot the instance with. Xen PVM instances
435
                  always require this, while for KVM if this option is
436
                  empty, it will cause the machine to load the kernel
437
                  from its disks.
438
                </para>
439
              </listitem>
440
            </varlistentry>
441

    
442
            <varlistentry>
443
              <term>kernel_args</term>
444
              <listitem>
445
                <simpara>Valid for the Xen PVM and KVM hypervisors.</simpara>
446

    
447
                <para>
448
                  This options specifies extra arguments to the kernel
449
                  that will be loaded.  device. This is always used
450
                  for Xen PVM, while for KVM it is only used if the
451
                  <option>kernel_path</option> option is also
452
                  specified.
453
                </para>
454

    
455
                <para>
456
                  The default setting for this value is simply
457
                  <constant>"ro"</constant>, which mounts the root
458
                  disk (initially) in read-only one. For example,
459
                  setting this to <userinput>single</userinput> will
460
                  cause the instance to start in single-user mode.
461
                </para>
462
              </listitem>
463
            </varlistentry>
464

    
465
            <varlistentry>
466
              <term>initrd_path</term>
467
              <listitem>
468
                <simpara>Valid for the Xen PVM and KVM hypervisors.</simpara>
469

    
470
                <para>
471
                  This option specifies the path (on the node) to the
472
                  initrd to boot the instance with. Xen PVM instances
473
                  can use this always, while for KVM if this option is
474
                  only used if the <option>kernel_path</option> option
475
                  is also specified. You can pass here either an
476
                  absolute filename (the path to the initrd) if you
477
                  want to use an initrd, or use the format
478
                  <userinput>no_initrd_path</userinput> for no initrd.
479
                </para>
480
              </listitem>
481
            </varlistentry>
482

    
483
            <varlistentry>
484
              <term>root_path</term>
485
              <listitem>
486
                <simpara>Valid for the Xen PVM and KVM hypervisors.</simpara>
487

    
488
                <para>
489
                  This options specifies the name of the root
490
                  device. This is always needed for Xen PVM, while for
491
                  KVM it is only used if the
492
                  <option>kernel_path</option> option is also
493
                  specified.
494
                </para>
495
              </listitem>
496
            </varlistentry>
497

    
498
            <varlistentry>
499
              <term>serial_console</term>
500
              <listitem>
501
                <simpara>Valid for the KVM hypervisor.</simpara>
502

    
503
                <simpara>This boolean option specifies whether to
504
                emulate a serial console for the instance.</simpara>
505
              </listitem>
506
            </varlistentry>
507
          </variablelist>
508
        </para>
509

    
510
        <para>
511
        </para>
512

    
513
        <para>
514
          The <option>--iallocator</option> option specifies the instance
515
          allocator plugin to use. If you pass in this option the allocator
516
          will select nodes for this instance automatically, so you don't need
517
          to pass them with the <option>-n</option> option. For more
518
          information please refer to the instance allocator documentation.
519
        </para>
520

    
521
        <para>
522
          The <option>-t</option> options specifies the disk layout type for
523
          the instance. The available choices are:
524
          <variablelist>
525
            <varlistentry>
526
              <term>diskless</term>
527
              <listitem>
528
                <para>
529
                  This creates an instance with no disks. Its useful for
530
                  testing only (or other special cases).
531
                </para>
532
              </listitem>
533
            </varlistentry>
534
            <varlistentry>
535
              <term>file</term>
536
              <listitem>
537
                <para>Disk devices will be regular files.</para>
538
              </listitem>
539
            </varlistentry>
540
            <varlistentry>
541
              <term>plain</term>
542
              <listitem>
543
                <para>Disk devices will be logical volumes.</para>
544
              </listitem>
545
            </varlistentry>
546
            <varlistentry>
547
              <term>drbd</term>
548
              <listitem>
549
                <para>
550
                  Disk devices will be drbd (version 8.x) on top of
551
                  lvm volumes.
552
                </para>
553
              </listitem>
554
            </varlistentry>
555
          </variablelist>
556
        </para>
557

    
558
        <para>
559
          The optional second value of the <option>--node</option> is used for
560
          the drbd template type and specifies the remote node.
561
        </para>
562

    
563
        <para>
564
          If you do not want gnt-instance to wait for the disk mirror
565
          to be synced, use the <option>--no-wait-for-sync</option>
566
          option.
567
        </para>
568

    
569
        <para>
570
          The <option>--file-storage-dir</option> specifies the relative path
571
          under the cluster-wide file storage directory to store file-based
572
          disks. It is useful for having different subdirectories for
573
          different instances. The full path of the directory where the disk
574
          files are stored will consist of cluster-wide file storage directory
575
          + optional subdirectory + instance name. Example:
576
          /srv/ganeti/file-storage/mysubdir/instance1.example.com. This option
577
          is only relevant for instances using the file storage backend.
578
        </para>
579

    
580
        <para>
581
          The <option>--file-driver</option> specifies the driver to use for
582
          file-based disks. Note that currently these drivers work with the
583
          xen hypervisor only. This option is only relevant for instances using
584
          the file storage backend. The available choices are:
585
          <variablelist>
586
            <varlistentry>
587
              <term>loop</term>
588
              <listitem>
589
                <para>
590
                  Kernel loopback driver. This driver uses loopback
591
                  devices to access the filesystem within the
592
                  file. However, running I/O intensive applications in
593
                  your instance using the loop driver might result in
594
                  slowdowns.  Furthermore, if you use the loopback
595
                  driver consider increasing the maximum amount of
596
                  loopback devices (on most systems it's 8) using the
597
                  max_loop param.
598
                </para>
599
              </listitem>
600
            </varlistentry>
601
            <varlistentry>
602
              <term>blktap</term>
603
              <listitem>
604
                <para>The blktap driver (for Xen hypervisors). In
605
                order to be able to use the blktap driver you should
606
                check if the 'blktapctrl' user space disk agent is
607
                running (usually automatically started via xend). This
608
                user-level disk I/O interface has the advantage of
609
                better performance. Especially if you use a network
610
                file system (e.g. NFS) to store your instances this is
611
                the recommended choice.
612
                </para>
613
              </listitem>
614
            </varlistentry>
615
          </variablelist>
616
        </para>
617

    
618
        <para>
619
          The <option>--submit</option> option is used to send the job to
620
          the master daemon but not wait for its completion. The job
621
          ID will be shown so that it can be examined via
622
          <command>gnt-job info</command>.
623
        </para>
624

    
625
        <para>
626
          Example:
627
          <screen>
628
# gnt-instance add -t file --disk 0:size=30g -B memory=512 -o debian-etch \
629
  -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
630
# gnt-instance add -t plain --disk 0:size=30g -B memory=512 -o debian-etch \
631
  -n node1.example.com instance1.example.com
632
# gnt-instance add -t drbd --disk 0:size=30g -B memory=512 -o debian-etch \
633
  -n node1.example.com:node2.example.com instance2.example.com
634
          </screen>
635
        </para>
636
      </refsect3>
637

    
638
      <refsect3>
639
        <title>BATCH-CREATE</title>
640
        <cmdsynopsis>
641
          <command>batch-create</command>
642
          <arg choice="req">instances_file.json</arg>
643
        </cmdsynopsis>
644

    
645
        <para>
646
          This command (similar to the Ganeti 1.2
647
          <command>batcher</command> tool) submits multiple instance
648
          creation jobs based on a definition file. The instance
649
          configurations do not encompass all the possible options for
650
          the <command>add</command> command, but only a subset.
651
        </para>
652

    
653
        <para>
654
          The instance file should be a valid-formed JSON file,
655
          containing a dictionary with instance name and instance
656
          parameters. The accepted parameters are:
657

    
658
          <variablelist>
659
            <varlistentry>
660
              <term>disk_size</term>
661
              <listitem>
662
                <simpara>The size of the disks of the instance.</simpara>
663
              </listitem>
664
            </varlistentry>
665
            <varlistentry>
666
              <term>disk_templace</term>
667
              <listitem>
668
                <simpara>The disk template to use for the instance,
669
                the same as in the <command>add</command>
670
                command.</simpara>
671
              </listitem>
672
            </varlistentry>
673
            <varlistentry>
674
              <term>backend</term>
675
              <listitem>
676
                <simpara>A dictionary of backend parameters.</simpara>
677
              </listitem>
678
            </varlistentry>
679
            <varlistentry>
680
              <term>hypervisor</term>
681
              <listitem>
682
                <simpara>A dictionary with a single key (the
683
                hypervisor name), and as value the hypervisor
684
                options. If not passed, the default hypervisor and
685
                hypervisor options will be inherited.</simpara>
686
              </listitem>
687
            </varlistentry>
688
            <varlistentry>
689
              <term>mac, ip, mode, link</term>
690
              <listitem>
691
                <simpara>Specifications for the one NIC that will be
692
                created for the instance. 'bridge' is also accepted
693
                as a backwards compatibile key.</simpara>
694
              </listitem>
695
            </varlistentry>
696
            <varlistentry>
697
              <term>nics</term>
698
              <listitem>
699
                <simpara>List of nics that will be created for the
700
                instance. Each entry should be a dict, with mac, ip, mode
701
                and link as possible keys. Please don't provide the "mac,
702
                ip, mode, link" parent keys if you use this method for
703
                specifying nics.</simpara>
704
              </listitem>
705
            </varlistentry>
706
            <varlistentry>
707
              <term>primary_node, secondary_node</term>
708
              <listitem>
709
                <simpara>The primary and optionally the secondary node
710
                to use for the instance (in case an iallocator script
711
                is not used).</simpara>
712
              </listitem>
713
            </varlistentry>
714
            <varlistentry>
715
              <term>iallocator</term>
716
              <listitem>
717
                <simpara>Instead of specifying the nodes, an
718
                iallocator script can be used to automatically compute
719
                them.</simpara>
720
              </listitem>
721
            </varlistentry>
722
            <varlistentry>
723
              <term>start</term>
724
              <listitem>
725
                <simpara>whether to start the instance</simpara>
726
              </listitem>
727
            </varlistentry>
728
            <varlistentry>
729
              <term>ip_check</term>
730
              <listitem>
731
                <simpara>Skip the check for already-in-use instance;
732
                see the description in the <command>add</command>
733
                command for details.</simpara>
734
              </listitem>
735
            </varlistentry>
736
            <varlistentry>
737
              <term>file_storage_dir, file_driver</term>
738
              <listitem>
739
                <simpara>Configuration for the <literal>file</literal>
740
                disk type, see the <command>add</command> command for
741
                details.</simpara>
742
              </listitem>
743
            </varlistentry>
744
          </variablelist>
745
        </para>
746

    
747
        <para>
748
          A simple definition for one instance can be (with most of
749
          the parameters taken from the cluster defaults):
750
          <screen>
751
{
752
  "instance3": {
753
    "template": "drbd",
754
    "os": "debootstrap",
755
    "disk_size": ["25G"],
756
    "iallocator": "dumb"
757
  },
758
  "instance5": {
759
    "template": "drbd",
760
    "os": "debootstrap",
761
    "disk_size": ["25G"],
762
    "iallocator": "dumb",
763
    "hypervisor": "xen-hvm",
764
    "hvparams": {"acpi": true},
765
    "backend": {"memory": 512}
766
  }
767
}
768
</screen>
769
        </para>
770

    
771
        <para>
772
          The command will display the job id for each submitted instance, as follows:
773
          <screen>
774
# gnt-instance batch-create instances.json
775
instance3: 11224
776
instance5: 11225
777
</screen>
778
        </para>
779

    
780
      </refsect3>
781

    
782
      <refsect3>
783
        <title>REMOVE</title>
784

    
785
        <cmdsynopsis>
786
          <command>remove</command>
787
          <arg>--ignore-failures</arg>
788
          <arg>--submit</arg>
789
          <arg choice="req"><replaceable>instance</replaceable></arg>
790
        </cmdsynopsis>
791

    
792
        <para>
793
          Remove an instance. This will remove all data from the
794
          instance and there is <emphasis>no way back</emphasis>. If
795
          you are not sure if you use an instance again, use
796
          <command>shutdown</command> first and leave it in the
797
          shutdown state for a while.
798

    
799
        </para>
800

    
801
        <para>
802
          The <option>--ignore-failures</option> option will cause the
803
          removal to proceed even in the presence of errors during the
804
          removal of the instance (e.g. during the shutdown or the
805
          disk removal). If this option is not given, the command will
806
          stop at the first error.
807
        </para>
808

    
809
        <para>
810
          The <option>--submit</option> option is used to send the job to
811
          the master daemon but not wait for its completion. The job
812
          ID will be shown so that it can be examined via
813
          <command>gnt-job info</command>.
814
        </para>
815

    
816
        <para>
817
          Example:
818
          <screen>
819
# gnt-instance remove instance1.example.com
820
          </screen>
821
        </para>
822
      </refsect3>
823

    
824
      <refsect3>
825
        <title>LIST</title>
826

    
827
        <cmdsynopsis>
828
          <command>list</command>
829
          <arg>--no-headers</arg>
830
          <arg>--separator=<replaceable>SEPARATOR</replaceable></arg>
831
          <arg>-o <replaceable>[+]FIELD,...</replaceable></arg>
832
          <arg rep="repeat">instance</arg>
833
        </cmdsynopsis>
834

    
835
        <para>
836
          Shows the currently configured instances with memory usage,
837
          disk usage, the node they are running on, and their run
838
          status.
839
        </para>
840

    
841
        <para>
842
          The <option>--no-headers</option> option will skip the
843
          initial header line. The <option>--separator</option> option
844
          takes an argument which denotes what will be used between
845
          the output fields. Both these options are to help scripting.
846
        </para>
847

    
848
        <para>
849
          The <option>-o</option> option takes a comma-separated list
850
          of output fields. The available fields and their meaning
851
          are:
852
          <variablelist>
853
            <varlistentry>
854
              <term>name</term>
855
              <listitem>
856
                <simpara>the instance name</simpara>
857
              </listitem>
858
            </varlistentry>
859
            <varlistentry>
860
              <term>os</term>
861
              <listitem>
862
                <simpara>the OS of the instance</simpara>
863
              </listitem>
864
            </varlistentry>
865
            <varlistentry>
866
              <term>pnode</term>
867
              <listitem>
868
                <simpara>the primary node of the instance</simpara>
869
              </listitem>
870
            </varlistentry>
871
            <varlistentry>
872
              <term>snodes</term>
873
              <listitem>
874
                <simpara>comma-separated list of secondary nodes for the
875
                  instance; usually this will be just one node</simpara>
876
              </listitem>
877
            </varlistentry>
878
            <varlistentry>
879
              <term>admin_state</term>
880
              <listitem>
881
                <simpara>the desired state of the instance (either "yes"
882
                  or "no" denoting the instance should run or
883
                  not)</simpara>
884
              </listitem>
885
            </varlistentry>
886
            <varlistentry>
887
              <term>disk_template</term>
888
              <listitem>
889
                <simpara>the disk template of the instance</simpara>
890
              </listitem>
891
            </varlistentry>
892
            <varlistentry>
893
              <term>oper_state</term>
894
              <listitem>
895
                <simpara>the actual state of the instance; can be
896
                one of the values "running", "stopped", "(node
897
                down)"</simpara>
898
              </listitem>
899
            </varlistentry>
900
            <varlistentry>
901
              <term>status</term>
902
              <listitem>
903
                <simpara>combined form of admin_state and oper_stat;
904
                this can be one of:
905
                <computeroutput>ERROR_nodedown</computeroutput> if the
906
                node of the instance is down,
907
                <computeroutput>ERROR_down</computeroutput> if the
908
                instance should run but is down,
909
                <computeroutput>ERROR_up</computeroutput> if the
910
                instance should be stopped but is actually running,
911
                <computeroutput>ADMIN_down</computeroutput> if the
912
                instance has been stopped (and is stopped) and
913
                <computeroutput>running</computeroutput> if the
914
                instance is set to be running (and is
915
                running)</simpara>
916
              </listitem>
917
            </varlistentry>
918
            <varlistentry>
919
              <term>oper_ram</term>
920
              <listitem>
921
                <simpara>the actual memory usage of the instance as seen
922
                  by the hypervisor</simpara>
923
              </listitem>
924
            </varlistentry>
925
            <varlistentry>
926
              <term>ip</term>
927
              <listitem>
928
                <simpara>the ip address ganeti recognizes as associated with
929
                the first instance interface</simpara>
930
              </listitem>
931
            </varlistentry>
932
            <varlistentry>
933
              <term>mac</term>
934
              <listitem>
935
                <simpara>the first instance interface MAC address</simpara>
936
              </listitem>
937
            </varlistentry>
938

    
939
            <varlistentry>
940
              <term>mode</term>
941
              <listitem>
942
                <simpara>the mode of the first instance NIC
943
                (routed or bridged)</simpara>
944
              </listitem>
945
            </varlistentry>
946
            <varlistentry>
947
              <term>link</term>
948
              <listitem>
949
                <simpara>the link of the first instance NIC
950
                </simpara>
951
              </listitem>
952
            </varlistentry>
953
            <varlistentry>
954
              <term>sda_size</term>
955
              <listitem>
956
                <simpara>the size of the instance's first disk</simpara>
957
              </listitem>
958
            </varlistentry>
959
            <varlistentry>
960
              <term>sdb_size</term>
961
              <listitem>
962
                <simpara>the size of the instance's second disk, if
963
                any</simpara>
964
              </listitem>
965
            </varlistentry>
966
            <varlistentry>
967
              <term>vcpus</term>
968
              <listitem>
969
                <simpara>the number of VCPUs allocated to the
970
                instance</simpara>
971
              </listitem>
972
            </varlistentry>
973
            <varlistentry>
974
              <term>tags</term>
975
              <listitem>
976
                <simpara>comma-separated list of the instances's
977
                tags</simpara>
978
              </listitem>
979
            </varlistentry>
980
            <varlistentry>
981
              <term>serial_no</term>
982
              <listitem>
983
                <simpara>the so called 'serial number' of the
984
                instance; this is a numeric field that is incremented
985
                each time the instance is modified, and it can be used
986
                to track modifications</simpara>
987
              </listitem>
988
            </varlistentry>
989
            <varlistentry>
990
              <term>network_port</term>
991
              <listitem>
992
                <simpara>If the instance has a network port assigned
993
                to it (e.g. for VNC connections), this will be shown,
994
                otherwise <literal>-</literal> will be
995
                displayed.</simpara>
996
              </listitem>
997
            </varlistentry>
998
            <varlistentry>
999
              <term>beparams</term>
1000
              <listitem>
1001
                <simpara>A text format of the entire beparams for the
1002
                instance. It's more useful to select individual fields
1003
                from this dictionary, see below.</simpara>
1004
              </listitem>
1005
            </varlistentry>
1006
            <varlistentry>
1007
              <term>disk.count</term>
1008
              <listitem>
1009
                <simpara>The number of instance disks.</simpara>
1010
              </listitem>
1011
            </varlistentry>
1012
            <varlistentry>
1013
              <term>disk.size/N</term>
1014
              <listitem>
1015
                <simpara>The size of the instance's Nth disk. This is
1016
                a more generic form of the <literal>sda_size</literal>
1017
                and <literal>sdb_size</literal> fields.</simpara>
1018
              </listitem>
1019
            </varlistentry>
1020
            <varlistentry>
1021
              <term>disk.sizes</term>
1022
              <listitem>
1023
                <simpara>A comma-separated list of the disk sizes for
1024
                this instance.</simpara>
1025
              </listitem>
1026
            </varlistentry>
1027
            <varlistentry>
1028
              <term>disk_usage</term>
1029
              <listitem>
1030
                <simpara>The total disk space used by this instance on
1031
                each of its nodes. This is not the instance-visible
1032
                disk size, but the actual disk "cost" of the
1033
                instance.</simpara>
1034
              </listitem>
1035
            </varlistentry>
1036
            <varlistentry>
1037
              <term>nic.mac/N</term>
1038
              <listitem>
1039
                <simpara>The MAC of the Nth instance NIC.</simpara>
1040
              </listitem>
1041
            </varlistentry>
1042
            <varlistentry>
1043
              <term>nic.ip/N</term>
1044
              <listitem>
1045
                <simpara>The IP address of the Nth instance NIC.</simpara>
1046
              </listitem>
1047
            </varlistentry>
1048
            <varlistentry>
1049
              <term>nic.mode/N</term>
1050
              <listitem>
1051
                <simpara>The mode of the Nth instance NIC</simpara>
1052
              </listitem>
1053
            </varlistentry>
1054
            <varlistentry>
1055
              <term>nic.link/N</term>
1056
              <listitem>
1057
                <simpara>The link of the Nth instance NIC</simpara>
1058
              </listitem>
1059
            </varlistentry>
1060
            <varlistentry>
1061
              <term>nic.macs</term>
1062
              <listitem>
1063
                <simpara>A comma-separated list of all the MACs of the
1064
                instance's NICs.</simpara>
1065
              </listitem>
1066
            </varlistentry>
1067
            <varlistentry>
1068
              <term>nic.ips</term>
1069
              <listitem>
1070
                <simpara>A comma-separated list of all the IP
1071
                addresses of the instance's NICs.</simpara>
1072
              </listitem>
1073
            </varlistentry>
1074
            <varlistentry>
1075
              <term>nic.modes</term>
1076
              <listitem>
1077
                <simpara>A comma-separated list of all the modes of the
1078
                instance's NICs.</simpara>
1079
              </listitem>
1080
            </varlistentry>
1081
            <varlistentry>
1082
              <term>nic.links</term>
1083
              <listitem>
1084
                <simpara>A comma-separated list of all the link parameters
1085
                of the instance's NICs.</simpara>
1086
              </listitem>
1087
            </varlistentry>
1088
            <varlistentry>
1089
              <term>nic.count</term>
1090
              <listitem>
1091
                <simpara>The number of instance nics.</simpara>
1092
              </listitem>
1093
            </varlistentry>
1094
            <varlistentry>
1095
              <term>hv/<replaceable>NAME</replaceable></term>
1096
              <listitem>
1097
                <simpara>The value of the hypervisor parameter called
1098
                <replaceable>NAME</replaceable>. For details of what
1099
                hypervisor parameters exist and their meaning, see the
1100
                <command>add</command> command.</simpara>
1101
              </listitem>
1102
            </varlistentry>
1103
            <varlistentry>
1104
              <term>be/memory</term>
1105
              <listitem>
1106
                <simpara>The configured memory for the instance.</simpara>
1107
              </listitem>
1108
            </varlistentry>
1109
            <varlistentry>
1110
              <term>be/vcpus</term>
1111
              <listitem>
1112
                <simpara>The configured number of VCPUs for the
1113
                instance.</simpara>
1114
              </listitem>
1115
            </varlistentry>
1116
            <varlistentry>
1117
              <term>be/auto_balance</term>
1118
              <listitem>
1119
                <simpara>Whether the instance is considered in N+1
1120
                checks.</simpara>
1121
              </listitem>
1122
            </varlistentry>
1123
          </variablelist>
1124
        </para>
1125

    
1126
        <para>
1127
          If the value of the option starts with the character
1128
          <constant>+</constant>, the new field(s) will be added to the
1129
          default list. This allows to quickly see the default list
1130
          plus a few other fields, instead of retyping the entire list
1131
          of fields.
1132
        </para>
1133

    
1134
        <para>
1135
          There is a subtle grouping about the available output
1136
          fields: all fields except for <option>oper_state</option>,
1137
          <option>oper_ram</option> and <option>status</option> are
1138
          configuration value and not run-time values. So if you don't
1139
          select any of the these fields, the query will be satisfied
1140
          instantly from the cluster configuration, without having to
1141
          ask the remote nodes for the data. This can be helpful for
1142
          big clusters when you only want some data and it makes sense
1143
          to specify a reduced set of output fields.
1144
        </para>
1145

    
1146
        <para>The default output field list is:
1147
          <simplelist type="inline">
1148
            <member>name</member>
1149
            <member>os</member>
1150
            <member>pnode</member>
1151
            <member>admin_state</member>
1152
            <member>oper_state</member>
1153
            <member>oper_ram</member>
1154
          </simplelist>.
1155
        </para>
1156
      </refsect3>
1157

    
1158
      <refsect3>
1159
        <title>INFO</title>
1160

    
1161
        <cmdsynopsis>
1162
          <command>info</command>
1163
          <group>
1164
            <arg>-s</arg>
1165
            <arg>--static</arg>
1166
          </group>
1167
          <group choice="req">
1168
            <arg>--all</arg>
1169
            <arg rep="repeat"><replaceable>instance</replaceable></arg>
1170
          </group>
1171
        </cmdsynopsis>
1172

    
1173
        <para>
1174
          Show detailed information about the given instance(s). This is
1175
          different from <command>list</command> as it shows detailed data
1176
          about the instance's disks (especially useful for the drbd disk
1177
          template).
1178
        </para>
1179

    
1180
        <para>
1181
          If the option <option>-s</option> is used, only information
1182
          available in the configuration file is returned, without
1183
          querying nodes, making the operation faster.
1184
        </para>
1185

    
1186
        <para>
1187
          Use the <option>--all</option> to get info about all instances,
1188
          rather than explicitely passing the ones you're interested in.
1189
        </para>
1190
      </refsect3>
1191

    
1192
      <refsect3>
1193
        <title>MODIFY</title>
1194

    
1195
        <cmdsynopsis>
1196
          <command>modify</command>
1197
          <sbr>
1198
          <arg choice="opt">-H <replaceable>HYPERVISOR_PARAMETERS</replaceable></arg>
1199
          <sbr>
1200
          <arg choice="opt">-B <replaceable>BACKEND_PARAMETERS</replaceable></arg>
1201
          <sbr>
1202
          <group>
1203
            <arg>--net add<replaceable><optional>:options</optional></replaceable></arg>
1204
            <arg>--net remove</arg>
1205
            <arg>--net <replaceable>N:options</replaceable></arg>
1206
          </group>
1207
          <sbr>
1208
          <group>
1209
            <arg>--disk add:size=<replaceable>SIZE</replaceable></arg>
1210
            <arg>--disk remove</arg>
1211
            <arg>--disk <replaceable>N</replaceable>:mode=<replaceable>MODE</replaceable></arg>
1212
          </group>
1213

    
1214
          <sbr>
1215
          <arg>--submit</arg>
1216
          <sbr>
1217
          <arg choice="req"><replaceable>instance</replaceable></arg>
1218
        </cmdsynopsis>
1219

    
1220
        <para>
1221
          Modifies the memory size, number of vcpus, ip address, MAC
1222
          address and/or nic parameters for an instance. It can also
1223
          add and remove disks and NICs to/from the instance. Note
1224
          that you need to give at least one of the arguments, otherwise
1225
          the command complains.
1226
        </para>
1227

    
1228
        <para>
1229
          The <option>-H</option> option specifies hypervisor options
1230
          in the form of <userinput>name=value[,...]</userinput>. For details which options can be specified, see the <command>add</command> command.
1231
        </para>
1232

    
1233
        <para>
1234
          The <option>--disk
1235
          add:size=<replaceable>SIZE</replaceable></option> option
1236
          adds a disk to the instance. The <option>--disk
1237
          remove</option> will remove the last disk of the
1238
          instance. The <option>--disk
1239
          <replaceable>N</replaceable>:mode=<replaceable>MODE</replaceable></option>
1240
          option will change the mode of the Nth disk of the instance
1241
          between read-only (<literal>ro</literal>) and read-write
1242
          (<literal>rw</literal>).
1243
        </para>
1244

    
1245
        <para>
1246
          The <option>--net
1247
          add:<replaceable>options</replaceable></option> option will
1248
          add a new NIC to the instance. The available options are the
1249
          same as in the <command>add</command> command (mac, ip, link,
1250
          mode). The <option>--net remove</option> will remove the
1251
          last NIC of the instance, while the <option>--net
1252
          <replaceable>N</replaceable>:<replaceable>options</replaceable></option>
1253
          option will change the parameters of the Nth instance NIC.
1254
        </para>
1255

    
1256
        <para>
1257
          The <option>--submit</option> option is used to send the job to
1258
          the master daemon but not wait for its completion. The job
1259
          ID will be shown so that it can be examined via
1260
          <command>gnt-job info</command>.
1261
        </para>
1262

    
1263
        <para>
1264
          All the changes take effect at the next restart. If the
1265
          instance is running, there is no effect on the instance.
1266
        </para>
1267
      </refsect3>
1268

    
1269
      <refsect3>
1270
        <title>REINSTALL</title>
1271

    
1272
        <cmdsynopsis>
1273
          <command>reinstall</command>
1274
          <arg choice="opt">-o <replaceable>os-type</replaceable></arg>
1275
          <arg>--select-os</arg>
1276
          <arg choice="opt">-f <replaceable>force</replaceable></arg>
1277
          <arg>--force-multiple</arg>
1278
          <sbr>
1279
          <group choice="opt">
1280
            <arg>--instance</arg>
1281
            <arg>--node</arg>
1282
            <arg>--primary</arg>
1283
            <arg>--secondary</arg>
1284
            <arg>--all</arg>
1285
          </group>
1286
          <arg>--submit</arg>
1287
          <arg choice="opt" rep="repeat"><replaceable>instance</replaceable></arg>
1288
        </cmdsynopsis>
1289

    
1290
        <para>
1291
          Reinstalls the operating system on the given instance(s). The
1292
          instance(s) must be stopped when running this command. If the
1293
          <option>--os-type</option> is specified, the operating
1294
          system is changed.
1295
        </para>
1296

    
1297
        <para>
1298
          The <option>--select-os</option> option switches to an
1299
          interactive OS reinstall. The user is prompted to select the OS
1300
          template from the list of available OS templates.
1301
        </para>
1302

    
1303
        <para>
1304
          Since this is a potentially dangerous command, the user will
1305
          be required to confirm this action, unless the
1306
          <option>-f</option> flag is passed. When multiple instances
1307
          are selected (either by passing multiple arguments or by
1308
          using the <option>--node</option>,
1309
          <option>--primary</option>, <option>--secondary</option> or
1310
          <option>--all</option> options), the user must pass both the
1311
          <option>--force</option> and
1312
          <option>--force-multiple</option> options to skip the
1313
          interactive confirmation.
1314
        </para>
1315

    
1316
        <para>
1317
          The <option>--submit</option> option is used to send the job to
1318
          the master daemon but not wait for its completion. The job
1319
          ID will be shown so that it can be examined via
1320
          <command>gnt-job info</command>.
1321
        </para>
1322

    
1323

    
1324
      </refsect3>
1325

    
1326
      <refsect3>
1327
        <title>RENAME</title>
1328

    
1329
        <cmdsynopsis>
1330
          <command>rename</command>
1331
          <arg>--no-ip-check</arg>
1332
          <arg>--submit</arg>
1333
          <arg choice="req"><replaceable>instance</replaceable></arg>
1334
          <arg choice="req"><replaceable>new_name</replaceable></arg>
1335
        </cmdsynopsis>
1336

    
1337
        <para>
1338
          Renames the given instance. The instance must be stopped
1339
          when running this command. The requirements for the new name
1340
          are the same as for adding an instance: the new name must be
1341
          resolvable and the IP it resolves to must not be reachable
1342
          (in order to prevent duplicate IPs the next time the
1343
          instance is started). The IP test can be skipped if the
1344
          <option>--no-ip-check</option> option is passed.
1345
        </para>
1346

    
1347
        <para>
1348
          The <option>--submit</option> option is used to send the job to
1349
          the master daemon but not wait for its completion. The job
1350
          ID will be shown so that it can be examined via
1351
          <command>gnt-job info</command>.
1352
        </para>
1353

    
1354
      </refsect3>
1355

    
1356
    </refsect2>
1357

    
1358
    <refsect2>
1359
      <title>Starting/stopping/connecting to console</title>
1360

    
1361
      <refsect3>
1362
        <title>STARTUP</title>
1363

    
1364
        <cmdsynopsis>
1365
          <command>startup</command>
1366
          <sbr>
1367
          <arg>--force</arg>
1368
          <sbr>
1369
          <arg>--force-multiple</arg>
1370
          <sbr>
1371
          <group choice="opt">
1372
            <arg>--instance</arg>
1373
            <arg>--node</arg>
1374
            <arg>--primary</arg>
1375
            <arg>--secondary</arg>
1376
            <arg>--all</arg>
1377
          </group>
1378
          <sbr>
1379
          <arg>-H <option>key=value...</option></arg>
1380
          <arg>-B <option>key=value...</option></arg>
1381
          <sbr>
1382
          <arg>--submit</arg>
1383
          <sbr>
1384
          <arg choice="opt"
1385
          rep="repeat"><replaceable>name</replaceable></arg>
1386
        </cmdsynopsis>
1387

    
1388
        <para>
1389
          Starts one or more instances, depending on the following
1390
          options. The four available modes are:
1391
          <variablelist>
1392
            <varlistentry>
1393
              <term><option>--instance</option></term>
1394
              <listitem>
1395
                <simpara>will start the instances given as arguments
1396
                (at least one argument required); this is the default
1397
                selection</simpara>
1398
              </listitem>
1399
            </varlistentry>
1400
            <varlistentry>
1401
              <term>--node</term>
1402
              <listitem>
1403
                <simpara>will start the instances who have the given
1404
                node as either primary or secondary</simpara>
1405
              </listitem>
1406
            </varlistentry>
1407
            <varlistentry>
1408
              <term><option>--primary</option></term>
1409
              <listitem>
1410
                <simpara>will start all instances whose primary node
1411
                is in the list of nodes passed as arguments (at least
1412
                one node required)</simpara>
1413
              </listitem>
1414
            </varlistentry>
1415
            <varlistentry>
1416
              <term><option>--secondary</option></term>
1417
              <listitem>
1418
                <simpara>will start all instances whose secondary node
1419
                is in the list of nodes passed as arguments (at least
1420
                one node required)</simpara>
1421
              </listitem>
1422
            </varlistentry>
1423
            <varlistentry>
1424
              <term>--all</term>
1425
              <listitem>
1426
                <simpara>will start all instances in the cluster (no
1427
                arguments accepted)</simpara>
1428
              </listitem>
1429
            </varlistentry>
1430
          </variablelist>
1431
        </para>
1432

    
1433
        <para>
1434
          Note that although you can pass more than one selection
1435
          option, the last one wins, so in order to guarantee the
1436
          desired result, don't pass more than one such option.
1437
        </para>
1438

    
1439
        <para>
1440
          Use <option>--force</option> to start even if secondary disks are
1441
          failing.
1442
        </para>
1443

    
1444
        <para>
1445
          The <option>--force-multiple</option> will skip the
1446
          interactive confirmation in the case the more than one
1447
          instance will be affected.
1448
        </para>
1449

    
1450
        <para>
1451
          The <option>-H</option> and <option>-B</option> options
1452
          specify extra, temporary hypervisor and backend parameters
1453
          that can be used to start an instance with modified
1454
          parameters. They can be useful for quick testing without
1455
          having to modify an instance back and forth, e.g.:
1456
          <screen>
1457
# gnt-instance start -H root_args="single" instance1
1458
# gnt-instance start -B memory=2048 instance2
1459
          </screen>
1460
          The first form will start the instance
1461
          <userinput>instance1</userinput> in single-user mode, and
1462
          the instance <userinput>instance2</userinput> with 2GB of
1463
          RAM (this time only, unless that is the actual instance
1464
          memory size already).
1465
        </para>
1466

    
1467
        <para>
1468
          The <option>--submit</option> option is used to send the job to
1469
          the master daemon but not wait for its completion. The job
1470
          ID will be shown so that it can be examined via
1471
          <command>gnt-job info</command>.
1472
        </para>
1473

    
1474
        <para>
1475
          Example:
1476
          <screen>
1477
# gnt-instance start instance1.example.com
1478
# gnt-instance start --node node1.example.com node2.example.com
1479
# gnt-instance start --all
1480
          </screen>
1481
        </para>
1482
      </refsect3>
1483

    
1484
      <refsect3>
1485
        <title>SHUTDOWN</title>
1486

    
1487
        <cmdsynopsis>
1488
          <command>shutdown</command>
1489
          <sbr>
1490
          <arg>--force-multiple</arg>
1491
          <sbr>
1492
          <group choice="opt">
1493
            <arg>--instance</arg>
1494
            <arg>--node</arg>
1495
            <arg>--primary</arg>
1496
            <arg>--secondary</arg>
1497
            <arg>--all</arg>
1498
          </group>
1499
          <sbr>
1500
          <arg>--submit</arg>
1501
          <sbr>
1502
          <arg choice="opt"
1503
          rep="repeat"><replaceable>name</replaceable></arg>
1504
        </cmdsynopsis>
1505

    
1506
        <para>
1507
          Stops one or more instances. If the instance cannot be
1508
          cleanly stopped during a hardcoded interval (currently 2
1509
          minutes), it will forcibly stop the instance (equivalent to
1510
          switching off the power on a physical machine).
1511
        </para>
1512

    
1513
        <para>
1514
          The <option>--instance</option>, <option>--node</option>,
1515
          <option>--primary</option>, <option>--secondary</option> and
1516
          <option>--all</option> options are similar as for the
1517
          <command>startup</command> command and they influence the
1518
          actual instances being shutdown.
1519
        </para>
1520

    
1521
        <para>
1522
          The <option>--submit</option> option is used to send the job to
1523
          the master daemon but not wait for its completion. The job
1524
          ID will be shown so that it can be examined via
1525
          <command>gnt-job info</command>.
1526
        </para>
1527

    
1528

    
1529
        <para>
1530
          Example:
1531
          <screen>
1532
# gnt-instance shutdown instance1.example.com
1533
# gnt-instance shutdown --all
1534
          </screen>
1535
        </para>
1536
      </refsect3>
1537

    
1538
      <refsect3>
1539
        <title>REBOOT</title>
1540

    
1541
        <cmdsynopsis>
1542
          <command>reboot</command>
1543
          <sbr>
1544
          <arg>--type=<replaceable>REBOOT-TYPE</replaceable></arg>
1545
          <sbr>
1546
          <arg>--ignore-secondaries</arg>
1547
          <sbr>
1548
          <arg>--force-multiple</arg>
1549
          <sbr>
1550
          <group choice="opt">
1551
            <arg>--instance</arg>
1552
            <arg>--node</arg>
1553
            <arg>--primary</arg>
1554
            <arg>--secondary</arg>
1555
            <arg>--all</arg>
1556
          </group>
1557
          <sbr>
1558
          <arg>--submit</arg>
1559
          <sbr>
1560
          <arg choice="opt"
1561
          rep="repeat"><replaceable>name</replaceable></arg>
1562
        </cmdsynopsis>
1563

    
1564
        <para>
1565
          Reboots one or more instances. The type of reboot depends on
1566
          the value of <option>--type</option>. A soft reboot does a
1567
          hypervisor reboot, a hard reboot does a instance stop,
1568
          recreates the hypervisor config for the instance and
1569
          starts the instance. A full reboot does the equivalent
1570
          of <command>gnt-instance shutdown &amp;&amp; gnt-instance
1571
          startup</command>. The default is hard reboot.
1572
        </para>
1573

    
1574
        <para>
1575
          For the hard reboot the option
1576
          <option>--ignore-secondaries</option> ignores errors for the
1577
          secondary node while re-assembling the instance disks.
1578
        </para>
1579

    
1580
        <para>
1581
          The <option>--instance</option>, <option>--node</option>,
1582
          <option>--primary</option>, <option>--secondary</option> and
1583
          <option>--all</option> options are similar as for the
1584
          <command>startup</command> command and they influence the
1585
          actual instances being rebooted.
1586
        </para>
1587

    
1588
        <para>
1589
          The <option>--force-multiple</option> will skip the
1590
          interactive confirmation in the case the more than one
1591
          instance will be affected.
1592
        </para>
1593

    
1594
        <para>
1595
          Example:
1596
          <screen>
1597
# gnt-instance reboot instance1.example.com
1598
# gnt-instance reboot --type=full instance1.example.com
1599
          </screen>
1600
        </para>
1601
      </refsect3>
1602

    
1603
      <refsect3>
1604
        <title>CONSOLE</title>
1605
        <cmdsynopsis>
1606
          <command>console</command>
1607
          <arg choice="opt">--show-cmd</arg>
1608
          <arg choice="req"><replaceable>instance</replaceable></arg>
1609
        </cmdsynopsis>
1610

    
1611
        <para>
1612
          Connects to the console of the given instance. If the
1613
          instance is not up, an error is returned. Use the
1614
          <option>--show-cmd</option> option to display the command
1615
          instead of executing it.
1616
        </para>
1617

    
1618
        <para>
1619
          For HVM instances, this will attempt to connect to the
1620
          serial console of the instance. To connect to the
1621
          virtualized "physical" console of a HVM instance, use a VNC
1622
          client with the connection info from the
1623
          <command>info</command> command.
1624
        </para>
1625

    
1626
        <para>
1627
          Example:
1628
          <screen>
1629
# gnt-instance console instance1.example.com
1630
          </screen>
1631
        </para>
1632
      </refsect3>
1633

    
1634
    </refsect2>
1635

    
1636
    <refsect2>
1637
      <title>Disk management</title>
1638

    
1639
      <refsect3>
1640
        <title>REPLACE-DISKS</title>
1641

    
1642
        <cmdsynopsis>
1643
          <command>replace-disks</command>
1644
          <arg>--submit</arg>
1645
          <arg choice="req">-p</arg>
1646
          <arg>--disks <replaceable>idx</replaceable></arg>
1647
          <arg choice="req"><replaceable>instance</replaceable></arg>
1648
        </cmdsynopsis>
1649

    
1650
        <cmdsynopsis>
1651
          <command>replace-disks</command>
1652
          <arg>--submit</arg>
1653
          <arg choice="req">-s</arg>
1654
          <arg>--disks <replaceable>idx</replaceable></arg>
1655
          <arg choice="req"><replaceable>instance</replaceable></arg>
1656
        </cmdsynopsis>
1657

    
1658
        <cmdsynopsis>
1659
          <command>replace-disks</command>
1660
          <arg>--submit</arg>
1661
          <group choice="req">
1662
            <arg>--iallocator <replaceable>name</replaceable></arg>
1663
            <arg>--new-secondary <replaceable>NODE</replaceable></arg>
1664
          </group>
1665

    
1666
          <arg choice="req"><replaceable>instance</replaceable></arg>
1667
        </cmdsynopsis>
1668

    
1669
        <para>
1670
          This command is a generalized form for replacing disks. It
1671
          is currently only valid for the mirrored (DRBD) disk
1672
          template.
1673
        </para>
1674

    
1675
        <para>
1676
          The first form (when passing the <option>-p</option> option)
1677
          will replace the disks on the primary, while the second form
1678
          (when passing the <option>-s</option> option will replace
1679
          the disks on the secondary node. For these two cases (as the
1680
          node doesn't change), it is possible to only run the replace
1681
          for a subset of the disks, using the option
1682
          <option>--disks</option> which takes a list of
1683
          comma-delimited disk indices (zero-based),
1684
          e.g. <userinput>0,2</userinput> to replace only the first
1685
          and third disks.
1686
        </para>
1687

    
1688
        <para>
1689
          The third form (when passing either the
1690
          <option>--iallocator</option> or the
1691
          <option>--new-secondary</option> option) is designed to
1692
          change secondary node of the instance.  Specifying
1693
          <option>--iallocator</option> makes the new secondary be
1694
          selected automatically by the specified allocator plugin,
1695
          otherwise the new secondary node will be the one chosen
1696
          manually via the <option>--new-secondary</option> option.
1697
        </para>
1698

    
1699
        <para>
1700
          The <option>--submit</option> option is used to send the job to
1701
          the master daemon but not wait for its completion. The job
1702
          ID will be shown so that it can be examined via
1703
          <command>gnt-job info</command>.
1704
        </para>
1705

    
1706
        <para>
1707
          Note that it is not possible to select an offline or drained
1708
          node as a new secondary.
1709
        </para>
1710

    
1711
      </refsect3>
1712

    
1713
      <refsect3>
1714
        <title>ACTIVATE-DISKS</title>
1715

    
1716
        <cmdsynopsis>
1717
          <command>activate-disks</command>
1718
          <arg>--submit</arg>
1719
          <arg choice="req"><replaceable>instance</replaceable></arg>
1720
        </cmdsynopsis>
1721
        <para>
1722
          Activates the block devices of the given instance. If
1723
          successful, the command will show the location and name of
1724
          the block devices:
1725
          <screen>
1726
node1.example.com:disk/0:/dev/drbd0
1727
node1.example.com:disk/1:/dev/drbd1
1728
          </screen>
1729

    
1730
          In this example, <emphasis>node1.example.com</emphasis> is
1731
          the name of the node on which the devices have been
1732
          activated. The <emphasis>disk/0</emphasis> and
1733
          <emphasis>disk/1</emphasis> are the Ganeti-names of the
1734
          instance disks; how they are visible inside the instance is
1735
          hypervisor-specific. <emphasis>/dev/drbd0</emphasis> and
1736
          <emphasis>/dev/drbd1</emphasis> are the actual block devices
1737
          as visible on the node.
1738
        </para>
1739

    
1740
        <para>
1741
          The <option>--submit</option> option is used to send the job to
1742
          the master daemon but not wait for its completion. The job
1743
          ID will be shown so that it can be examined via
1744
          <command>gnt-job info</command>.
1745
        </para>
1746

    
1747
        <para>
1748
          Note that it is safe to run this command while the instance
1749
          is already running.
1750
        </para>
1751
      </refsect3>
1752

    
1753
      <refsect3>
1754
        <title>DEACTIVATE-DISKS</title>
1755

    
1756
        <cmdsynopsis>
1757
          <command>deactivate-disks</command>
1758
          <arg>--submit</arg>
1759
          <arg choice="req"><replaceable>instance</replaceable></arg>
1760
        </cmdsynopsis>
1761
        <para>
1762
          De-activates the block devices of the given instance. Note
1763
          that if you run this command for an instance with a drbd
1764
          disk template, while it is running, it will not be able to
1765
          shutdown the block devices on the primary node, but it will
1766
          shutdown the block devices on the secondary nodes, thus
1767
          breaking the replication.
1768
        </para>
1769

    
1770
        <para>
1771
          The <option>--submit</option> option is used to send the job to
1772
          the master daemon but not wait for its completion. The job
1773
          ID will be shown so that it can be examined via
1774
          <command>gnt-job info</command>.
1775
        </para>
1776

    
1777
      </refsect3>
1778

    
1779
      <refsect3>
1780
        <title>GROW-DISK</title>
1781
        <cmdsynopsis>
1782
          <command>grow-disk</command>
1783
          <arg>--no-wait-for-sync</arg>
1784
          <arg>--submit</arg>
1785
          <arg choice="req"><replaceable>instance</replaceable></arg>
1786
          <arg choice="req"><replaceable>disk</replaceable></arg>
1787
          <arg choice="req"><replaceable>amount</replaceable></arg>
1788
        </cmdsynopsis>
1789

    
1790
        <para>
1791
          Grows an instance's disk. This is only possible for
1792
          instances having a <literal>plain</literal> or
1793
          <literal>drbd</literal> disk template.
1794
        </para>
1795

    
1796
        <para>
1797
          Note that this command only change the block device size; it
1798
          will not grow the actual filesystems, partitions, etc. that
1799
          live on that disk. Usually, you will need to:
1800
          <orderedlist>
1801
            <listitem>
1802
              <simpara>use <command>gnt-instance grow-disk</command></simpara>
1803
            </listitem>
1804
            <listitem>
1805
              <simpara>reboot the instance (later, at a convenient
1806
              time)</simpara>
1807
            </listitem>
1808
            <listitem>
1809
              <simpara>use a filesystem resizer, such as
1810
              <citerefentry> <refentrytitle>ext2online</refentrytitle>
1811
              <manvolnum>8</manvolnum> </citerefentry> or
1812
              <citerefentry> <refentrytitle>xfs_growfs</refentrytitle>
1813
              <manvolnum>8</manvolnum> </citerefentry> to resize the
1814
              filesystem, or use <citerefentry>
1815
              <refentrytitle>fdisk</refentrytitle>
1816
              <manvolnum>8</manvolnum> </citerefentry> to change the
1817
              partition table on the disk
1818
              </simpara>
1819
            </listitem>
1820
          </orderedlist>
1821
        </para>
1822

    
1823

    
1824
        <para>
1825
          The <replaceable>disk</replaceable> argument is the index of
1826
          the instance disk to grow. The
1827
          <replaceable>amount</replaceable> argument is given either
1828
          as a number (and it represents the amount to increase the
1829
          disk with in mebibytes) or can be given similar to the
1830
          arguments in the create instance operation, with a suffix
1831
          denoting the unit.
1832
        </para>
1833

    
1834
        <para>
1835
          Note that the disk grow operation might complete on one node
1836
          but fail on the other; this will leave the instance with
1837
          different-sized LVs on the two nodes, but this will not
1838
          create problems (except for unused space).
1839
        </para>
1840

    
1841
        <para>
1842
          If you do not want gnt-instance to wait for the new disk
1843
          region to be synced, use the
1844
          <option>--no-wait-for-sync</option> option.
1845
        </para>
1846

    
1847
        <para>
1848
          The <option>--submit</option> option is used to send the job to
1849
          the master daemon but not wait for its completion. The job
1850
          ID will be shown so that it can be examined via
1851
          <command>gnt-job info</command>.
1852
        </para>
1853

    
1854

    
1855
        <para>Example (increase the first disk for instance1 by 16GiB):
1856
          <screen>
1857
# gnt-instance grow-disk instance1.example.com 0 16g
1858
          </screen>
1859
        </para>
1860

    
1861
        <para>
1862
          Also note that disk shrinking is not supported; use
1863
          <command>gnt-backup export</command> and then
1864
          <command>gnt-backup import</command> to reduce the disk size
1865
          of an instance.
1866
        </para>
1867
      </refsect3>
1868

    
1869
    </refsect2>
1870

    
1871
    <refsect2>
1872
      <title>Recovery</title>
1873

    
1874
      <refsect3>
1875
        <title>FAILOVER</title>
1876

    
1877
        <cmdsynopsis>
1878
          <command>failover</command>
1879
          <arg>-f</arg>
1880
          <arg>--ignore-consistency</arg>
1881
          <arg>--submit</arg>
1882
          <arg choice="req"><replaceable>instance</replaceable></arg>
1883
        </cmdsynopsis>
1884

    
1885
        <para>
1886
          Failover will fail the instance over its secondary
1887
          node. This works only for instances having a drbd disk
1888
          template.
1889
        </para>
1890

    
1891
        <para>
1892
          Normally the failover will check the consistency of the
1893
          disks before failing over the instance. If you are trying to
1894
          migrate instances off a dead node, this will fail. Use the
1895
          <option>--ignore-consistency</option> option for this
1896
          purpose. Note that this option can be dangerous as errors in
1897
          shutting down the instance will be ignored, resulting in
1898
          possibly having the instance running on two machines in
1899
          parallel (on disconnected DRBD drives).
1900
        </para>
1901

    
1902
        <para>
1903
          The <option>--submit</option> option is used to send the job to
1904
          the master daemon but not wait for its completion. The job
1905
          ID will be shown so that it can be examined via
1906
          <command>gnt-job info</command>.
1907
        </para>
1908

    
1909
        <para>
1910
          Example:
1911
          <screen>
1912
# gnt-instance failover instance1.example.com
1913
          </screen>
1914
        </para>
1915
      </refsect3>
1916

    
1917
      <refsect3>
1918
        <title>MIGRATE</title>
1919

    
1920
        <cmdsynopsis>
1921
          <command>migrate</command>
1922
          <arg>-f</arg>
1923
          <arg choice="req">--cleanup</arg>
1924
          <arg choice="req"><replaceable>instance</replaceable></arg>
1925
        </cmdsynopsis>
1926

    
1927
        <cmdsynopsis>
1928
          <command>migrate</command>
1929
          <arg>-f</arg>
1930
          <arg>--non-live</arg>
1931
          <arg choice="req"><replaceable>instance</replaceable></arg>
1932
        </cmdsynopsis>
1933

    
1934
        <para>
1935
          Migrate will move the instance to its secondary node without
1936
          shutdown. It only works for instances having the drbd8 disk
1937
          template type.
1938
        </para>
1939

    
1940
        <para>
1941
          The migration command needs a perfectly healthy instance, as
1942
          we rely on the dual-master capability of drbd8 and the disks
1943
          of the instance are not allowed to be degraded.
1944
        </para>
1945

    
1946
        <para>
1947
          The <option>--non-live</option> option will switch (for the
1948
          hypervisors that support it) between a "fully live"
1949
          (i.e. the interruption is as minimal as possible) migration
1950
          and one in which the instance is frozen, its state saved and
1951
          transported to the remote node, and then resumed there. This
1952
          all depends on the hypervisor support for two different
1953
          methods. In any case, it is not an error to pass this
1954
          parameter (it will just be ignored if the hypervisor doesn't
1955
          support it).
1956
        </para>
1957

    
1958
        <para>
1959
          If the <option>--cleanup</option> option is passed, the
1960
          operation changes from migration to attempting recovery from
1961
          a failed previous migration. In this mode, ganeti checks if
1962
          the instance runs on the correct node (and updates its
1963
          configuration if not) and ensures the instances's disks are
1964
          configured correctly. In this mode, the
1965
          <option>--non-live</option> option is ignored.
1966
        </para>
1967

    
1968
        <para>
1969
          The option <option>-f</option> will skip the prompting for
1970
          confirmation.
1971
        </para>
1972
        <para>
1973
          Example (and expected output):
1974
          <screen>
1975
# gnt-instance migrate instance1
1976
Migrate will happen to the instance instance1. Note that migration is
1977
**experimental** in this version. This might impact the instance if
1978
anything goes wrong. Continue?
1979
y/[n]/?: y
1980
* checking disk consistency between source and target
1981
* ensuring the target is in secondary mode
1982
* changing disks into dual-master mode
1983
 - INFO: Waiting for instance instance1 to sync disks.
1984
 - INFO: Instance instance1's disks are in sync.
1985
* migrating instance to node2.example.com
1986
* changing the instance's disks on source node to secondary
1987
 - INFO: Waiting for instance instance1 to sync disks.
1988
 - INFO: Instance instance1's disks are in sync.
1989
* changing the instance's disks to single-master
1990
#
1991
          </screen>
1992
        </para>
1993
      </refsect3>
1994

    
1995
    </refsect2>
1996

    
1997
    <refsect2>
1998
      <title>TAGS</title>
1999

    
2000
    <refsect3>
2001
        <title>ADD-TAGS</title>
2002

    
2003
        <cmdsynopsis>
2004
          <command>add-tags</command>
2005
          <arg choice="opt">--from <replaceable>file</replaceable></arg>
2006
          <arg choice="req"><replaceable>instancename</replaceable></arg>
2007
          <arg choice="req"
2008
            rep="repeat"><replaceable>tag</replaceable></arg>
2009
        </cmdsynopsis>
2010

    
2011
        <para>
2012
          Add tags to the given instance. If any of the tags contains
2013
          invalid characters, the entire operation will abort.
2014
        </para>
2015
        <para>
2016
          If the <option>--from</option> option is given, the list of
2017
          tags will be extended with the contents of that file (each
2018
          line becomes a tag). In this case, there is not need to pass
2019
          tags on the command line (if you do, both sources will be
2020
          used). A file name of - will be interpreted as stdin.
2021
        </para>
2022
      </refsect3>
2023

    
2024
      <refsect3>
2025
        <title>LIST-TAGS</title>
2026

    
2027
        <cmdsynopsis>
2028
          <command>list-tags</command>
2029
          <arg choice="req"><replaceable>instancename</replaceable></arg>
2030
        </cmdsynopsis>
2031

    
2032
        <para>List the tags of the given instance.</para>
2033
      </refsect3>
2034

    
2035
      <refsect3>
2036
        <title>REMOVE-TAGS</title>
2037
        <cmdsynopsis>
2038
          <command>remove-tags</command>
2039
          <arg choice="opt">--from <replaceable>file</replaceable></arg>
2040
          <arg choice="req"><replaceable>instancename</replaceable></arg>
2041
          <arg choice="req"
2042
            rep="repeat"><replaceable>tag</replaceable></arg>
2043
        </cmdsynopsis>
2044

    
2045
        <para>
2046
          Remove tags from the given instance. If any of the tags are
2047
          not existing on the node, the entire operation will abort.
2048
        </para>
2049

    
2050
        <para>
2051
          If the <option>--from</option> option is given, the list of
2052
          tags will be extended with the contents of that file (each
2053
          line becomes a tag). In this case, there is not need to pass
2054
          tags on the command line (if you do, both sources will be
2055
          used). A file name of - will be interpreted as stdin.
2056
        </para>
2057
      </refsect3>
2058

    
2059
    </refsect2>
2060

    
2061
  </refsect1>
2062

    
2063
  &footer;
2064

    
2065
</refentry>
2066

    
2067
<!-- Keep this comment at the end of the file
2068
Local variables:
2069
mode: sgml
2070
sgml-omittag:t
2071
sgml-shorttag:t
2072
sgml-minimize-attributes:nil
2073
sgml-always-quote-attributes:t
2074
sgml-indent-step:2
2075
sgml-indent-data:t
2076
sgml-parent-document:nil
2077
sgml-default-dtd-file:nil
2078
sgml-exposed-tags:nil
2079
sgml-local-catalogs:nil
2080
sgml-local-ecat-files:nil
2081
End:
2082
-->