5438898cba8f3531b2d3ec1997bc481054f63514
[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/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, see gnt-cluster(8) for more details)</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>ctime</term>
991             <listitem>
992               <para>
993                 the creation time of the instance; note that this
994                 field contains spaces and as such it's harder to parse
995               </para>
996               <para>
997                 if this attribute is not present (e.g. when upgrading
998                 from older versions), then "N/A" will be shown instead
999               </para>
1000             </listitem>
1001           </varlistentry>
1002           <varlistentry>
1003             <term>mtime</term>
1004             <listitem>
1005               <para>
1006                 the last modification time of the instance; note that
1007                 this field contains spaces and as such it's harder to
1008                 parse
1009               </para>
1010               <para>
1011                 if this attribute is not present (e.g. when upgrading
1012                 from older versions), then "N/A" will be shown instead
1013               </para>
1014             </listitem>
1015           </varlistentry>
1016
1017             <varlistentry>
1018               <term>network_port</term>
1019               <listitem>
1020                 <simpara>If the instance has a network port assigned
1021                 to it (e.g. for VNC connections), this will be shown,
1022                 otherwise <literal>-</literal> will be
1023                 displayed.</simpara>
1024               </listitem>
1025             </varlistentry>
1026             <varlistentry>
1027               <term>beparams</term>
1028               <listitem>
1029                 <simpara>A text format of the entire beparams for the
1030                 instance. It's more useful to select individual fields
1031                 from this dictionary, see below.</simpara>
1032               </listitem>
1033             </varlistentry>
1034             <varlistentry>
1035               <term>disk.count</term>
1036               <listitem>
1037                 <simpara>The number of instance disks.</simpara>
1038               </listitem>
1039             </varlistentry>
1040             <varlistentry>
1041               <term>disk.size/N</term>
1042               <listitem>
1043                 <simpara>The size of the instance's Nth disk. This is
1044                 a more generic form of the <literal>sda_size</literal>
1045                 and <literal>sdb_size</literal> fields.</simpara>
1046               </listitem>
1047             </varlistentry>
1048             <varlistentry>
1049               <term>disk.sizes</term>
1050               <listitem>
1051                 <simpara>A comma-separated list of the disk sizes for
1052                 this instance.</simpara>
1053               </listitem>
1054             </varlistentry>
1055             <varlistentry>
1056               <term>disk_usage</term>
1057               <listitem>
1058                 <simpara>The total disk space used by this instance on
1059                 each of its nodes. This is not the instance-visible
1060                 disk size, but the actual disk "cost" of the
1061                 instance.</simpara>
1062               </listitem>
1063             </varlistentry>
1064             <varlistentry>
1065               <term>nic.mac/N</term>
1066               <listitem>
1067                 <simpara>The MAC of the Nth instance NIC.</simpara>
1068               </listitem>
1069             </varlistentry>
1070             <varlistentry>
1071               <term>nic.ip/N</term>
1072               <listitem>
1073                 <simpara>The IP address of the Nth instance NIC.</simpara>
1074               </listitem>
1075             </varlistentry>
1076             <varlistentry>
1077               <term>nic.mode/N</term>
1078               <listitem>
1079                 <simpara>The mode of the Nth instance NIC</simpara>
1080               </listitem>
1081             </varlistentry>
1082             <varlistentry>
1083               <term>nic.link/N</term>
1084               <listitem>
1085                 <simpara>The link of the Nth instance NIC</simpara>
1086               </listitem>
1087             </varlistentry>
1088             <varlistentry>
1089               <term>nic.macs</term>
1090               <listitem>
1091                 <simpara>A comma-separated list of all the MACs of the
1092                 instance's NICs.</simpara>
1093               </listitem>
1094             </varlistentry>
1095             <varlistentry>
1096               <term>nic.ips</term>
1097               <listitem>
1098                 <simpara>A comma-separated list of all the IP
1099                 addresses of the instance's NICs.</simpara>
1100               </listitem>
1101             </varlistentry>
1102             <varlistentry>
1103               <term>nic.modes</term>
1104               <listitem>
1105                 <simpara>A comma-separated list of all the modes of the
1106                 instance's NICs.</simpara>
1107               </listitem>
1108             </varlistentry>
1109             <varlistentry>
1110               <term>nic.links</term>
1111               <listitem>
1112                 <simpara>A comma-separated list of all the link parameters
1113                 of the instance's NICs.</simpara>
1114               </listitem>
1115             </varlistentry>
1116             <varlistentry>
1117               <term>nic.count</term>
1118               <listitem>
1119                 <simpara>The number of instance nics.</simpara>
1120               </listitem>
1121             </varlistentry>
1122             <varlistentry>
1123               <term>hv/<replaceable>NAME</replaceable></term>
1124               <listitem>
1125                 <simpara>The value of the hypervisor parameter called
1126                 <replaceable>NAME</replaceable>. For details of what
1127                 hypervisor parameters exist and their meaning, see the
1128                 <command>add</command> command.</simpara>
1129               </listitem>
1130             </varlistentry>
1131             <varlistentry>
1132               <term>be/memory</term>
1133               <listitem>
1134                 <simpara>The configured memory for the instance.</simpara>
1135               </listitem>
1136             </varlistentry>
1137             <varlistentry>
1138               <term>be/vcpus</term>
1139               <listitem>
1140                 <simpara>The configured number of VCPUs for the
1141                 instance.</simpara>
1142               </listitem>
1143             </varlistentry>
1144             <varlistentry>
1145               <term>be/auto_balance</term>
1146               <listitem>
1147                 <simpara>Whether the instance is considered in N+1
1148                 checks.</simpara>
1149               </listitem>
1150             </varlistentry>
1151           </variablelist>
1152         </para>
1153
1154         <para>
1155           If the value of the option starts with the character
1156           <constant>+</constant>, the new field(s) will be added to the
1157           default list. This allows to quickly see the default list
1158           plus a few other fields, instead of retyping the entire list
1159           of fields.
1160         </para>
1161
1162         <para>
1163           There is a subtle grouping about the available output
1164           fields: all fields except for <option>oper_state</option>,
1165           <option>oper_ram</option> and <option>status</option> are
1166           configuration value and not run-time values. So if you don't
1167           select any of the these fields, the query will be satisfied
1168           instantly from the cluster configuration, without having to
1169           ask the remote nodes for the data. This can be helpful for
1170           big clusters when you only want some data and it makes sense
1171           to specify a reduced set of output fields.
1172         </para>
1173
1174         <para>The default output field list is:
1175           <simplelist type="inline">
1176             <member>name</member>
1177             <member>os</member>
1178             <member>pnode</member>
1179             <member>admin_state</member>
1180             <member>oper_state</member>
1181             <member>oper_ram</member>
1182           </simplelist>.
1183         </para>
1184       </refsect3>
1185
1186       <refsect3>
1187         <title>INFO</title>
1188
1189         <cmdsynopsis>
1190           <command>info</command>
1191           <group>
1192             <arg>-s</arg>
1193             <arg>--static</arg>
1194           </group>
1195           <group choice="req">
1196             <arg>--all</arg>
1197             <arg rep="repeat"><replaceable>instance</replaceable></arg>
1198           </group>
1199         </cmdsynopsis>
1200
1201         <para>
1202           Show detailed information about the given instance(s). This is
1203           different from <command>list</command> as it shows detailed data
1204           about the instance's disks (especially useful for the drbd disk
1205           template).
1206         </para>
1207
1208         <para>
1209           If the option <option>-s</option> is used, only information
1210           available in the configuration file is returned, without
1211           querying nodes, making the operation faster.
1212         </para>
1213
1214         <para>
1215           Use the <option>--all</option> to get info about all instances,
1216           rather than explicitely passing the ones you're interested in.
1217         </para>
1218       </refsect3>
1219
1220       <refsect3>
1221         <title>MODIFY</title>
1222
1223         <cmdsynopsis>
1224           <command>modify</command>
1225           <sbr>
1226           <arg choice="opt">-H <replaceable>HYPERVISOR_PARAMETERS</replaceable></arg>
1227           <sbr>
1228           <arg choice="opt">-B <replaceable>BACKEND_PARAMETERS</replaceable></arg>
1229           <sbr>
1230           <group>
1231             <arg>--net add<replaceable><optional>:options</optional></replaceable></arg>
1232             <arg>--net remove</arg>
1233             <arg>--net <replaceable>N:options</replaceable></arg>
1234           </group>
1235           <sbr>
1236           <group>
1237             <arg>--disk add:size=<replaceable>SIZE</replaceable></arg>
1238             <arg>--disk remove</arg>
1239             <arg>--disk <replaceable>N</replaceable>:mode=<replaceable>MODE</replaceable></arg>
1240           </group>
1241
1242           <sbr>
1243           <arg>--submit</arg>
1244           <sbr>
1245           <arg choice="req"><replaceable>instance</replaceable></arg>
1246         </cmdsynopsis>
1247
1248         <para>
1249           Modifies the memory size, number of vcpus, ip address, MAC
1250           address and/or nic parameters for an instance. It can also
1251           add and remove disks and NICs to/from the instance. Note
1252           that you need to give at least one of the arguments, otherwise
1253           the command complains.
1254         </para>
1255
1256         <para>
1257           The <option>-H</option> option specifies hypervisor options
1258           in the form of <userinput>name=value[,...]</userinput>. For details which options can be specified, see the <command>add</command> command.
1259         </para>
1260
1261         <para>
1262           The <option>--disk
1263           add:size=<replaceable>SIZE</replaceable></option> option
1264           adds a disk to the instance. The <option>--disk
1265           remove</option> will remove the last disk of the
1266           instance. The <option>--disk
1267           <replaceable>N</replaceable>:mode=<replaceable>MODE</replaceable></option>
1268           option will change the mode of the Nth disk of the instance
1269           between read-only (<literal>ro</literal>) and read-write
1270           (<literal>rw</literal>).
1271         </para>
1272
1273         <para>
1274           The <option>--net
1275           add:<replaceable>options</replaceable></option> option will
1276           add a new NIC to the instance. The available options are the
1277           same as in the <command>add</command> command (mac, ip, link,
1278           mode). The <option>--net remove</option> will remove the
1279           last NIC of the instance, while the <option>--net
1280           <replaceable>N</replaceable>:<replaceable>options</replaceable></option>
1281           option will change the parameters of the Nth instance NIC.
1282         </para>
1283
1284         <para>
1285           The <option>--submit</option> option is used to send the job to
1286           the master daemon but not wait for its completion. The job
1287           ID will be shown so that it can be examined via
1288           <command>gnt-job info</command>.
1289         </para>
1290
1291         <para>
1292           All the changes take effect at the next restart. If the
1293           instance is running, there is no effect on the instance.
1294         </para>
1295       </refsect3>
1296
1297       <refsect3>
1298         <title>REINSTALL</title>
1299
1300         <cmdsynopsis>
1301           <command>reinstall</command>
1302           <arg choice="opt">-o <replaceable>os-type</replaceable></arg>
1303           <arg>--select-os</arg>
1304           <arg choice="opt">-f <replaceable>force</replaceable></arg>
1305           <arg>--force-multiple</arg>
1306           <sbr>
1307           <group choice="opt">
1308             <arg>--instance</arg>
1309             <arg>--node</arg>
1310             <arg>--primary</arg>
1311             <arg>--secondary</arg>
1312             <arg>--all</arg>
1313           </group>
1314           <arg>--submit</arg>
1315           <arg choice="opt" rep="repeat"><replaceable>instance</replaceable></arg>
1316         </cmdsynopsis>
1317
1318         <para>
1319           Reinstalls the operating system on the given instance(s). The
1320           instance(s) must be stopped when running this command. If the
1321           <option>--os-type</option> is specified, the operating
1322           system is changed.
1323         </para>
1324
1325         <para>
1326           The <option>--select-os</option> option switches to an
1327           interactive OS reinstall. The user is prompted to select the OS
1328           template from the list of available OS templates.
1329         </para>
1330
1331         <para>
1332           Since this is a potentially dangerous command, the user will
1333           be required to confirm this action, unless the
1334           <option>-f</option> flag is passed. When multiple instances
1335           are selected (either by passing multiple arguments or by
1336           using the <option>--node</option>,
1337           <option>--primary</option>, <option>--secondary</option> or
1338           <option>--all</option> options), the user must pass both the
1339           <option>--force</option> and
1340           <option>--force-multiple</option> options to skip the
1341           interactive confirmation.
1342         </para>
1343
1344         <para>
1345           The <option>--submit</option> option is used to send the job to
1346           the master daemon but not wait for its completion. The job
1347           ID will be shown so that it can be examined via
1348           <command>gnt-job info</command>.
1349         </para>
1350
1351
1352       </refsect3>
1353
1354       <refsect3>
1355         <title>RENAME</title>
1356
1357         <cmdsynopsis>
1358           <command>rename</command>
1359           <arg>--no-ip-check</arg>
1360           <arg>--submit</arg>
1361           <arg choice="req"><replaceable>instance</replaceable></arg>
1362           <arg choice="req"><replaceable>new_name</replaceable></arg>
1363         </cmdsynopsis>
1364
1365         <para>
1366           Renames the given instance. The instance must be stopped
1367           when running this command. The requirements for the new name
1368           are the same as for adding an instance: the new name must be
1369           resolvable and the IP it resolves to must not be reachable
1370           (in order to prevent duplicate IPs the next time the
1371           instance is started). The IP test can be skipped if the
1372           <option>--no-ip-check</option> option is passed.
1373         </para>
1374
1375         <para>
1376           The <option>--submit</option> option is used to send the job to
1377           the master daemon but not wait for its completion. The job
1378           ID will be shown so that it can be examined via
1379           <command>gnt-job info</command>.
1380         </para>
1381
1382       </refsect3>
1383
1384     </refsect2>
1385
1386     <refsect2>
1387       <title>Starting/stopping/connecting to console</title>
1388
1389       <refsect3>
1390         <title>STARTUP</title>
1391
1392         <cmdsynopsis>
1393           <command>startup</command>
1394           <sbr>
1395           <arg>--force</arg>
1396           <sbr>
1397           <arg>--force-multiple</arg>
1398           <sbr>
1399           <group choice="opt">
1400             <arg>--instance</arg>
1401             <arg>--node</arg>
1402             <arg>--primary</arg>
1403             <arg>--secondary</arg>
1404             <arg>--all</arg>
1405           </group>
1406           <sbr>
1407           <arg>-H <option>key=value...</option></arg>
1408           <arg>-B <option>key=value...</option></arg>
1409           <sbr>
1410           <arg>--submit</arg>
1411           <sbr>
1412           <arg choice="opt"
1413           rep="repeat"><replaceable>name</replaceable></arg>
1414         </cmdsynopsis>
1415
1416         <para>
1417           Starts one or more instances, depending on the following
1418           options. The four available modes are:
1419           <variablelist>
1420             <varlistentry>
1421               <term><option>--instance</option></term>
1422               <listitem>
1423                 <simpara>will start the instances given as arguments
1424                 (at least one argument required); this is the default
1425                 selection</simpara>
1426               </listitem>
1427             </varlistentry>
1428             <varlistentry>
1429               <term>--node</term>
1430               <listitem>
1431                 <simpara>will start the instances who have the given
1432                 node as either primary or secondary</simpara>
1433               </listitem>
1434             </varlistentry>
1435             <varlistentry>
1436               <term><option>--primary</option></term>
1437               <listitem>
1438                 <simpara>will start all instances whose primary node
1439                 is in the list of nodes passed as arguments (at least
1440                 one node required)</simpara>
1441               </listitem>
1442             </varlistentry>
1443             <varlistentry>
1444               <term><option>--secondary</option></term>
1445               <listitem>
1446                 <simpara>will start all instances whose secondary node
1447                 is in the list of nodes passed as arguments (at least
1448                 one node required)</simpara>
1449               </listitem>
1450             </varlistentry>
1451             <varlistentry>
1452               <term>--all</term>
1453               <listitem>
1454                 <simpara>will start all instances in the cluster (no
1455                 arguments accepted)</simpara>
1456               </listitem>
1457             </varlistentry>
1458           </variablelist>
1459         </para>
1460
1461         <para>
1462           Note that although you can pass more than one selection
1463           option, the last one wins, so in order to guarantee the
1464           desired result, don't pass more than one such option.
1465         </para>
1466
1467         <para>
1468           Use <option>--force</option> to start even if secondary disks are
1469           failing.
1470         </para>
1471
1472         <para>
1473           The <option>--force-multiple</option> will skip the
1474           interactive confirmation in the case the more than one
1475           instance will be affected.
1476         </para>
1477
1478         <para>
1479           The <option>-H</option> and <option>-B</option> options
1480           specify extra, temporary hypervisor and backend parameters
1481           that can be used to start an instance with modified
1482           parameters. They can be useful for quick testing without
1483           having to modify an instance back and forth, e.g.:
1484           <screen>
1485 # gnt-instance start -H root_args="single" instance1
1486 # gnt-instance start -B memory=2048 instance2
1487           </screen>
1488           The first form will start the instance
1489           <userinput>instance1</userinput> in single-user mode, and
1490           the instance <userinput>instance2</userinput> with 2GB of
1491           RAM (this time only, unless that is the actual instance
1492           memory size already).
1493         </para>
1494
1495         <para>
1496           The <option>--submit</option> option is used to send the job to
1497           the master daemon but not wait for its completion. The job
1498           ID will be shown so that it can be examined via
1499           <command>gnt-job info</command>.
1500         </para>
1501
1502         <para>
1503           Example:
1504           <screen>
1505 # gnt-instance start instance1.example.com
1506 # gnt-instance start --node node1.example.com node2.example.com
1507 # gnt-instance start --all
1508           </screen>
1509         </para>
1510       </refsect3>
1511
1512       <refsect3>
1513         <title>SHUTDOWN</title>
1514
1515         <cmdsynopsis>
1516           <command>shutdown</command>
1517           <sbr>
1518           <arg>--force-multiple</arg>
1519           <sbr>
1520           <group choice="opt">
1521             <arg>--instance</arg>
1522             <arg>--node</arg>
1523             <arg>--primary</arg>
1524             <arg>--secondary</arg>
1525             <arg>--all</arg>
1526           </group>
1527           <sbr>
1528           <arg>--submit</arg>
1529           <sbr>
1530           <arg choice="opt"
1531           rep="repeat"><replaceable>name</replaceable></arg>
1532         </cmdsynopsis>
1533
1534         <para>
1535           Stops one or more instances. If the instance cannot be
1536           cleanly stopped during a hardcoded interval (currently 2
1537           minutes), it will forcibly stop the instance (equivalent to
1538           switching off the power on a physical machine).
1539         </para>
1540
1541         <para>
1542           The <option>--instance</option>, <option>--node</option>,
1543           <option>--primary</option>, <option>--secondary</option> and
1544           <option>--all</option> options are similar as for the
1545           <command>startup</command> command and they influence the
1546           actual instances being shutdown.
1547         </para>
1548
1549         <para>
1550           The <option>--submit</option> option is used to send the job to
1551           the master daemon but not wait for its completion. The job
1552           ID will be shown so that it can be examined via
1553           <command>gnt-job info</command>.
1554         </para>
1555
1556
1557         <para>
1558           Example:
1559           <screen>
1560 # gnt-instance shutdown instance1.example.com
1561 # gnt-instance shutdown --all
1562           </screen>
1563         </para>
1564       </refsect3>
1565
1566       <refsect3>
1567         <title>REBOOT</title>
1568
1569         <cmdsynopsis>
1570           <command>reboot</command>
1571           <sbr>
1572           <arg>--type=<replaceable>REBOOT-TYPE</replaceable></arg>
1573           <sbr>
1574           <arg>--ignore-secondaries</arg>
1575           <sbr>
1576           <arg>--force-multiple</arg>
1577           <sbr>
1578           <group choice="opt">
1579             <arg>--instance</arg>
1580             <arg>--node</arg>
1581             <arg>--primary</arg>
1582             <arg>--secondary</arg>
1583             <arg>--all</arg>
1584           </group>
1585           <sbr>
1586           <arg>--submit</arg>
1587           <sbr>
1588           <arg choice="opt"
1589           rep="repeat"><replaceable>name</replaceable></arg>
1590         </cmdsynopsis>
1591
1592         <para>
1593           Reboots one or more instances. The type of reboot depends on
1594           the value of <option>--type</option>. A soft reboot does a
1595           hypervisor reboot, a hard reboot does a instance stop,
1596           recreates the hypervisor config for the instance and
1597           starts the instance. A full reboot does the equivalent
1598           of <command>gnt-instance shutdown &amp;&amp; gnt-instance
1599           startup</command>. The default is hard reboot.
1600         </para>
1601
1602         <para>
1603           For the hard reboot the option
1604           <option>--ignore-secondaries</option> ignores errors for the
1605           secondary node while re-assembling the instance disks.
1606         </para>
1607
1608         <para>
1609           The <option>--instance</option>, <option>--node</option>,
1610           <option>--primary</option>, <option>--secondary</option> and
1611           <option>--all</option> options are similar as for the
1612           <command>startup</command> command and they influence the
1613           actual instances being rebooted.
1614         </para>
1615
1616         <para>
1617           The <option>--force-multiple</option> will skip the
1618           interactive confirmation in the case the more than one
1619           instance will be affected.
1620         </para>
1621
1622         <para>
1623           Example:
1624           <screen>
1625 # gnt-instance reboot instance1.example.com
1626 # gnt-instance reboot --type=full instance1.example.com
1627           </screen>
1628         </para>
1629       </refsect3>
1630
1631       <refsect3>
1632         <title>CONSOLE</title>
1633         <cmdsynopsis>
1634           <command>console</command>
1635           <arg choice="opt">--show-cmd</arg>
1636           <arg choice="req"><replaceable>instance</replaceable></arg>
1637         </cmdsynopsis>
1638
1639         <para>
1640           Connects to the console of the given instance. If the
1641           instance is not up, an error is returned. Use the
1642           <option>--show-cmd</option> option to display the command
1643           instead of executing it.
1644         </para>
1645
1646         <para>
1647           For HVM instances, this will attempt to connect to the
1648           serial console of the instance. To connect to the
1649           virtualized "physical" console of a HVM instance, use a VNC
1650           client with the connection info from the
1651           <command>info</command> command.
1652         </para>
1653
1654         <para>
1655           Example:
1656           <screen>
1657 # gnt-instance console instance1.example.com
1658           </screen>
1659         </para>
1660       </refsect3>
1661
1662     </refsect2>
1663
1664     <refsect2>
1665       <title>Disk management</title>
1666
1667       <refsect3>
1668         <title>REPLACE-DISKS</title>
1669
1670         <cmdsynopsis>
1671           <command>replace-disks</command>
1672           <arg>--submit</arg>
1673           <arg choice="req">-p</arg>
1674           <arg>--disks <replaceable>idx</replaceable></arg>
1675           <arg choice="req"><replaceable>instance</replaceable></arg>
1676         </cmdsynopsis>
1677
1678         <cmdsynopsis>
1679           <command>replace-disks</command>
1680           <arg>--submit</arg>
1681           <arg choice="req">-s</arg>
1682           <arg>--disks <replaceable>idx</replaceable></arg>
1683           <arg choice="req"><replaceable>instance</replaceable></arg>
1684         </cmdsynopsis>
1685
1686         <cmdsynopsis>
1687           <command>replace-disks</command>
1688           <arg>--submit</arg>
1689           <group choice="req">
1690             <arg>--iallocator <replaceable>name</replaceable></arg>
1691             <arg>--new-secondary <replaceable>NODE</replaceable></arg>
1692           </group>
1693
1694           <arg choice="req"><replaceable>instance</replaceable></arg>
1695         </cmdsynopsis>
1696
1697         <cmdsynopsis>
1698           <command>replace-disks</command>
1699           <arg>--submit</arg>
1700           <arg choice="req">--auto</arg>
1701           <arg choice="req"><replaceable>instance</replaceable></arg>
1702         </cmdsynopsis>
1703
1704         <para>
1705           This command is a generalized form for replacing disks. It
1706           is currently only valid for the mirrored (DRBD) disk
1707           template.
1708         </para>
1709
1710         <para>
1711           The first form (when passing the <option>-p</option> option)
1712           will replace the disks on the primary, while the second form
1713           (when passing the <option>-s</option> option will replace
1714           the disks on the secondary node. For these two cases (as the
1715           node doesn't change), it is possible to only run the replace
1716           for a subset of the disks, using the option
1717           <option>--disks</option> which takes a list of
1718           comma-delimited disk indices (zero-based),
1719           e.g. <userinput>0,2</userinput> to replace only the first
1720           and third disks.
1721         </para>
1722
1723         <para>
1724           The third form (when passing either the
1725           <option>--iallocator</option> or the
1726           <option>--new-secondary</option> option) is designed to
1727           change secondary node of the instance.  Specifying
1728           <option>--iallocator</option> makes the new secondary be
1729           selected automatically by the specified allocator plugin,
1730           otherwise the new secondary node will be the one chosen
1731           manually via the <option>--new-secondary</option> option.
1732         </para>
1733
1734         <para>
1735           The fourth form (when using <option>--auto</option>) will
1736           automatically determine which disks of an instance are faulty and
1737           replace them within the same node. The <option>--auto</option>
1738           option works only when an instance has only faulty disks on
1739           either the primary or secondary node; it doesn't work when
1740           both sides have faulty disks.
1741         </para>
1742
1743         <para>
1744           The <option>--submit</option> option is used to send the job to
1745           the master daemon but not wait for its completion. The job
1746           ID will be shown so that it can be examined via
1747           <command>gnt-job info</command>.
1748         </para>
1749
1750         <para>
1751           Note that it is not possible to select an offline or drained
1752           node as a new secondary.
1753         </para>
1754
1755       </refsect3>
1756
1757       <refsect3>
1758         <title>ACTIVATE-DISKS</title>
1759
1760         <cmdsynopsis>
1761           <command>activate-disks</command>
1762           <arg>--submit</arg>
1763           <arg>--ignore-size</arg>
1764           <arg choice="req"><replaceable>instance</replaceable></arg>
1765         </cmdsynopsis>
1766         <para>
1767           Activates the block devices of the given instance. If
1768           successful, the command will show the location and name of
1769           the block devices:
1770           <screen>
1771 node1.example.com:disk/0:/dev/drbd0
1772 node1.example.com:disk/1:/dev/drbd1
1773           </screen>
1774
1775           In this example, <emphasis>node1.example.com</emphasis> is
1776           the name of the node on which the devices have been
1777           activated. The <emphasis>disk/0</emphasis> and
1778           <emphasis>disk/1</emphasis> are the Ganeti-names of the
1779           instance disks; how they are visible inside the instance is
1780           hypervisor-specific. <emphasis>/dev/drbd0</emphasis> and
1781           <emphasis>/dev/drbd1</emphasis> are the actual block devices
1782           as visible on the node.
1783         </para>
1784
1785         <para>
1786           The <option>--submit</option> option is used to send the job to
1787           the master daemon but not wait for its completion. The job
1788           ID will be shown so that it can be examined via
1789           <command>gnt-job info</command>.
1790         </para>
1791
1792         <para>
1793           The <option>--ignore-size</option> option can be used to
1794           activate disks ignoring the currently configured size in
1795           Ganeti. This can be used in cases where the configuration
1796           has gotten out of sync with the real-world (e.g. after a
1797           partially-failed grow-disk operation or due to rounding in
1798           LVM devices). This should not be used in normal cases, but
1799           only when activate-disks fails without it.
1800         </para>
1801
1802         <para>
1803           Note that it is safe to run this command while the instance
1804           is already running.
1805         </para>
1806       </refsect3>
1807
1808       <refsect3>
1809         <title>DEACTIVATE-DISKS</title>
1810
1811         <cmdsynopsis>
1812           <command>deactivate-disks</command>
1813           <arg>--submit</arg>
1814           <arg choice="req"><replaceable>instance</replaceable></arg>
1815         </cmdsynopsis>
1816         <para>
1817           De-activates the block devices of the given instance. Note
1818           that if you run this command for an instance with a drbd
1819           disk template, while it is running, it will not be able to
1820           shutdown the block devices on the primary node, but it will
1821           shutdown the block devices on the secondary nodes, thus
1822           breaking the replication.
1823         </para>
1824
1825         <para>
1826           The <option>--submit</option> option is used to send the job to
1827           the master daemon but not wait for its completion. The job
1828           ID will be shown so that it can be examined via
1829           <command>gnt-job info</command>.
1830         </para>
1831
1832       </refsect3>
1833
1834       <refsect3>
1835         <title>GROW-DISK</title>
1836         <cmdsynopsis>
1837           <command>grow-disk</command>
1838           <arg>--no-wait-for-sync</arg>
1839           <arg>--submit</arg>
1840           <arg choice="req"><replaceable>instance</replaceable></arg>
1841           <arg choice="req"><replaceable>disk</replaceable></arg>
1842           <arg choice="req"><replaceable>amount</replaceable></arg>
1843         </cmdsynopsis>
1844
1845         <para>
1846           Grows an instance's disk. This is only possible for
1847           instances having a <literal>plain</literal> or
1848           <literal>drbd</literal> disk template.
1849         </para>
1850
1851         <para>
1852           Note that this command only change the block device size; it
1853           will not grow the actual filesystems, partitions, etc. that
1854           live on that disk. Usually, you will need to:
1855           <orderedlist>
1856             <listitem>
1857               <simpara>use <command>gnt-instance grow-disk</command></simpara>
1858             </listitem>
1859             <listitem>
1860               <simpara>reboot the instance (later, at a convenient
1861               time)</simpara>
1862             </listitem>
1863             <listitem>
1864               <simpara>use a filesystem resizer, such as
1865               <citerefentry> <refentrytitle>ext2online</refentrytitle>
1866               <manvolnum>8</manvolnum> </citerefentry> or
1867               <citerefentry> <refentrytitle>xfs_growfs</refentrytitle>
1868               <manvolnum>8</manvolnum> </citerefentry> to resize the
1869               filesystem, or use <citerefentry>
1870               <refentrytitle>fdisk</refentrytitle>
1871               <manvolnum>8</manvolnum> </citerefentry> to change the
1872               partition table on the disk
1873               </simpara>
1874             </listitem>
1875           </orderedlist>
1876         </para>
1877
1878
1879         <para>
1880           The <replaceable>disk</replaceable> argument is the index of
1881           the instance disk to grow. The
1882           <replaceable>amount</replaceable> argument is given either
1883           as a number (and it represents the amount to increase the
1884           disk with in mebibytes) or can be given similar to the
1885           arguments in the create instance operation, with a suffix
1886           denoting the unit.
1887         </para>
1888
1889         <para>
1890           Note that the disk grow operation might complete on one node
1891           but fail on the other; this will leave the instance with
1892           different-sized LVs on the two nodes, but this will not
1893           create problems (except for unused space).
1894         </para>
1895
1896         <para>
1897           If you do not want gnt-instance to wait for the new disk
1898           region to be synced, use the
1899           <option>--no-wait-for-sync</option> option.
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
1910         <para>Example (increase the first disk for instance1 by 16GiB):
1911           <screen>
1912 # gnt-instance grow-disk instance1.example.com 0 16g
1913           </screen>
1914         </para>
1915
1916         <para>
1917           Also note that disk shrinking is not supported; use
1918           <command>gnt-backup export</command> and then
1919           <command>gnt-backup import</command> to reduce the disk size
1920           of an instance.
1921         </para>
1922       </refsect3>
1923
1924       <refsect3>
1925         <title>RECREATE-DISKS</title>
1926
1927         <cmdsynopsis>
1928           <command>recreate-disks</command>
1929           <arg>--submit</arg>
1930           <arg>--disks=<option>indices</option></arg>
1931           <arg choice="req"><replaceable>instance</replaceable></arg>
1932         </cmdsynopsis>
1933         <para>
1934           Recreates the disks of the given instance, or only a subset
1935           of the disks (if the option <option>disks</option> is
1936           passed, which must be a comma-separated list of disk
1937           indices, starting from zero).
1938         </para>
1939
1940         <para>
1941           The <option>--submit</option> option is used to send the job to
1942           the master daemon but not wait for its completion. The job
1943           ID will be shown so that it can be examined via
1944           <command>gnt-job info</command>.
1945         </para>
1946
1947       </refsect3>
1948
1949     </refsect2>
1950
1951     <refsect2>
1952       <title>Recovery</title>
1953
1954       <refsect3>
1955         <title>FAILOVER</title>
1956
1957         <cmdsynopsis>
1958           <command>failover</command>
1959           <arg>-f</arg>
1960           <arg>--ignore-consistency</arg>
1961           <arg>--submit</arg>
1962           <arg choice="req"><replaceable>instance</replaceable></arg>
1963         </cmdsynopsis>
1964
1965         <para>
1966           Failover will fail the instance over its secondary
1967           node. This works only for instances having a drbd disk
1968           template.
1969         </para>
1970
1971         <para>
1972           Normally the failover will check the consistency of the
1973           disks before failing over the instance. If you are trying to
1974           migrate instances off a dead node, this will fail. Use the
1975           <option>--ignore-consistency</option> option for this
1976           purpose. Note that this option can be dangerous as errors in
1977           shutting down the instance will be ignored, resulting in
1978           possibly having the instance running on two machines in
1979           parallel (on disconnected DRBD drives).
1980         </para>
1981
1982         <para>
1983           The <option>--submit</option> option is used to send the job to
1984           the master daemon but not wait for its completion. The job
1985           ID will be shown so that it can be examined via
1986           <command>gnt-job info</command>.
1987         </para>
1988
1989         <para>
1990           Example:
1991           <screen>
1992 # gnt-instance failover instance1.example.com
1993           </screen>
1994         </para>
1995       </refsect3>
1996
1997       <refsect3>
1998         <title>MIGRATE</title>
1999
2000         <cmdsynopsis>
2001           <command>migrate</command>
2002           <arg>-f</arg>
2003           <arg choice="req">--cleanup</arg>
2004           <arg choice="req"><replaceable>instance</replaceable></arg>
2005         </cmdsynopsis>
2006
2007         <cmdsynopsis>
2008           <command>migrate</command>
2009           <arg>-f</arg>
2010           <arg>--non-live</arg>
2011           <arg choice="req"><replaceable>instance</replaceable></arg>
2012         </cmdsynopsis>
2013
2014         <para>
2015           Migrate will move the instance to its secondary node without
2016           shutdown. It only works for instances having the drbd8 disk
2017           template type.
2018         </para>
2019
2020         <para>
2021           The migration command needs a perfectly healthy instance, as
2022           we rely on the dual-master capability of drbd8 and the disks
2023           of the instance are not allowed to be degraded.
2024         </para>
2025
2026         <para>
2027           The <option>--non-live</option> option will switch (for the
2028           hypervisors that support it) between a "fully live"
2029           (i.e. the interruption is as minimal as possible) migration
2030           and one in which the instance is frozen, its state saved and
2031           transported to the remote node, and then resumed there. This
2032           all depends on the hypervisor support for two different
2033           methods. In any case, it is not an error to pass this
2034           parameter (it will just be ignored if the hypervisor doesn't
2035           support it).
2036         </para>
2037
2038         <para>
2039           If the <option>--cleanup</option> option is passed, the
2040           operation changes from migration to attempting recovery from
2041           a failed previous migration. In this mode, ganeti checks if
2042           the instance runs on the correct node (and updates its
2043           configuration if not) and ensures the instances's disks are
2044           configured correctly. In this mode, the
2045           <option>--non-live</option> option is ignored.
2046         </para>
2047
2048         <para>
2049           The option <option>-f</option> will skip the prompting for
2050           confirmation.
2051         </para>
2052         <para>
2053           Example (and expected output):
2054           <screen>
2055 # gnt-instance migrate instance1
2056 Migrate will happen to the instance instance1. Note that migration is
2057 **experimental** in this version. This might impact the instance if
2058 anything goes wrong. Continue?
2059 y/[n]/?: y
2060 * checking disk consistency between source and target
2061 * ensuring the target is in secondary mode
2062 * changing disks into dual-master mode
2063  - INFO: Waiting for instance instance1 to sync disks.
2064  - INFO: Instance instance1's disks are in sync.
2065 * migrating instance to node2.example.com
2066 * changing the instance's disks on source node to secondary
2067  - INFO: Waiting for instance instance1 to sync disks.
2068  - INFO: Instance instance1's disks are in sync.
2069 * changing the instance's disks to single-master
2070 #
2071           </screen>
2072         </para>
2073       </refsect3>
2074
2075       <refsect3>
2076         <title>MOVE</title>
2077
2078         <cmdsynopsis>
2079           <command>move</command>
2080           <arg>-f</arg>
2081           <arg>-n <replaceable>node</replaceable></arg>
2082           <arg>--submit</arg>
2083           <arg choice="req"><replaceable>instance</replaceable></arg>
2084         </cmdsynopsis>
2085
2086         <para>
2087           Move will move the instance to an arbitrary node in the
2088           cluster. This works only for instances having a plain or
2089           file disk template.
2090         </para>
2091
2092         <para>
2093           Note that since this operation is done via data copy, it
2094           will take a long time for big disks (similar to
2095           replace-disks for a drbd instance).
2096         </para>
2097
2098         <para>
2099           The <option>--submit</option> option is used to send the job to
2100           the master daemon but not wait for its completion. The job
2101           ID will be shown so that it can be examined via
2102           <command>gnt-job info</command>.
2103         </para>
2104
2105         <para>
2106           Example:
2107           <screen>
2108 # gnt-instance move -n node3.example.com instance1.example.com
2109           </screen>
2110         </para>
2111       </refsect3>
2112
2113     </refsect2>
2114
2115     <refsect2>
2116       <title>TAGS</title>
2117
2118     <refsect3>
2119         <title>ADD-TAGS</title>
2120
2121         <cmdsynopsis>
2122           <command>add-tags</command>
2123           <arg choice="opt">--from <replaceable>file</replaceable></arg>
2124           <arg choice="req"><replaceable>instancename</replaceable></arg>
2125           <arg choice="req"
2126             rep="repeat"><replaceable>tag</replaceable></arg>
2127         </cmdsynopsis>
2128
2129         <para>
2130           Add tags to the given instance. If any of the tags contains
2131           invalid characters, the entire operation will abort.
2132         </para>
2133         <para>
2134           If the <option>--from</option> option is given, the list of
2135           tags will be extended with the contents of that file (each
2136           line becomes a tag). In this case, there is not need to pass
2137           tags on the command line (if you do, both sources will be
2138           used). A file name of - will be interpreted as stdin.
2139         </para>
2140       </refsect3>
2141
2142       <refsect3>
2143         <title>LIST-TAGS</title>
2144
2145         <cmdsynopsis>
2146           <command>list-tags</command>
2147           <arg choice="req"><replaceable>instancename</replaceable></arg>
2148         </cmdsynopsis>
2149
2150         <para>List the tags of the given instance.</para>
2151       </refsect3>
2152
2153       <refsect3>
2154         <title>REMOVE-TAGS</title>
2155         <cmdsynopsis>
2156           <command>remove-tags</command>
2157           <arg choice="opt">--from <replaceable>file</replaceable></arg>
2158           <arg choice="req"><replaceable>instancename</replaceable></arg>
2159           <arg choice="req"
2160             rep="repeat"><replaceable>tag</replaceable></arg>
2161         </cmdsynopsis>
2162
2163         <para>
2164           Remove tags from the given instance. If any of the tags are
2165           not existing on the node, the entire operation will abort.
2166         </para>
2167
2168         <para>
2169           If the <option>--from</option> option is given, the list of
2170           tags will be extended with the contents of that file (each
2171           line becomes a tag). In this case, there is not need to pass
2172           tags on the command line (if you do, both sources will be
2173           used). A file name of - will be interpreted as stdin.
2174         </para>
2175       </refsect3>
2176
2177     </refsect2>
2178
2179   </refsect1>
2180
2181   &footer;
2182
2183 </refentry>
2184
2185 <!-- Keep this comment at the end of the file
2186 Local variables:
2187 mode: sgml
2188 sgml-omittag:t
2189 sgml-shorttag:t
2190 sgml-minimize-attributes:nil
2191 sgml-always-quote-attributes:t
2192 sgml-indent-step:2
2193 sgml-indent-data:t
2194 sgml-parent-document:nil
2195 sgml-default-dtd-file:nil
2196 sgml-exposed-tags:nil
2197 sgml-local-catalogs:nil
2198 sgml-local-ecat-files:nil
2199 End:
2200 -->