<commit_before><?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns:html="http://www.w3.org/1999/xhtml"
    version="5.0"
    xml:id="nova-cli-refrence">
    <title>OpenStack Nova CLI Guide</title>
    <para>This section describes what  you can do with the OpenStack
        Nova client (CLI). </para>
    <section xml:id="nova_help">
        <title>Get Command, Parameter, and Subcommand Help</title>
        <para>Help for commands, parameters, and subcommands is
            available with the <command>nova help</command> command.
            <screen>
<prompt>$</prompt> <userinput>nova help</userinput>
            </screen></para>
        <para>Include the command name to get usage information about
            an individual command, as in the following example.
            <screen>
<prompt>$</prompt> <userinput>nova help actions</userinput>
usage: nova actions &lt;server>

Retrieve server actions.

Positional arguments:
  &lt;server>  Name or ID of server.
            </screen></para>
    </section>
    <section xml:id="listing">
        <title>List Instances, Images, and Flavors</title>
        <para>Before you can go about the business of building your cloud, you
            want to know what images are available to you by asking
            the image service what kinds of configurations are
            available. The image service could be compared to iTunes
            for your cloud - you can view the playlist of images
            before using your favorite image to create a new instance
            in the cloud. To get the list of images, their names,
            status, and ID, use this command:
            <screen>
<prompt>$</prompt> <userinput>nova image-list</userinput>
+--------------------------------------+----------------+--------+--------+
|                  ID                  |      Name      | Status | Server |
+--------------------------------------+----------------+--------+--------+
| 53b205cc-7abc-46eb-aa60-eabc449b4217 |  natty-image   | ACTIVE |        |
| 588d93af-645d-4312-a5b0-81347715a91b |   tty-image    | ACTIVE |        |
| ac6f83b7-078c-47bd-b4c2-4053282da49e | oneiric-image  | ACTIVE |        |
| e110fb7d-2a9e-4da5-923f-5565867ce87a | maverick-image | ACTIVE |        |
+--------------------------------------+----------------+--------+--------+
        </screen></para>
        <para>Next you need to know the relative sizes of each of these. </para>
        <para><screen>
<prompt>$</prompt> <userinput>nova flavor-list</userinput>
+----+-----------+-----------+------+-----------+------+-------+-------------+
| ID |    Name   | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor |
+----+-----------+-----------+------+-----------+------+-------+-------------+
| 1  |  m1.tiny  |    512    |  0   |     0     |      |   1   |     1.0     |
| 2  |  m1.small |    2048   |  10  |     20    |      |   1   |     1.0     |
| 3  | m1.medium |    4096   |  10  |     40    |      |   2   |     1.0     |
| 4  |  m1.large |    8192   |  10  |     80    |      |   4   |     1.0     |
| 5  | m1.xlarge |   16384   |  10  |    160    |      |   8   |     1.0     |
+----+-----------+-----------+------+-----------+------+-------+-------------+
    </screen></para>
        <para>You can also narrow down the list by using grep to find only the CentOS images with a command like this: </para>
        <para>
            <screen>
<prompt>$</prompt> <userinput>nova image-list | grep 'natty'</userinput>

| 12 | natty-server-cloudimg-amd64-kernel   | ACTIVE |        |
| 13 | natty-server-cloudimg-amd64          | ACTIVE |        |
</screen>
        </para>
    </section>
    <section xml:id="launch_instance">
        <title>Launch a New Instance</title>
        <para>Launching a new instance on OpenStack.</para>
        <section xml:id="launch_commands_used">
            <title>Commands Used</title>
            <para>This process uses the following commands: <itemizedlist>
                    <listitem>
                        <para><command>nova boot</command></para>
                    </listitem>
                    <listitem>
                        <para><command>nova list</command></para>
                    </listitem>
                    <listitem>
                        <para><command>nova show</command></para>
                    </listitem>
                </itemizedlist></para>
        </section>
        <section xml:id="launch_procedure">
            <title>Before Launch</title>
            
            <para>With the information about what is available to you, you can choose the combination of image and flavor to create your virtual servers and launch instances. </para></section>
        
        <xi:include href="nova_cli_boot.xml" />
        <section xml:id="boot_from_volume">
            <title>Launch from a Volume</title>
                <para>The Compute service has preliminary support for booting an instance from a
                    volume.</para>
                <simplesect>
                    <title>Creating a bootable volume</title>
                    <para>To create a bootable volume, mount the volume to an existing instance, and then
                        build a volume-backed image. Here is an example based on <link
                            xlink:href="https://github.com/openstack-dev/devstack/blob/master/exercises/boot_from_volume.sh"
                            >exercises/boot_from_volume.sh</link>. This example assumes that you have a
                        running instance with a 1GB volume mounted at <literal>/dev/vdc</literal>. These
                        commands will make the mounted volume bootable using a CirrOS image. As
                        root:<screen><prompt>#</prompt> <userinput>mkfs.ext3 -b 1024 /dev/vdc 1048576</userinput>
<prompt>#</prompt> <userinput>mkdir /tmp/stage</userinput>
<prompt>#</prompt> <userinput>mount /dev/vdc /tmp/stage</userinput>

<prompt>#</prompt> <userinput>cd /tmp</userinput>
<prompt>#</prompt> <userinput>wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz</userinput>
<prompt>#</prompt> <userinput>gunzip cirros-0.3.0-x86_64-rootfs.img.gz</userinput>
<prompt>#</prompt> <userinput>mkdir /tmp/cirros</userinput>
<prompt>#</prompt> <userinput>mount /tmp/cirros-0.3.0-x86_64-rootfs.img /tmp/cirros</userinput>

<prompt>#</prompt> <userinput>cp -pr /tmp/cirros/* /tmp/stage</userinput>
<prompt>#</prompt> <userinput>umount /tmp/cirros</userinput>
<prompt>#</prompt> <userinput>sync</userinput>
<prompt>#</prompt> <userinput>umount /tmp/stage</userinput></screen></para>
                    <para>Detach the volume once you are done.</para>
                </simplesect>
                <simplesect>
                    <title>Booting an instance from the volume</title>
                    <para>To boot a new instance from the volume, use the <command>nova boot</command>
                        comand with use the <literal>--block_device_mapping</literal> flag. The output for
                        <command>nova help boot</command> shows the following documentation about this
                        flag:<screen><computeroutput> --block_device_mapping &lt;dev_name=mapping>
                        Block device mapping in the format &lt;dev_name=&lt;id>:&lt;typ
                        e>:&lt;size(GB)>:&lt;delete_on_terminate>.
 </computeroutput></screen></para>
                    <para>The command arguments are:<variablelist>
                        <varlistentry>
                            <term><literal>dev_name</literal></term>
                            <listitem>
                                <para>A device name where the volume will be attached in the system at
                                    <filename>/dev/<replaceable>dev_name</replaceable></filename>.
                                    This value is typically <literal>vda</literal>.</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>id</literal></term>
                            <listitem>
                                <para>The ID of the volume to boot from, as shown in the output of
                                    <command>nova volume-list</command>.</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>type</literal></term>
                            <listitem>
                                <para>This is either <literal>snap</literal>, which means that the
                                    volume was created from a snapshot, or anything other than
                                    <literal>snap</literal> (a blank string is valid). In the
                                    example above, the volume was not created from a snapshot, so we
                                    will leave this field blank in our example below.</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>size (GB)</literal></term>
                            <listitem>
                                <para>The size of the volume, in GB. It is safe to leave this blank and
                                    have the Compute service infer the size.</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>delete_on_terminate</literal></term>
                            <listitem>
                                <para>A boolean to indicate whether the volume should be deleted when
                                    the instance is terminated. True can be specified as
                                    <literal>True</literal> or <literal>1</literal>. False can be
                                    specified as <literal>False</literal> or
                                    <literal>0</literal>.</para>
                            </listitem>
                        </varlistentry>
                    </variablelist></para>
                    <para><note>
                        <para>Because of bug <link
                            xlink:href="https://bugs.launchpad.net/nova/+bug/1008622"
                            >#1008622</link>, you must specify an image when booting from a volume,
                            even though this image will not be used.</para>
                    </note>The following example will attempt boot from volume with
                        ID=<literal>13</literal>, it will not delete on terminate. Replace the
                        <literal>--image</literal> flag with a valid image on your system, and the
                        <literal>--key_name</literal> with a valid keypair
                        name:<screen><prompt>$</prompt> <userinput>nova boot --image <replaceable>f4addd24-4e8a-46bb-b15d-fae2591f1a35</replaceable> --flavor 2 --key_name <replaceable>mykey</replaceable> --block_device_mapping vda=13:::0 boot-from-vol-test</userinput></screen></para>
                </simplesect>
                
            
            
            
        </section>
        <section xml:id="boot_from_iso">
            <title>Launch from ISO</title>
            <para>Text</para>
        </section>
        <section xml:id="boot_from_config_drive">
            <title>Launch from config drive</title>
            <para>Text</para>
        </section>
        <section xml:id="inserting_metadata">
            <title>Insert metadata during launch</title>
            <para>When booting a server, you can also add metadata, so
                that you can more easily identify it amongst your
                ever-growing elastic cloud. Use the
                    <literal>--meta</literal> option with a key=value
                pair, where you can make up the string for both the
                key and the value. For example, you could add a
                description and also the creator of the server.
                <screen>
<prompt>$</prompt> <userinput>nova boot --image=natty-image --flavor=2 smallimage2 --meta description='Small test image' --meta creator=joecool</userinput>
                </screen></para>
            <para>When viewing the server information, you can see the metadata included on the <literal>metadata</literal> line:
            <screen><commit_msg>Update nova option names with dashes<commit_after><?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns:html="http://www.w3.org/1999/xhtml"
    version="5.0"
    xml:id="nova-cli-refrence">
    <title>OpenStack Nova CLI Guide</title>
    <para>This section describes what  you can do with the OpenStack
        Nova client (CLI). </para>
    <section xml:id="nova_help">
        <title>Get Command, Parameter, and Subcommand Help</title>
        <para>Help for commands, parameters, and subcommands is
            available with the <command>nova help</command> command.
            <screen>
<prompt>$</prompt> <userinput>nova help</userinput>
            </screen></para>
        <para>Include the command name to get usage information about
            an individual command, as in the following example.
            <screen>
<prompt>$</prompt> <userinput>nova help actions</userinput>
usage: nova actions &lt;server>

Retrieve server actions.

Positional arguments:
  &lt;server>  Name or ID of server.
            </screen></para>
    </section>
    <section xml:id="listing">
        <title>List Instances, Images, and Flavors</title>
        <para>Before you can go about the business of building your cloud, you
            want to know what images are available to you by asking
            the image service what kinds of configurations are
            available. The image service could be compared to iTunes
            for your cloud - you can view the playlist of images
            before using your favorite image to create a new instance
            in the cloud. To get the list of images, their names,
            status, and ID, use this command:
            <screen>
<prompt>$</prompt> <userinput>nova image-list</userinput>
+--------------------------------------+----------------+--------+--------+
|                  ID                  |      Name      | Status | Server |
+--------------------------------------+----------------+--------+--------+
| 53b205cc-7abc-46eb-aa60-eabc449b4217 |  natty-image   | ACTIVE |        |
| 588d93af-645d-4312-a5b0-81347715a91b |   tty-image    | ACTIVE |        |
| ac6f83b7-078c-47bd-b4c2-4053282da49e | oneiric-image  | ACTIVE |        |
| e110fb7d-2a9e-4da5-923f-5565867ce87a | maverick-image | ACTIVE |        |
+--------------------------------------+----------------+--------+--------+
        </screen></para>
        <para>Next you need to know the relative sizes of each of these. </para>
        <para><screen>
<prompt>$</prompt> <userinput>nova flavor-list</userinput>
+----+-----------+-----------+------+-----------+------+-------+-------------+
| ID |    Name   | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor |
+----+-----------+-----------+------+-----------+------+-------+-------------+
| 1  |  m1.tiny  |    512    |  0   |     0     |      |   1   |     1.0     |
| 2  |  m1.small |    2048   |  10  |     20    |      |   1   |     1.0     |
| 3  | m1.medium |    4096   |  10  |     40    |      |   2   |     1.0     |
| 4  |  m1.large |    8192   |  10  |     80    |      |   4   |     1.0     |
| 5  | m1.xlarge |   16384   |  10  |    160    |      |   8   |     1.0     |
+----+-----------+-----------+------+-----------+------+-------+-------------+
    </screen></para>
        <para>You can also narrow down the list by using grep to find only the CentOS images with a command like this: </para>
        <para>
            <screen>
<prompt>$</prompt> <userinput>nova image-list | grep 'natty'</userinput>

| 12 | natty-server-cloudimg-amd64-kernel   | ACTIVE |        |
| 13 | natty-server-cloudimg-amd64          | ACTIVE |        |
</screen>
        </para>
    </section>
    <section xml:id="launch_instance">
        <title>Launch a New Instance</title>
        <para>Launching a new instance on OpenStack.</para>
        <section xml:id="launch_commands_used">
            <title>Commands Used</title>
            <para>This process uses the following commands: <itemizedlist>
                    <listitem>
                        <para><command>nova boot</command></para>
                    </listitem>
                    <listitem>
                        <para><command>nova list</command></para>
                    </listitem>
                    <listitem>
                        <para><command>nova show</command></para>
                    </listitem>
                </itemizedlist></para>
        </section>
        <section xml:id="launch_procedure">
            <title>Before Launch</title>
            
            <para>With the information about what is available to you, you can choose the combination of image and flavor to create your virtual servers and launch instances. </para></section>
        
        <xi:include href="nova_cli_boot.xml" />
        <section xml:id="boot_from_volume">
            <title>Launch from a Volume</title>
                <para>The Compute service has preliminary support for booting an instance from a
                    volume.</para>
                <simplesect>
                    <title>Creating a bootable volume</title>
                    <para>To create a bootable volume, mount the volume to an existing instance, and then
                        build a volume-backed image. Here is an example based on <link
                            xlink:href="https://github.com/openstack-dev/devstack/blob/master/exercises/boot_from_volume.sh"
                            >exercises/boot_from_volume.sh</link>. This example assumes that you have a
                        running instance with a 1GB volume mounted at <literal>/dev/vdc</literal>. These
                        commands will make the mounted volume bootable using a CirrOS image. As
                        root:<screen><prompt>#</prompt> <userinput>mkfs.ext3 -b 1024 /dev/vdc 1048576</userinput>
<prompt>#</prompt> <userinput>mkdir /tmp/stage</userinput>
<prompt>#</prompt> <userinput>mount /dev/vdc /tmp/stage</userinput>

<prompt>#</prompt> <userinput>cd /tmp</userinput>
<prompt>#</prompt> <userinput>wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz</userinput>
<prompt>#</prompt> <userinput>gunzip cirros-0.3.0-x86_64-rootfs.img.gz</userinput>
<prompt>#</prompt> <userinput>mkdir /tmp/cirros</userinput>
<prompt>#</prompt> <userinput>mount /tmp/cirros-0.3.0-x86_64-rootfs.img /tmp/cirros</userinput>

<prompt>#</prompt> <userinput>cp -pr /tmp/cirros/* /tmp/stage</userinput>
<prompt>#</prompt> <userinput>umount /tmp/cirros</userinput>
<prompt>#</prompt> <userinput>sync</userinput>
<prompt>#</prompt> <userinput>umount /tmp/stage</userinput></screen></para>
                    <para>Detach the volume once you are done.</para>
                </simplesect>
                <simplesect>
                    <title>Booting an instance from the volume</title>
                    <para>To boot a new instance from the volume, use the <command>nova boot</command>
                        comand with use the <literal>--block-device-mapping</literal> flag. The output for
                        <command>nova help boot</command> shows the following documentation about this
                        flag:<screen><computeroutput> --block-device-mapping &lt;dev-name=mapping>
                        Block device mapping in the format
                        &lt;dev-name=&lt;id>:&lt;type>:&lt;size(GB)>:&lt;delete-on-terminate>.
 </computeroutput></screen></para>
                    <para>The command arguments are:<variablelist>
                        <varlistentry>
                            <term><literal>dev-name</literal></term>
                            <listitem>
                                <para>A device name where the volume will be attached in the system at
                                    <filename>/dev/<replaceable>dev_name</replaceable></filename>.
                                    This value is typically <literal>vda</literal>.</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>id</literal></term>
                            <listitem>
                                <para>The ID of the volume to boot from, as shown in the output of
                                    <command>nova volume-list</command>.</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>type</literal></term>
                            <listitem>
                                <para>This is either <literal>snap</literal>, which means that the
                                    volume was created from a snapshot, or anything other than
                                    <literal>snap</literal> (a blank string is valid). In the
                                    example above, the volume was not created from a snapshot, so we
                                    will leave this field blank in our example below.</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>size (GB)</literal></term>
                            <listitem>
                                <para>The size of the volume, in GB. It is safe to leave this blank and
                                    have the Compute service infer the size.</para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>delete-on-terminate</literal></term>
                            <listitem>
                                <para>A boolean to indicate whether the volume should be deleted when
                                    the instance is terminated. True can be specified as
                                    <literal>True</literal> or <literal>1</literal>. False can be
                                    specified as <literal>False</literal> or
                                    <literal>0</literal>.</para>
                            </listitem>
                        </varlistentry>
                    </variablelist></para>
                    <para><note>
                        <para>Because of bug <link
                            xlink:href="https://bugs.launchpad.net/nova/+bug/1008622"
                            >#1008622</link>, you must specify an image when booting from a volume,
                            even though this image will not be used.</para>
                    </note>The following example will attempt boot from volume with
                        ID=<literal>13</literal>, it will not delete on terminate. Replace the
                        <literal>--image</literal> flag with a valid image on your system, and the
                        <literal>--key-name</literal> with a valid keypair
                        name:<screen><prompt>$</prompt> <userinput>nova boot --image <replaceable>f4addd24-4e8a-46bb-b15d-fae2591f1a35</replaceable> --flavor 2 --key-name <replaceable>mykey</replaceable> \
    --block-device-mapping vda=13:::0 boot-from-vol-test</userinput></screen></para>
                </simplesect>
                
            
            
            
        </section>
        <section xml:id="boot_from_iso">
            <title>Launch from ISO</title>
            <para>Text</para>
        </section>
        <section xml:id="boot_from_config_drive">
            <title>Launch from config drive</title>
            <para>Text</para>
        </section>
        <section xml:id="inserting_metadata">
            <title>Insert metadata during launch</title>
            <para>When booting a server, you can also add metadata, so
                that you can more easily identify it amongst your
                ever-growing elastic cloud. Use the
                    <literal>--meta</literal> option with a key=value
                pair, where you can make up the string for both the
                key and the value. For example, you could add a
                description and also the creator of the server.
                <screen>
<prompt>$</prompt> <userinput>nova boot --image=natty-image --flavor=2 smallimage2 --meta description='Small test image' --meta creator=joecool</userinput>
                </screen></para>
            <para>When viewing the server information, you can see the metadata included on the <literal>metadata</literal> line:
            <screen>
{'fraction_non_alphanumeric': 0.13836725072680128, 'fraction_numerical': 0.02003614363164925, 'mean_word_length': 1.4931439764936336, 'pattern_counts': {'":': 0, '<': 621, '<?xml version=': 2, '>': 635, 'https://': 6, 'lorem ipsum': 0, 'www.': 8, 'xml': 34}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '126655', 'n_tokens_mistral': 7131, 'n_tokens_neox': 6570, 'n_words': 1793}