watcher: autoarchive old jobs
[ganeti-local] / man / gnt-instance.sgml
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 setup, need not be in the same
117           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>--nic</option> option. By default, one NIC is
152           created for the instance, with a random MAC, and connected
153           to the default bridge. Each NIC can take up to three
154           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>bridge</term>
174               <listitem>
175                 <simpara>specifies the bridge to attach this NIC
176                   to</simpara>
177               </listitem>
178             </varlistentry>
179           </variablelist>
180         </para>
181
182         <para>
183           Alternatively, if no network is desired for the instance, you
184           can prevent the default of one NIC with the
185           <option>--no-nics</option> option.
186         </para>
187
188         <para>
189           The <option>-o</option> options specifies the operating
190           system to be installed. The available operating systems can
191           be listed with <command>gnt-os list</command>.
192         </para>
193
194         <para>
195           The <option>-B</option> option specifies the backend
196           parameters for the instance. If no such parameters are
197           specified, the values are inherited from the cluster. Possible
198           parameters are:
199           <variablelist>
200             <varlistentry>
201               <term>memory</term>
202               <listitem>
203                 <simpara>the memory size of the instance; as usual,
204                   suffixes can be used to denote the unit, otherwise the
205                   value is taken in mebibites</simpara>
206               </listitem>
207             </varlistentry>
208             <varlistentry>
209               <term>vcpus</term>
210               <listitem>
211                 <simpara>the number of VCPUs to assign to the instance
212                   (if this value makes sense for the hypervisor)</simpara>
213               </listitem>
214             </varlistentry>
215             <varlistentry>
216               <term>auto_balance</term>
217               <listitem>
218                 <simpara>whether the instance is considered in the N+1
219                   cluster checks (enough redundancy in the cluster to
220                   survive a node failure)</simpara>
221               </listitem>
222             </varlistentry>
223           </variablelist>
224         </para>
225
226         <para>
227           The <option>-H</option> option specified the hypervisor to
228           use for the instance (must be one of the enabled hypervisors
229           on the cluster) and optionally custom parameters for this
230           instance. If not other options are used (i.e. the invocation
231           is just <userinput>-H
232           <replaceable>NAME</replaceable></userinput>) the instance
233           will inherit the cluster options. The defaults below show
234           the cluster defaults at cluster creation time.
235         </para>
236
237         <para>
238           The possible hypervisor options are as follows:
239           <variablelist>
240             <varlistentry>
241               <term>boot_order</term>
242               <listitem>
243                 <simpara>Valid for the Xen HVM and KVM
244                 hypervisors.</simpara>
245
246                 <simpara>A string value denoting the boot order. This
247                 has different meaning for the Xen HVM hypervisor and
248                 for the KVM one.</simpara>
249
250                 <simpara>
251                   For Xen HVM, The boot order is a string of letters
252                   listing the boot devices, with valid device letters
253                   being:
254                 </simpara>
255                   <variablelist>
256                     <varlistentry>
257                       <term>a</term>
258                       <listitem>
259                         <para>
260                           floppy drive
261                         </para>
262                       </listitem>
263                     </varlistentry>
264                     <varlistentry>
265                       <term>c</term>
266                       <listitem>
267                         <para>
268                           hard disk
269                         </para>
270                       </listitem>
271                     </varlistentry>
272                     <varlistentry>
273                       <term>d</term>
274                       <listitem>
275                         <para>
276                           CDROM drive
277                         </para>
278                       </listitem>
279                     </varlistentry>
280                     <varlistentry>
281                       <term>n</term>
282                       <listitem>
283                         <para>
284                           network boot (PXE)
285                         </para>
286                       </listitem>
287                     </varlistentry>
288                   </variablelist>
289                 <simpara>
290                   The default is not to set an HVM boot order which is
291                   interpreted as 'dc'.
292                 </simpara>
293
294               </listitem>
295             </varlistentry>
296             <varlistentry>
297               <term>cdrom_image_path</term>
298               <listitem>
299                 <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
300
301                 <simpara>The path to a CDROM image to attach to the
302                 instance.</simpara>
303
304               </listitem>
305             </varlistentry>
306             <varlistentry>
307               <term>nic_type</term>
308               <listitem>
309                 <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
310
311                 <para>
312                   This parameter determines the way the network cards
313                   are presented to the instance. The possible options are:
314                   <simplelist>
315                     <member>rtl8139 (default for Xen HVM) (HVM & KVM)</member>
316                     <member>ne2k_isa (HVM & KVM)</member>
317                     <member>ne2k_pci (HVM & KVM)</member>
318                     <member>i82551 (KVM)</member>
319                     <member>i82557b (KVM)</member>
320                     <member>i82559er (KVM)</member>
321                     <member>pcnet (KVM)</member>
322                     <member>e1000 (KVM)</member>
323                     <member>paravirtual (default for KVM) (HVM & KVM)</member>
324                   </simplelist>
325                 </para>
326               </listitem>
327             </varlistentry>
328             <varlistentry>
329               <term>disk_type</term>
330               <listitem>
331                 <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
332
333                 <para>
334                   This parameter determines the way the disks are
335                   presented to the instance. The possible options are:
336                   <simplelist>
337                     <member>ioemu (default for HVM & KVM) (HVM & KVM)</member>
338                     <member>ide (HVM & KVM)</member>
339                     <member>scsi (KVM)</member>
340                     <member>sd (KVM)</member>
341                     <member>mtd (KVM)</member>
342                     <member>pflash (KVM)</member>
343                   </simplelist>
344                 </para>
345               </listitem>
346             </varlistentry>
347             <varlistentry>
348               <term>vnc_bind_address</term>
349               <listitem>
350                 <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
351
352                 <para>Specifies the address that the VNC listener for
353                 this instance should bind to. Valid values are IPv4
354                 addresses. Use the address 0.0.0.0 to bind to all
355                 available interfaces (this is the default) or specify
356                 the address of one of the interfaces on the node to
357                 restrict listening to that interface.</para>
358               </listitem>
359             </varlistentry>
360
361             <varlistentry>
362               <term>vnc_tls</term>
363               <listitem>
364                 <simpara>Valid for the KVM hypervisor.</simpara>
365
366                 <simpara>A boolean option that controls whether the
367                 VNC connection is secured with TLS.</simpara>
368               </listitem>
369             </varlistentry>
370
371             <varlistentry>
372               <term>vnc_x509_path</term>
373               <listitem>
374                 <simpara>Valid for the KVM hypervisor.</simpara>
375
376                 <para>If <option>vnc_tls</option> is enabled, this
377                 options specifies the path to the x509 certificate to
378                 use.</para>
379               </listitem>
380             </varlistentry>
381
382             <varlistentry>
383               <term>vnc_x509_verify</term>
384               <listitem>
385                 <simpara>Valid for the KVM hypervisor.</simpara>
386               </listitem>
387             </varlistentry>
388
389             <varlistentry>
390               <term>acpi</term>
391               <listitem>
392                 <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
393
394                 <para>
395                   A boolean option that specifies if the hypervisor
396                   should enable ACPI support for this instance. By
397                   default, ACPI is disabled.
398                 </para>
399               </listitem>
400             </varlistentry>
401
402             <varlistentry>
403               <term>pae</term>
404               <listitem>
405                 <simpara>Valid for the Xen HVM and KVM hypervisors.</simpara>
406
407                 <para>
408                   A boolean option that specifies if the hypervisor
409                   should enabled PAE support for this instance. The
410                   default is false, disabling PAE support.
411                 </para>
412               </listitem>
413             </varlistentry>
414
415             <varlistentry>
416               <term>kernel_path</term>
417               <listitem>
418                 <simpara>Valid for the Xen PVM and KVM hypervisors.</simpara>
419
420                 <para>
421                   This option specifies the path (on the node) to the
422                   kernel to boot the instance with. Xen PVM instances
423                   always require this, while for KVM if this option is
424                   empty, it will cause the machine to load the kernel
425                   from its disks.
426                 </para>
427               </listitem>
428             </varlistentry>
429
430             <varlistentry>
431               <term>initrd_path</term>
432               <listitem>
433                 <simpara>Valid for the Xen PVM and KVM hypervisors.</simpara>
434
435                 <para>
436                   This option specifies the path (on the node) to the
437                   initrd to boot the instance with. Xen PVM instances
438                   can use this always, while for KVM if this option is
439                   only used if the <option>kernel_path</option> option
440                   is also specified.
441                 </para>
442               </listitem>
443             </varlistentry>
444
445             <varlistentry>
446               <term>root_path</term>
447               <listitem>
448                 <simpara>Valid for the Xen PVM and KVM hypervisors.</simpara>
449
450                 <para>
451                   This options specifies the name of the root
452                   device. This is always needed for Xen PVM, while for
453                   KVM it is only used if the
454                   <option>kernel_path</option> option is also
455                   specified.
456                 </para>
457               </listitem>
458             </varlistentry>
459
460             <varlistentry>
461               <term>serial_console</term>
462               <listitem>
463                 <simpara>Valid for the KVM hypervisor.</simpara>
464
465                 <simpara>This boolean option specifies whether to
466                 emulate a serial console for the instance.</simpara>
467               </listitem>
468             </varlistentry>
469           </variablelist>
470         </para>
471
472         <para>
473         </para>
474
475         <para>
476           The <option>--iallocator</option> option specifies the instance
477           allocator plugin to use. If you pass in this option the allocator
478           will select nodes for this instance automatically, so you don't need
479           to pass them with the <option>-n</option> option. For more
480           information please refer to the instance allocator documentation.
481         </para>
482
483         <para>
484           The <option>-t</option> options specifies the disk layout type for
485           the instance. The available choices are:
486           <variablelist>
487             <varlistentry>
488               <term>diskless</term>
489               <listitem>
490                 <para>
491                   This creates an instance with no disks. Its useful for
492                   testing only (or other special cases).
493                 </para>
494               </listitem>
495             </varlistentry>
496             <varlistentry>
497               <term>file</term>
498               <listitem>
499                 <para>Disk devices will be regular files.</para>
500               </listitem>
501             </varlistentry>
502             <varlistentry>
503               <term>plain</term>
504               <listitem>
505                 <para>Disk devices will be logical volumes.</para>
506               </listitem>
507             </varlistentry>
508             <varlistentry>
509               <term>drbd</term>
510               <listitem>
511                 <para>
512                   Disk devices will be drbd (version 8.x) on top of
513                   lvm volumes.
514                 </para>
515               </listitem>
516             </varlistentry>
517           </variablelist>
518         </para>
519
520         <para>
521           The optional second value of the <option>--node</option> is used for
522           the drbd template type and specifies the remote node.
523         </para>
524
525         <para>
526           If you do not want gnt-instance to wait for the disk mirror
527           to be synced, use the <option>--no-wait-for-sync</option>
528           option.
529         </para>
530
531         <para>
532           The <option>--file-storage-dir</option> specifies the relative path
533           under the cluster-wide file storage directory to store file-based
534           disks. It is useful for having different subdirectories for
535           different instances. The full path of the directory where the disk
536           files are stored will consist of cluster-wide file storage directory
537           + optional subdirectory + instance name. Example:
538           /srv/ganeti/file-storage/mysubdir/instance1.example.com. This option
539           is only relevant for instances using the file storage backend.
540         </para>
541
542         <para>
543           The <option>--file-driver</option> specifies the driver to use for
544           file-based disks. Note that currently these drivers work with the
545           xen hypervisor only. This option is only relevant for instances using
546           the file storage backend. The available choices are:
547           <variablelist>
548             <varlistentry>
549               <term>loop</term>
550               <listitem>
551                 <para>
552                   Kernel loopback driver. This driver uses loopback
553                   devices to access the filesystem within the
554                   file. However, running I/O intensive applications in
555                   your instance using the loop driver might result in
556                   slowdowns.  Furthermore, if you use the loopback
557                   driver consider increasing the maximum amount of
558                   loopback devices (on most systems it's 8) using the
559                   max_loop param.
560                 </para>
561               </listitem>
562             </varlistentry>
563             <varlistentry>
564               <term>blktap</term>
565               <listitem>
566                 <para>The blktap driver (for Xen hypervisors). In
567                 order to be able to use the blktap driver you should
568                 check if the 'blktapctrl' user space disk agent is
569                 running (usually automatically started via xend). This
570                 user-level disk I/O interface has the advantage of
571                 better performance. Especially if you use a network
572                 file system (e.g. NFS) to store your instances this is
573                 the recommended choice.
574                 </para>
575               </listitem>
576             </varlistentry>
577           </variablelist>
578         </para>
579
580         <para>
581           The <option>--submit</option> option is used to send the job to
582           the master daemon but not wait for its completion. The job
583           ID will be shown so that it can be examined via
584           <command>gnt-job info</command>.
585         </para>
586
587         <para>
588           Example:
589           <screen>
590 # gnt-instance add -t file --disk 0:size=30g -B memory=512 -o debian-etch \
591   -n node1.example.com --file-storage-dir=mysubdir instance1.example.com
592 # gnt-instance add -t plain --disk 0:size=30g -B memory=512 -o debian-etch \
593   -n node1.example.com instance1.example.com
594 # gnt-instance add -t drbd --disk 0:size=30g -B memory=512 -o debian-etch \
595   -n node1.example.com:node2.example.com instance2.example.com
596           </screen>
597         </para>
598       </refsect3>
599
600       <refsect3>
601         <title>BATCH-CREATE</title>
602         <cmdsynopsis>
603           <command>batch-create</command>
604           <arg choice="req">instances_file.json</arg>
605         </cmdsynopsis>
606
607         <para>
608           This command (similar to the Ganeti 1.2
609           <command>batcher</command> tool) submits multiple instance
610           creation jobs based on a definition file. The instance
611           configurations do not encompass all the possible options for
612           the <command>add</command> command, but only a subset.
613         </para>
614
615         <para>
616           The instance file should be a valid-formed JSON file,
617           containing a dictionary with instance name and instance
618           parameters. The accepted parameters are:
619
620           <variablelist>
621             <varlistentry>
622               <term>disk_size</term>
623               <listitem>
624                 <simpara>The size of the disks of the instance.</simpara>
625               </listitem>
626             </varlistentry>
627             <varlistentry>
628               <term>disk_templace</term>
629               <listitem>
630                 <simpara>The disk template to use for the instance,
631                 the same as in the <command>add</command>
632                 command.</simpara>
633               </listitem>
634             </varlistentry>
635             <varlistentry>
636               <term>backend</term>
637               <listitem>
638                 <simpara>A dictionary of backend parameters.</simpara>
639               </listitem>
640             </varlistentry>
641             <varlistentry>
642               <term>hypervisor</term>
643               <listitem>
644                 <simpara>A dictionary with a single key (the
645                 hypervisor name), and as value the hypervisor
646                 options. If not passed, the default hypervisor and
647                 hypervisor options will be inherited.</simpara>
648               </listitem>
649             </varlistentry>
650             <varlistentry>
651               <term>mac, ip, bridge</term>
652               <listitem>
653                 <simpara>Specifications for the one NIC that will be
654                 created for the instance.</simpara>
655               </listitem>
656             </varlistentry>
657             <varlistentry>
658               <term>primary_node, secondary_node</term>
659               <listitem>
660                 <simpara>The primary and optionally the secondary node
661                 to use for the instance (in case an iallocator script
662                 is not used).</simpara>
663               </listitem>
664             </varlistentry>
665             <varlistentry>
666               <term>iallocator</term>
667               <listitem>
668                 <simpara>Instead of specifying the nodes, an
669                 iallocator script can be used to automatically compute
670                 them.</simpara>
671               </listitem>
672             </varlistentry>
673             <varlistentry>
674               <term>start</term>
675               <listitem>
676                 <simpara>whether to start the instance</simpara>
677               </listitem>
678             </varlistentry>
679             <varlistentry>
680               <term>ip_check</term>
681               <listitem>
682                 <simpara>Skip the check for already-in-use instance;
683                 see the description in the <command>add</command>
684                 command for details.</simpara>
685               </listitem>
686             </varlistentry>
687             <varlistentry>
688               <term>file_storage_dir, file_driver</term>
689               <listitem>
690                 <simpara>Configuration for the <literal>file</literal>
691                 disk type, see the <command>add</command> command for
692                 details.</simpara>
693               </listitem>
694             </varlistentry>
695           </variablelist>
696         </para>
697
698         <para>
699           A simple definition for one instance can be (with most of
700           the parameters taken from the cluster defaults):
701           <screen>
702 {
703   "instance3": {
704     "template": "drbd",
705     "os": "debootstrap",
706     "disk_size": ["25G"],
707     "iallocator": "dumb"
708   },
709   "instance5": {
710     "template": "drbd",
711     "os": "debootstrap",
712     "disk_size": ["25G"],
713     "iallocator": "dumb",
714     "hypervisor": "xen-hvm",
715     "hvparams": {"acpi": true},
716     "backend": {"memory": 512}
717   }
718 }
719 </screen>
720         </para>
721
722         <para>
723           The command will display the job id for each submitted instance, as follows:
724           <screen>
725 # gnt-instance batch-create instances.json
726 instance3: 11224
727 instance5: 11225
728 </screen>
729         </para>
730
731       </refsect3>
732
733       <refsect3>
734         <title>REMOVE</title>
735
736         <cmdsynopsis>
737           <command>remove</command>
738           <arg>--ignore-failures</arg>
739           <arg>--submit</arg>
740           <arg choice="req"><replaceable>instance</replaceable></arg>
741         </cmdsynopsis>
742
743         <para>
744           Remove an instance. This will remove all data from the
745           instance and there is <emphasis>no way back</emphasis>. If
746           you are not sure if you use an instance again, use
747           <command>shutdown</command> first and leave it in the
748           shutdown state for a while.
749
750         </para>
751
752         <para>
753           The <option>--ignore-failures</option> option will cause the
754           removal to proceed even in the presence of errors during the
755           removal of the instance (e.g. during the shutdown or the
756           disk removal). If this option is not given, the command will
757           stop at the first error.
758         </para>
759
760         <para>
761           The <option>--submit</option> option is used to send the job to
762           the master daemon but not wait for its completion. The job
763           ID will be shown so that it can be examined via
764           <command>gnt-job info</command>.
765         </para>
766
767         <para>
768           Example:
769           <screen>
770 # gnt-instance remove instance1.example.com
771           </screen>
772         </para>
773       </refsect3>
774
775       <refsect3>
776         <title>LIST</title>
777
778         <cmdsynopsis>
779           <command>list</command>
780           <arg>--no-headers</arg>
781           <arg>--separator=<replaceable>SEPARATOR</replaceable></arg>
782           <arg>-o <replaceable>[+]FIELD,...</replaceable></arg>
783           <arg rep="repeat">instance</arg>
784         </cmdsynopsis>
785
786         <para>
787           Shows the currently configured instances with memory usage,
788           disk usage, the node they are running on, and their run
789           status.
790         </para>
791
792         <para>
793           The <option>--no-headers</option> option will skip the
794           initial header line. The <option>--separator</option> option
795           takes an argument which denotes what will be used between
796           the output fields. Both these options are to help scripting.
797         </para>
798
799         <para>
800           The <option>-o</option> option takes a comma-separated list
801           of output fields. The available fields and their meaning
802           are:
803           <variablelist>
804             <varlistentry>
805               <term>name</term>
806               <listitem>
807                 <simpara>the instance name</simpara>
808               </listitem>
809             </varlistentry>
810             <varlistentry>
811               <term>os</term>
812               <listitem>
813                 <simpara>the OS of the instance</simpara>
814               </listitem>
815             </varlistentry>
816             <varlistentry>
817               <term>pnode</term>
818               <listitem>
819                 <simpara>the primary node of the instance</simpara>
820               </listitem>
821             </varlistentry>
822             <varlistentry>
823               <term>snodes</term>
824               <listitem>
825                 <simpara>comma-separated list of secondary nodes for the
826                   instance; usually this will be just one node</simpara>
827               </listitem>
828             </varlistentry>
829             <varlistentry>
830               <term>admin_state</term>
831               <listitem>
832                 <simpara>the desired state of the instance (either "yes"
833                   or "no" denoting the instance should run or
834                   not)</simpara>
835               </listitem>
836             </varlistentry>
837             <varlistentry>
838               <term>disk_template</term>
839               <listitem>
840                 <simpara>the disk template of the instance</simpara>
841               </listitem>
842             </varlistentry>
843             <varlistentry>
844               <term>oper_state</term>
845               <listitem>
846                 <simpara>the actual state of the instance; can be
847                 one of the values "running", "stopped", "(node
848                 down)"</simpara>
849               </listitem>
850             </varlistentry>
851             <varlistentry>
852               <term>status</term>
853               <listitem>
854                 <simpara>combined form of admin_state and oper_stat;
855                 this can be one of:
856                 <computeroutput>ERROR_nodedown</computeroutput> if the
857                 node of the instance is down,
858                 <computeroutput>ERROR_down</computeroutput> if the
859                 instance should run but is down,
860                 <computeroutput>ERROR_up</computeroutput> if the
861                 instance should be stopped but is actually running,
862                 <computeroutput>ADMIN_down</computeroutput> if the
863                 instance has been stopped (and is stopped) and
864                 <computeroutput>running</computeroutput> if the
865                 instance is set to be running (and is
866                 running)</simpara>
867               </listitem>
868             </varlistentry>
869             <varlistentry>
870               <term>oper_ram</term>
871               <listitem>
872                 <simpara>the actual memory usage of the instance as seen
873                   by the hypervisor</simpara>
874               </listitem>
875             </varlistentry>
876             <varlistentry>
877               <term>ip</term>
878               <listitem>
879                 <simpara>the ip address ganeti recognizes as associated with
880                 the first instance interface</simpara>
881               </listitem>
882             </varlistentry>
883             <varlistentry>
884               <term>mac</term>
885               <listitem>
886                 <simpara>the first instance interface MAC address</simpara>
887               </listitem>
888             </varlistentry>
889             <varlistentry>
890               <term>bridge</term>
891               <listitem>
892                 <simpara>the bridge of the first instance NIC
893                 </simpara>
894               </listitem>
895             </varlistentry>
896             <varlistentry>
897               <term>sda_size</term>
898               <listitem>
899                 <simpara>the size of the instance's first disk</simpara>
900               </listitem>
901             </varlistentry>
902             <varlistentry>
903               <term>sdb_size</term>
904               <listitem>
905                 <simpara>the size of the instance's second disk, if
906                 any</simpara>
907               </listitem>
908             </varlistentry>
909             <varlistentry>
910               <term>vcpus</term>
911               <listitem>
912                 <simpara>the number of VCPUs allocated to the
913                 instance</simpara>
914               </listitem>
915             </varlistentry>
916             <varlistentry>
917               <term>tags</term>
918               <listitem>
919                 <simpara>comma-separated list of the instances's
920                 tags</simpara>
921               </listitem>
922             </varlistentry>
923             <varlistentry>
924               <term>serial_no</term>
925               <listitem>
926                 <simpara>the so called 'serial number' of the
927                 instance; this is a numeric field that is incremented
928                 each time the instance is modified, and it can be used
929                 to track modifications</simpara>
930               </listitem>
931             </varlistentry>
932             <varlistentry>
933               <term>network_port</term>
934               <listitem>
935                 <simpara>If the instance has a network port assigned
936                 to it (e.g. for VNC connections), this will be shown,
937                 otherwise <literal>-</literal> will be
938                 displayed.</simpara>
939               </listitem>
940             </varlistentry>
941             <varlistentry>
942               <term>beparams</term>
943               <listitem>
944                 <simpara>A text format of the entire beparams for the
945                 instance. It's more useful to select individual fields
946                 from this dictionary, see below.</simpara>
947               </listitem>
948             </varlistentry>
949             <varlistentry>
950               <term>disk.count</term>
951               <listitem>
952                 <simpara>The number of instance disks.</simpara>
953               </listitem>
954             </varlistentry>
955             <varlistentry>
956               <term>disk.size/N</term>
957               <listitem>
958                 <simpara>The size of the instance's Nth disk. This is
959                 a more generic form of the <literal>sda_size</literal>
960                 and <literal>sdb_size</literal> fields.</simpara>
961               </listitem>
962             </varlistentry>
963             <varlistentry>
964               <term>disk.sizes</term>
965               <listitem>
966                 <simpara>A comma-separated list of the disk sizes for
967                 this instance.</simpara>
968               </listitem>
969             </varlistentry>
970             <varlistentry>
971               <term>disk_usage</term>
972               <listitem>
973                 <simpara>The total disk space used by this instance on
974                 each of its nodes. This is not the instance-visible
975                 disk size, but the actual disk "cost" of the
976                 instance.</simpara>
977               </listitem>
978             </varlistentry>
979             <varlistentry>
980               <term>nic.mac/N</term>
981               <listitem>
982                 <simpara>The MAC of the Nth instance NIC.</simpara>
983               </listitem>
984             </varlistentry>
985             <varlistentry>
986               <term>nic.ip/N</term>
987               <listitem>
988                 <simpara>The IP address of the Nth instance NIC.</simpara>
989               </listitem>
990             </varlistentry>
991             <varlistentry>
992               <term>nic.bridge/N</term>
993               <listitem>
994                 <simpara>The bridge the Nth instance NIC is attached
995                 to.</simpara>
996               </listitem>
997             </varlistentry>
998             <varlistentry>
999               <term>nic.macs</term>
1000               <listitem>
1001                 <simpara>A comma-separated list of all the MACs of the
1002                 instance's NICs.</simpara>
1003               </listitem>
1004             </varlistentry>
1005             <varlistentry>
1006               <term>nic.ips</term>
1007               <listitem>
1008                 <simpara>A comma-separated list of all the IP
1009                 addresses of the instance's NICs.</simpara>
1010               </listitem>
1011             </varlistentry>
1012             <varlistentry>
1013               <term>nic.bridges</term>
1014               <listitem>
1015                 <simpara>A comma-separated list of all the bridges of the
1016                 instance's NICs.</simpara>
1017               </listitem>
1018             </varlistentry>
1019             <varlistentry>
1020               <term>nic.count</term>
1021               <listitem>
1022                 <simpara>The number of instance nics.</simpara>
1023               </listitem>
1024             </varlistentry>
1025             <varlistentry>
1026               <term>hv/<replaceable>NAME</replaceable></term>
1027               <listitem>
1028                 <simpara>The value of the hypervisor parameter called
1029                 <replaceable>NAME</replaceable>. For details of what
1030                 hypervisor parameters exist and their meaning, see the
1031                 <command>add</command> command.</simpara>
1032               </listitem>
1033             </varlistentry>
1034             <varlistentry>
1035               <term>be/memory</term>
1036               <listitem>
1037                 <simpara>The configured memory for the instance.</simpara>
1038               </listitem>
1039             </varlistentry>
1040             <varlistentry>
1041               <term>be/vcpus</term>
1042               <listitem>
1043                 <simpara>The configured number of VCPUs for the
1044                 instance.</simpara>
1045               </listitem>
1046             </varlistentry>
1047             <varlistentry>
1048               <term>be/auto_balance</term>
1049               <listitem>
1050                 <simpara>Whether the instance is considered in N+1
1051                 checks.</simpara>
1052               </listitem>
1053             </varlistentry>
1054           </variablelist>
1055         </para>
1056
1057         <para>
1058           If the value of the option starts with the character
1059           <constant>+</constant>, the new field(s) will be added to the
1060           default list. This allows to quickly see the default list
1061           plus a few other fields, instead of retyping the entire list
1062           of fields.
1063         </para>
1064
1065         <para>
1066           There is a subtle grouping about the available output
1067           fields: all fields except for <option>oper_state</option>,
1068           <option>oper_ram</option> and <option>status</option> are
1069           configuration value and not run-time values. So if you don't
1070           select any of the these fields, the query will be satisfied
1071           instantly from the cluster configuration, without having to
1072           ask the remote nodes for the data. This can be helpful for
1073           big clusters when you only want some data and it makes sense
1074           to specify a reduced set of output fields.
1075         </para>
1076
1077         <para>The default output field list is:
1078           <simplelist type="inline">
1079             <member>name</member>
1080             <member>os</member>
1081             <member>pnode</member>
1082             <member>admin_state</member>
1083             <member>oper_state</member>
1084             <member>oper_ram</member>
1085           </simplelist>.
1086         </para>
1087       </refsect3>
1088
1089       <refsect3>
1090         <title>INFO</title>
1091
1092         <cmdsynopsis>
1093           <command>info</command>
1094           <group>
1095             <arg>-s</arg>
1096             <arg>--static</arg>
1097           </group>
1098           <arg rep="repeat"><replaceable>instance</replaceable></arg>
1099         </cmdsynopsis>
1100
1101         <para>
1102           Show detailed information about the (given) instances. This
1103           is different from <command>list</command> as it shows
1104           detailed data about the instance's disks (especially useful
1105           for drbd disk template).
1106         </para>
1107
1108         <para>
1109           If the option <option>-s</option> is used, only information
1110           available in the configuration file is returned, without
1111           querying nodes, making the operation faster.
1112         </para>
1113       </refsect3>
1114
1115       <refsect3>
1116         <title>MODIFY</title>
1117
1118         <cmdsynopsis>
1119           <command>modify</command>
1120           <sbr>
1121           <arg choice="opt">-H <replaceable>HYPERVISOR_PARAMETERS</replaceable></arg>
1122           <sbr>
1123           <arg choice="opt">-B <replaceable>BACKEND_PARAMETERS</replaceable></arg>
1124           <sbr>
1125           <group>
1126             <arg>--net add<replaceable><optional>:options</optional></replaceable></arg>
1127             <arg>--net remove</arg>
1128             <arg>--net <replaceable>N:options</replaceable></arg>
1129           </group>
1130           <sbr>
1131           <group>
1132             <arg>--disk add:size=<replaceable>SIZE</replaceable></arg>
1133             <arg>--disk remove</arg>
1134             <arg>--disk <replaceable>N</replaceable>:mode=<replaceable>MODE</replaceable></arg>
1135           </group>
1136
1137           <sbr>
1138           <arg>--submit</arg>
1139           <sbr>
1140           <arg choice="req"><replaceable>instance</replaceable></arg>
1141         </cmdsynopsis>
1142
1143         <para>
1144           Modifies the memory size, number of vcpus, ip address, MAC
1145           address and/or bridge for an instance. It can also add and
1146           remove disks and NICs to/from the instance. Note that you
1147           need to give at least one of the arguments, otherwise the
1148           command complains.
1149         </para>
1150
1151         <para>
1152           The <option>-H</option> option specifies hypervisor options
1153           in the form of <userinput>name=value[,...]</userinput>. For details which options can be specified, see the <command>add</command> command.
1154         </para>
1155
1156         <para>
1157           The <option>--disk
1158           add:size=<replaceable>SIZE</replaceable></option> option
1159           adds a disk to the instance. The <option>--disk
1160           remove</option> will remove the last disk of the
1161           instance. The <option>--disk
1162           <replaceable>N</replaceable>:mode=<replaceable>MODE</replaceable></option>
1163           option will change the mode of the Nth disk of the instance
1164           between read-only (<literal>ro</literal>) and read-write
1165           (<literal>rw</literal>).
1166         </para>
1167
1168         <para>
1169           The <option>--nic
1170           add:<replaceable>options</replaceable></option> option will
1171           add a new NIC to the instance. The available options are the
1172           same as in the <command>add</command> command (mac, ip,
1173           bridge). The <option>--nice remove</option> will remove the
1174           last NIC of the instance, while the <option>--nic
1175           <replaceable>N</replaceable>:<replaceable>options</replaceable></option>
1176           option will change the parameters of the Nth instance NIC.
1177         </para>
1178
1179         <para>
1180           The <option>--submit</option> option is used to send the job to
1181           the master daemon but not wait for its completion. The job
1182           ID will be shown so that it can be examined via
1183           <command>gnt-job info</command>.
1184         </para>
1185
1186         <para>
1187           All the changes take effect at the next restart. If the
1188           instance is running, there is no effect on the instance.
1189         </para>
1190       </refsect3>
1191
1192       <refsect3>
1193         <title>REINSTALL</title>
1194
1195         <cmdsynopsis>
1196           <command>reinstall</command>
1197           <arg choice="opt">-o <replaceable>os-type</replaceable></arg>
1198           <arg choice="opt">-f <replaceable>force</replaceable></arg>
1199           <arg>--select-os</arg>
1200           <arg>--submit</arg>
1201           <arg choice="req"><replaceable>instance</replaceable></arg>
1202         </cmdsynopsis>
1203
1204         <para>
1205           Reinstalls the operating system on the given instance. The instance
1206           must be stopped when running this command. If the
1207           <option>--os-type</option> is specified, the operating system is
1208           changed.
1209         </para>
1210
1211         <para>
1212           The <option>--select-os</option> option switches to an
1213           interactive OS reinstall. The user is prompted to select the OS
1214           template from the list of available OS templates.
1215         </para>
1216
1217         <para>
1218           The <option>--submit</option> option is used to send the job to
1219           the master daemon but not wait for its completion. The job
1220           ID will be shown so that it can be examined via
1221           <command>gnt-job info</command>.
1222         </para>
1223
1224
1225       </refsect3>
1226
1227       <refsect3>
1228         <title>RENAME</title>
1229
1230         <cmdsynopsis>
1231           <command>rename</command>
1232           <arg>--no-ip-check</arg>
1233           <arg>--submit</arg>
1234           <arg choice="req"><replaceable>instance</replaceable></arg>
1235           <arg choice="req"><replaceable>new_name</replaceable></arg>
1236         </cmdsynopsis>
1237
1238         <para>
1239           Renames the given instance. The instance must be stopped
1240           when running this command. The requirements for the new name
1241           are the same as for adding an instance: the new name must be
1242           resolvable and the IP it resolves to must not be reachable
1243           (in order to prevent duplicate IPs the next time the
1244           instance is started). The IP test can be skipped if the
1245           <option>--no-ip-check</option> option is passed.
1246         </para>
1247
1248         <para>
1249           The <option>--submit</option> option is used to send the job to
1250           the master daemon but not wait for its completion. The job
1251           ID will be shown so that it can be examined via
1252           <command>gnt-job info</command>.
1253         </para>
1254
1255       </refsect3>
1256
1257     </refsect2>
1258
1259     <refsect2>
1260       <title>Starting/stopping/connecting to console</title>
1261
1262       <refsect3>
1263         <title>STARTUP</title>
1264
1265         <cmdsynopsis>
1266           <command>startup</command>
1267           <sbr>
1268           <arg>--extra=<replaceable>PARAMS</replaceable></arg>
1269           <arg>--force</arg>
1270           <sbr>
1271           <arg>--force-multiple</arg>
1272           <sbr>
1273           <group choice="opt">
1274             <arg>--instance</arg>
1275             <arg>--node</arg>
1276             <arg>--primary</arg>
1277             <arg>--secondary</arg>
1278             <arg>--all</arg>
1279           </group>
1280           <sbr>
1281           <arg>--submit</arg>
1282           <sbr>
1283           <arg choice="opt"
1284           rep="repeat"><replaceable>name</replaceable></arg>
1285         </cmdsynopsis>
1286
1287         <para>
1288           Starts one or more instances, depending on the following
1289           options. The four available modes are:
1290           <variablelist>
1291             <varlistentry>
1292               <term><option>--instance</option></term>
1293               <listitem>
1294                 <simpara>will start the instances given as arguments
1295                 (at least one argument required); this is the default
1296                 selection</simpara>
1297               </listitem>
1298             </varlistentry>
1299             <varlistentry>
1300               <term>--node</term>
1301               <listitem>
1302                 <simpara>will start the instances who have the given
1303                 node as either primary or secondary</simpara>
1304               </listitem>
1305             </varlistentry>
1306             <varlistentry>
1307               <term><option>--primary</option></term>
1308               <listitem>
1309                 <simpara>will start all instances whose primary node
1310                 is in the list of nodes passed as arguments (at least
1311                 one node required)</simpara>
1312               </listitem>
1313             </varlistentry>
1314             <varlistentry>
1315               <term><option>--secondary</option></term>
1316               <listitem>
1317                 <simpara>will start all instances whose secondary node
1318                 is in the list of nodes passed as arguments (at least
1319                 one node required)</simpara>
1320               </listitem>
1321             </varlistentry>
1322             <varlistentry>
1323               <term>--all</term>
1324               <listitem>
1325                 <simpara>will start all instances in the cluster (no
1326                 arguments accepted)</simpara>
1327               </listitem>
1328             </varlistentry>
1329           </variablelist>
1330         </para>
1331
1332         <para>
1333           Note that although you can pass more than one selection
1334           option, the last one wins, so in order to guarantee the
1335           desired result, don't pass more than one such option.
1336         </para>
1337
1338         <para>
1339           The <option>--extra</option> option is used to pass
1340           additional argument to the instance's kernel for this start
1341           only. Currently there is no way to specify a persistent set
1342           of arguments (beside the one hardcoded). Note that this may
1343           not apply to all virtualization types.
1344         </para>
1345
1346         <para>
1347           Use <option>--force</option> to start even if secondary disks are
1348           failing.
1349         </para>
1350
1351         <para>
1352           The <option>--force-multiple</option> will skip the
1353           interactive confirmation in the case the more than one
1354           instance will be affected.
1355         </para>
1356
1357         <para>
1358           The <option>--submit</option> option is used to send the job to
1359           the master daemon but not wait for its completion. The job
1360           ID will be shown so that it can be examined via
1361           <command>gnt-job info</command>.
1362         </para>
1363
1364         <para>
1365           Example:
1366           <screen>
1367 # gnt-instance start instance1.example.com
1368 # gnt-instance start --extra single test1.example.com
1369 # gnt-instance start --node node1.example.com node2.example.com
1370 # gnt-instance start --all
1371           </screen>
1372         </para>
1373       </refsect3>
1374
1375       <refsect3>
1376         <title>SHUTDOWN</title>
1377
1378         <cmdsynopsis>
1379           <command>shutdown</command>
1380           <sbr>
1381           <arg>--force-multiple</arg>
1382           <sbr>
1383           <group choice="opt">
1384             <arg>--instance</arg>
1385             <arg>--node</arg>
1386             <arg>--primary</arg>
1387             <arg>--secondary</arg>
1388             <arg>--all</arg>
1389           </group>
1390           <sbr>
1391           <arg>--submit</arg>
1392           <sbr>
1393           <arg choice="opt"
1394           rep="repeat"><replaceable>name</replaceable></arg>
1395         </cmdsynopsis>
1396
1397         <para>
1398           Stops one or more instances. If the instance cannot be
1399           cleanly stopped during a hardcoded interval (currently 2
1400           minutes), it will forcibly stop the instance (equivalent to
1401           switching off the power on a physical machine).
1402         </para>
1403
1404         <para>
1405           The <option>--instance</option>, <option>--node</option>,
1406           <option>--primary</option>, <option>--secondary</option> and
1407           <option>--all</option> options are similar as for the
1408           <command>startup</command> command and they influence the
1409           actual instances being shutdown.
1410         </para>
1411
1412         <para>
1413           The <option>--submit</option> option is used to send the job to
1414           the master daemon but not wait for its completion. The job
1415           ID will be shown so that it can be examined via
1416           <command>gnt-job info</command>.
1417         </para>
1418
1419
1420         <para>
1421           Example:
1422           <screen>
1423 # gnt-instance shutdown instance1.example.com
1424 # gnt-instance shutdown --all
1425           </screen>
1426         </para>
1427       </refsect3>
1428
1429       <refsect3>
1430         <title>REBOOT</title>
1431
1432         <cmdsynopsis>
1433           <command>reboot</command>
1434           <sbr>
1435           <arg>--extra=<replaceable>PARAMS</replaceable></arg>
1436           <sbr>
1437           <arg>--type=<replaceable>REBOOT-TYPE</replaceable></arg>
1438           <sbr>
1439           <arg>--ignore-secondaries</arg>
1440           <sbr>
1441           <arg>--force-multiple</arg>
1442           <sbr>
1443           <group choice="opt">
1444             <arg>--instance</arg>
1445             <arg>--node</arg>
1446             <arg>--primary</arg>
1447             <arg>--secondary</arg>
1448             <arg>--all</arg>
1449           </group>
1450           <sbr>
1451           <arg>--submit</arg>
1452           <sbr>
1453           <arg choice="opt"
1454           rep="repeat"><replaceable>name</replaceable></arg>
1455         </cmdsynopsis>
1456
1457         <para>
1458           Reboots one or more instances. The type of reboot depends on
1459           the value of <option>--type</option>. A soft reboot does a
1460           hypervisor reboot, a hard reboot does a instance stop,
1461           recreates the hypervisor config for the instance and
1462           starts the instance. A full reboot does the equivalent
1463           of <command>gnt-instance shutdown &amp;&amp; gnt-instance
1464           startup</command>. The default is hard reboot.
1465         </para>
1466
1467         <para>
1468           For the hard reboot the option
1469           <option>--ignore-secondaries</option> ignores errors for the
1470           secondary node while re-assembling the instance disks.
1471         </para>
1472
1473         <para>
1474           The <option>--instance</option>, <option>--node</option>,
1475           <option>--primary</option>, <option>--secondary</option> and
1476           <option>--all</option> options are similar as for the
1477           <command>startup</command> command and they influence the
1478           actual instances being rebooted.
1479         </para>
1480
1481         <para>
1482           The <option>--force-multiple</option> will skip the
1483           interactive confirmation in the case the more than one
1484           instance will be affected.
1485         </para>
1486
1487         <para>
1488           Example:
1489           <screen>
1490 # gnt-instance reboot instance1.example.com
1491 # gnt-instance reboot --type=full instance1.example.com
1492           </screen>
1493         </para>
1494       </refsect3>
1495
1496       <refsect3>
1497         <title>CONSOLE</title>
1498         <cmdsynopsis>
1499           <command>console</command>
1500           <arg choice="opt">--show-cmd</arg>
1501           <arg choice="req"><replaceable>instance</replaceable></arg>
1502         </cmdsynopsis>
1503
1504         <para>
1505           Connects to the console of the given instance. If the
1506           instance is not up, an error is returned. Use the
1507           <option>--show-cmd</option> option to display the command
1508           instead of executing it.
1509         </para>
1510
1511         <para>
1512           For HVM instances, this will attempt to connect to the
1513           serial console of the instance. To connect to the
1514           virtualized "physical" console of a HVM instance, use a VNC
1515           client with the connection info from the
1516           <command>info</command> command.
1517         </para>
1518
1519         <para>
1520           Example:
1521           <screen>
1522 # gnt-instance console instance1.example.com
1523           </screen>
1524         </para>
1525       </refsect3>
1526
1527     </refsect2>
1528
1529     <refsect2>
1530       <title>Disk management</title>
1531
1532       <refsect3>
1533         <title>REPLACE-DISKS</title>
1534
1535         <cmdsynopsis>
1536           <command>replace-disks</command>
1537           <arg>--submit</arg>
1538           <arg choice="req">-p</arg>
1539           <arg choice="req"><replaceable>instance</replaceable></arg>
1540         </cmdsynopsis>
1541
1542         <cmdsynopsis>
1543           <command>replace-disks</command>
1544           <arg>--submit</arg>
1545           <arg choice="req">-s</arg>
1546           <arg choice="req"><replaceable>instance</replaceable></arg>
1547         </cmdsynopsis>
1548
1549         <cmdsynopsis>
1550           <command>replace-disks</command>
1551           <arg>--submit</arg>
1552           <group choice="req">
1553             <arg>--iallocator <replaceable>name</replaceable></arg>
1554             <arg>--new-secondary <replaceable>NODE</replaceable></arg>
1555           </group>
1556
1557           <arg choice="req"><replaceable>instance</replaceable></arg>
1558         </cmdsynopsis>
1559
1560         <para>
1561           This command is a generalized form for adding and replacing
1562           disks. It is currently only valid for the mirrored (DRBD)
1563           disk template.
1564         </para>
1565
1566         <para>
1567           The first form (when passing the <option>-p</option> option)
1568           will replace the disks on the primary, while the second form
1569           (when passing the <option>-s</option> option will replace
1570           the disks on the secondary node.
1571         </para>
1572
1573         <para>
1574           The third form (when passing either the
1575           <option>--iallocator</option> or the
1576           <option>--new-secondary</option> option) is designed to
1577           change secondary node of the instance.  Specifying
1578           <option>--iallocator</option> makes the new secondary be
1579           selected automatically by the specified allocator plugin,
1580           otherwise the new secondary node will be the one chosen
1581           manually via the <option>--new-secondary</option> option.
1582         </para>
1583
1584         <para>
1585           The <option>--submit</option> option is used to send the job to
1586           the master daemon but not wait for its completion. The job
1587           ID will be shown so that it can be examined via
1588           <command>gnt-job info</command>.
1589         </para>
1590
1591         <para>
1592           Note that it is not possible to select an offline or drained
1593           node as a new secondary.
1594         </para>
1595
1596       </refsect3>
1597
1598       <refsect3>
1599         <title>ACTIVATE-DISKS</title>
1600
1601         <cmdsynopsis>
1602           <command>activate-disks</command>
1603           <arg>--submit</arg>
1604           <arg choice="req"><replaceable>instance</replaceable></arg>
1605         </cmdsynopsis>
1606         <para>
1607           Activates the block devices of the given instance. If
1608           successful, the command will show the location and name of
1609           the block devices:
1610           <screen>
1611 node1.example.com:disk/0:/dev/drbd0
1612 node1.example.com:disk/1:/dev/drbd1
1613           </screen>
1614
1615           In this example, <emphasis>node1.example.com</emphasis> is
1616           the name of the node on which the devices have been
1617           activated. The <emphasis>disk/0</emphasis> and
1618           <emphasis>disk/1</emphasis> are the Ganeti-names of the
1619           instance disks; how they are visible inside the instance is
1620           hypervisor-specific. <emphasis>/dev/drbd0</emphasis> and
1621           <emphasis>/dev/drbd1</emphasis> are the actual block devices
1622           as visible on the node.
1623         </para>
1624
1625         <para>
1626           The <option>--submit</option> option is used to send the job to
1627           the master daemon but not wait for its completion. The job
1628           ID will be shown so that it can be examined via
1629           <command>gnt-job info</command>.
1630         </para>
1631
1632         <para>
1633           Note that it is safe to run this command while the instance
1634           is already running.
1635         </para>
1636       </refsect3>
1637
1638       <refsect3>
1639         <title>DEACTIVATE-DISKS</title>
1640
1641         <cmdsynopsis>
1642           <command>deactivate-disks</command>
1643           <arg>--submit</arg>
1644           <arg choice="req"><replaceable>instance</replaceable></arg>
1645         </cmdsynopsis>
1646         <para>
1647           De-activates the block devices of the given instance. Note
1648           that if you run this command for an instance with a drbd
1649           disk template, while it is running, it will not be able to
1650           shutdown the block devices on the primary node, but it will
1651           shutdown the block devices on the secondary nodes, thus
1652           breaking the replication.
1653         </para>
1654
1655         <para>
1656           The <option>--submit</option> option is used to send the job to
1657           the master daemon but not wait for its completion. The job
1658           ID will be shown so that it can be examined via
1659           <command>gnt-job info</command>.
1660         </para>
1661
1662       </refsect3>
1663
1664       <refsect3>
1665         <title>GROW-DISK</title>
1666         <cmdsynopsis>
1667           <command>grow-disk</command>
1668           <arg>--no-wait-for-sync</arg>
1669           <arg>--submit</arg>
1670           <arg choice="req"><replaceable>instance</replaceable></arg>
1671           <arg choice="req"><replaceable>disk</replaceable></arg>
1672           <arg choice="req"><replaceable>amount</replaceable></arg>
1673         </cmdsynopsis>
1674
1675         <para>
1676           Grows an instance's disk. This is only possible for
1677           instances having a <literal>plain</literal> or
1678           <literal>drbd</literal> disk template.
1679         </para>
1680
1681         <para>
1682           Note that this command only change the block device size; it
1683           will not grow the actual filesystems, partitions, etc. that
1684           live on that disk. Usually, you will need to:
1685           <orderedlist>
1686             <listitem>
1687               <simpara>use <command>gnt-instance grow-disk</command></simpara>
1688             </listitem>
1689             <listitem>
1690               <simpara>reboot the instance (later, at a convenient
1691               time)</simpara>
1692             </listitem>
1693             <listitem>
1694               <simpara>use a filesystem resizer, such as
1695               <citerefentry> <refentrytitle>ext2online</refentrytitle>
1696               <manvolnum>8</manvolnum> </citerefentry> or
1697               <citerefentry> <refentrytitle>xfs_growfs</refentrytitle>
1698               <manvolnum>8</manvolnum> </citerefentry> to resize the
1699               filesystem, or use <citerefentry>
1700               <refentrytitle>fdisk</refentrytitle>
1701               <manvolnum>8</manvolnum> </citerefentry> to change the
1702               partition table on the disk
1703               </simpara>
1704             </listitem>
1705           </orderedlist>
1706         </para>
1707
1708
1709         <para>
1710           The <replaceable>disk</replaceable> argument is the index of
1711           the instance disk to grow. The
1712           <replaceable>amount</replaceable> argument is given either
1713           as a number (and it represents the amount to increase the
1714           disk with in mebibytes) or can be given similar to the
1715           arguments in the create instance operation, with a suffix
1716           denoting the unit.
1717         </para>
1718
1719         <para>
1720           Note that the disk grow operation might complete on one node
1721           but fail on the other; this will leave the instance with
1722           different-sized LVs on the two nodes, but this will not
1723           create problems (except for unused space).
1724         </para>
1725
1726         <para>
1727           If you do not want gnt-instance to wait for the new disk
1728           region to be synced, use the
1729           <option>--no-wait-for-sync</option> option.
1730         </para>
1731
1732         <para>
1733           The <option>--submit</option> option is used to send the job to
1734           the master daemon but not wait for its completion. The job
1735           ID will be shown so that it can be examined via
1736           <command>gnt-job info</command>.
1737         </para>
1738
1739
1740         <para>Example (increase the first disk for instance1 by 16GiB):
1741           <screen>
1742 # gnt-instance grow-disk instance1.example.com 0 16g
1743           </screen>
1744         </para>
1745
1746         <para>
1747           Also note that disk shrinking is not supported; use
1748           <command>gnt-backup export</command> and then
1749           <command>gnt-backup import</command> to reduce the disk size
1750           of an instance.
1751         </para>
1752       </refsect3>
1753
1754     </refsect2>
1755
1756     <refsect2>
1757       <title>Recovery</title>
1758
1759       <refsect3>
1760         <title>FAILOVER</title>
1761
1762         <cmdsynopsis>
1763           <command>failover</command>
1764           <arg>-f</arg>
1765           <arg>--ignore-consistency</arg>
1766           <arg>--submit</arg>
1767           <arg choice="req"><replaceable>instance</replaceable></arg>
1768         </cmdsynopsis>
1769
1770         <para>
1771           Failover will fail the instance over its secondary
1772           node. This works only for instances having a drbd disk
1773           template.
1774         </para>
1775
1776         <para>
1777           Normally the failover will check the consistency of the
1778           disks before failing over the instance. If you are trying to
1779           migrate instances off a dead node, this will fail. Use the
1780           <option>--ignore-consistency</option> option for this
1781           purpose. Note that this option can be dangerous as errors in
1782           shutting down the instance will be ignored, resulting in
1783           possibly having the instance running on two machines in
1784           parallel (on disconnected DRBD drives).
1785         </para>
1786
1787         <para>
1788           The <option>--submit</option> option is used to send the job to
1789           the master daemon but not wait for its completion. The job
1790           ID will be shown so that it can be examined via
1791           <command>gnt-job info</command>.
1792         </para>
1793
1794         <para>
1795           Example:
1796           <screen>
1797 # gnt-instance failover instance1.example.com
1798           </screen>
1799         </para>
1800       </refsect3>
1801
1802       <refsect3>
1803         <title>MIGRATE</title>
1804
1805         <cmdsynopsis>
1806           <command>migrate</command>
1807           <arg>-f</arg>
1808           <arg choice="req">--cleanup</arg>
1809           <arg choice="req"><replaceable>instance</replaceable></arg>
1810         </cmdsynopsis>
1811
1812         <cmdsynopsis>
1813           <command>migrate</command>
1814           <arg>-f</arg>
1815           <arg>--non-live</arg>
1816           <arg choice="req"><replaceable>instance</replaceable></arg>
1817         </cmdsynopsis>
1818
1819         <para>
1820           Migrate will move the instance to its secondary node without
1821           shutdown. It only works for instances having the drbd8 disk
1822           template type.
1823         </para>
1824
1825         <para>
1826           The migration command needs a perfectly healthy instance, as
1827           we rely on the dual-master capability of drbd8 and the disks
1828           of the instance are not allowed to be degraded.
1829         </para>
1830
1831         <para>
1832           The <option>--non-live</option> option will switch (for the
1833           hypervisors that support it) between a "fully live"
1834           (i.e. the interruption is as minimal as possible) migration
1835           and one in which the instance is frozen, its state saved and
1836           transported to the remote node, and then resumed there. This
1837           all depends on the hypervisor support for two different
1838           methods. In any case, it is not an error to pass this
1839           parameter (it will just be ignored if the hypervisor doesn't
1840           support it).
1841         </para>
1842
1843         <para>
1844           If the <option>--cleanup</option> option is passed, the
1845           operation changes from migration to attempting recovery from
1846           a failed previous migration. In this mode, ganeti checks if
1847           the instance runs on the correct node (and updates its
1848           configuration if not) and ensures the instances's disks are
1849           configured correctly. In this mode, the
1850           <option>--non-live</option> option is ignored.
1851         </para>
1852
1853         <para>
1854           The option <option>-f</option> will skip the prompting for
1855           confirmation.
1856         </para>
1857         <para>
1858           Example (and expected output):
1859           <screen>
1860 # gnt-instance migrate instance1
1861 Migrate will happen to the instance instance1. Note that migration is
1862 **experimental** in this version. This might impact the instance if
1863 anything goes wrong. Continue?
1864 y/[n]/?: y
1865 * checking disk consistency between source and target
1866 * ensuring the target is in secondary mode
1867 * changing disks into dual-master mode
1868  - INFO: Waiting for instance instance1 to sync disks.
1869  - INFO: Instance instance1's disks are in sync.
1870 * migrating instance to node2.example.com
1871 * changing the instance's disks on source node to secondary
1872  - INFO: Waiting for instance instance1 to sync disks.
1873  - INFO: Instance instance1's disks are in sync.
1874 * changing the instance's disks to single-master
1875 #
1876           </screen>
1877         </para>
1878       </refsect3>
1879
1880     </refsect2>
1881
1882     <refsect2>
1883       <title>TAGS</title>
1884
1885     <refsect3>
1886         <title>ADD-TAGS</title>
1887
1888         <cmdsynopsis>
1889           <command>add-tags</command>
1890           <arg choice="opt">--from <replaceable>file</replaceable></arg>
1891           <arg choice="req"><replaceable>instancename</replaceable></arg>
1892           <arg choice="req"
1893             rep="repeat"><replaceable>tag</replaceable></arg>
1894         </cmdsynopsis>
1895
1896         <para>
1897           Add tags to the given instance. If any of the tags contains
1898           invalid characters, the entire operation will abort.
1899         </para>
1900         <para>
1901           If the <option>--from</option> option is given, the list of
1902           tags will be extended with the contents of that file (each
1903           line becomes a tag). In this case, there is not need to pass
1904           tags on the command line (if you do, both sources will be
1905           used). A file name of - will be interpreted as stdin.
1906         </para>
1907       </refsect3>
1908
1909       <refsect3>
1910         <title>LIST-TAGS</title>
1911
1912         <cmdsynopsis>
1913           <command>list-tags</command>
1914           <arg choice="req"><replaceable>instancename</replaceable></arg>
1915         </cmdsynopsis>
1916
1917         <para>List the tags of the given instance.</para>
1918       </refsect3>
1919
1920       <refsect3>
1921         <title>REMOVE-TAGS</title>
1922         <cmdsynopsis>
1923           <command>remove-tags</command>
1924           <arg choice="opt">--from <replaceable>file</replaceable></arg>
1925           <arg choice="req"><replaceable>instancename</replaceable></arg>
1926           <arg choice="req"
1927             rep="repeat"><replaceable>tag</replaceable></arg>
1928         </cmdsynopsis>
1929
1930         <para>
1931           Remove tags from the given instance. If any of the tags are
1932           not existing on the node, the entire operation will abort.
1933         </para>
1934
1935         <para>
1936           If the <option>--from</option> option is given, the list of
1937           tags will be extended with the contents of that file (each
1938           line becomes a tag). In this case, there is not need to pass
1939           tags on the command line (if you do, both sources will be
1940           used). A file name of - will be interpreted as stdin.
1941         </para>
1942       </refsect3>
1943
1944     </refsect2>
1945
1946   </refsect1>
1947
1948   &footer;
1949
1950 </refentry>
1951
1952 <!-- Keep this comment at the end of the file
1953 Local variables:
1954 mode: sgml
1955 sgml-omittag:t
1956 sgml-shorttag:t
1957 sgml-minimize-attributes:nil
1958 sgml-always-quote-attributes:t
1959 sgml-indent-step:2
1960 sgml-indent-data:t
1961 sgml-parent-document:nil
1962 sgml-default-dtd-file:nil
1963 sgml-exposed-tags:nil
1964 sgml-local-catalogs:nil
1965 sgml-local-ecat-files:nil
1966 End:
1967 -->