Files
api-site/api-quick-start/src/docbkx/cli-uses.xml
Veronica Musso d264e9daa3 API endpoint port numbers link in Quick Start
This patch includes a note with the link to the default port
numbers used by OpenStack components to the Quick Start documentation.

Change-Id: I02a7640f0571ab487fc54e2195ba331d69255886
Closes-Bug: #1309273
2014-04-23 21:17:34 +02:00

175 lines
13 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="cli-intro"
version="5.0">
<title>OpenStack command-line clients</title>
<para>For scripting work, you can use a command-line client like
the <systemitem role="client">python-novaclient</systemitem>
client. This client enables you to use the Compute API through
a command-line interface.</para>
<para>For information about the command-line clients, see <link
xlink:href="http://docs.openstack.org/cli-reference/content/"
><citetitle>OpenStack Command-Line Interface
Reference</citetitle></link>.</para>
<section xml:id="cli_clients_install">
<title>Install the clients</title>
<para>Use <command>pip</command> to install the OpenStack
clients on a Mac OS X or Linux system. It is easy and
ensures that you get the latest version of the client from
the <link xlink:href="http://pypi.python.org/pypi">Python
Package Index</link>. Also, <command>pip</command>
lets you update or remove a package.</para>
<para>You must install each client separately.</para>
<para>Run this command to install or update a client
package:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>sudo pip install [--upgrade] python-<replaceable>PROJECT</replaceable>client</userinput></screen>
<para>Where <replaceable>PROJECT</replaceable> is the project
name.</para>
<para>For example, to install the <command>nova</command>
client, run this command:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>sudo pip install python-novaclient</userinput></screen>
<para>To update the <command>nova</command> client, run this
command:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>sudo pip install --upgrade python-novaclient</userinput></screen>
<para>To remove the <command>nova</command> client, run this
command:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>sudo pip uninstall python-novaclient</userinput></screen>
<para>Before you can issue client commands, you must download
and source the <filename>openrc</filename> file to set
environment variables.</para>
<para>For complete information about the OpenStack clients,
including how to source the <filename>openrc</filename>
file, see <link
xlink:href="http://docs.openstack.org/user-guide/content/"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:html="http://www.w3.org/1999/xhtml"
><citetitle>OpenStack End User
Guide</citetitle></link>, <link
xlink:href="http://docs.openstack.org/user-guide-admin/content/"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:html="http://www.w3.org/1999/xhtml"
><citetitle>OpenStack Admin User
Guide</citetitle></link>, and <link
xlink:href="http://docs.openstack.org/cli-reference/content/"
><citetitle>OpenStack Command-Line Interface
Reference</citetitle></link>.</para>
</section>
<section xml:id="list-images">
<title>Launch an instance</title>
<para>To launch instances, you must choose a name, an image,
and a flavor for your instance.</para>
<para>To list available images, call the Compute API through
the <command>nova</command> client, as follows:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>nova image-list</userinput></screen>
<screen><?db-font-size 60%?><computeroutput>+--------------------------------------+---------------------------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+---------------------------------+--------+--------+
| 949c80c8-b4ac-4315-844e-69f9bef39ed1 | cirros-0.3.1-x86_64-uec | ACTIVE | |
| 2d96f33d-ff66-4cac-b377-820cdf51204a | cirros-0.3.1-x86_64-uec-kernel | ACTIVE | |
| eda9e5cb-4c8c-4e88-b580-7fac80ad8e78 | cirros-0.3.1-x86_64-uec-ramdisk | ACTIVE | |
+--------------------------------------+---------------------------------+--------+--------+</computeroutput></screen>
<para>To list flavors, run this command:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>nova flavor-list</userinput></screen>
<screen><?db-font-size 60%?><computeroutput>+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 0 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
| 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+</computeroutput> </screen>
<para>To launch an instance, note the IDs of your desired
image and flavor.</para>
<para>To launch an instance named
<literal>my_instance</literal>, run the <command>nova
boot</command> command with the image and flavor IDs
and the server name, as follows:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>nova boot --image 949c80c8-b4ac-4315-844e-69f9bef39ed1 --flavor 2 my_instance</userinput></screen>
<screen><?db-font-size 60%?><computeroutput>+-------------------------------------+--------------------------------------+
| Property | Value |
+-------------------------------------+--------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | instance-00000001 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| accessIPv4 | |
| accessIPv6 | |
| adminPass | XysUgJRnkB2y |
| config_drive | |
| created | 2013-11-07T17:34:16Z |
| flavor | m1.small |
| hostId | |
| id | 66129319-1f1d-420d-a226-bf9fc5ea0138 |
| image | cirros-0.3.1-x86_64-uec |
| key_name | None |
| metadata | {} |
| name | my_instance |
| progress | 0 |
| security_groups | [{u'name': u'default'}] |
| status | BUILD |
| tenant_id | 604bbe45ac7143a79e14f3158df67091 |
| updated | 2013-11-07T17:34:16Z |
| user_id | 3273a50d6cfb4a2ebc75e83cb86e1554 |
+-------------------------------------+--------------------------------------+</computeroutput></screen>
<para>Use the <command>nova list</command> command to view
your server:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>nova list</userinput></screen>
<screen><?db-font-size 60%?><computeroutput>+--------------------------------------+-------------+--------+------------+-------------+------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+--------+------------+-------------+------------------+
| 66129319-1f1d-420d-a226-bf9fc5ea0138 | my_instance | ACTIVE | None | Running | private=10.0.0.2 |
+--------------------------------------+-------------+--------+------------+-------------+------------------+</computeroutput></screen>
<para>To view details for a specified server, use the
<command>nova show</command> command. Include the ID
of the server:</para>
<screen><?db-font-size 70%?><prompt>$</prompt> <userinput>nova show 66129319-1f1d-420d-a226-bf9fc5ea0138</userinput></screen>
<screen><?db-font-size 60%?><computeroutput>+-------------------------------------+----------------------------------------------------------------+
| Property | Value |
+-------------------------------------+----------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | devstack-grizzly |
| OS-EXT-SRV-ATTR:hypervisor_hostname | devstack-grizzly |
| OS-EXT-SRV-ATTR:instance_name | instance-00000001 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2013-11-07T17:34:16Z |
| flavor | m1.small (2) |
| hostId | d57e6f9f7885c615794b4d5a87103509620b6a7f567f7e7bd57e97a2 |
| id | 66129319-1f1d-420d-a226-bf9fc5ea0138 |
| image | cirros-0.3.1-x86_64-uec (949c80c8-b4ac-4315-844e-69f9bef39ed1) |
| key_name | None |
| metadata | {} |
| name | my_instance |
| private network | 10.0.0.2 |
| progress | 0 |
| security_groups | [{u'name': u'default'}] |
| status | ACTIVE |
| tenant_id | 604bbe45ac7143a79e14f3158df67091 |
| updated | 2013-11-07T17:34:32Z |
| user_id | 3273a50d6cfb4a2ebc75e83cb86e1554 |
+-------------------------------------+----------------------------------------------------------------+</computeroutput></screen>
<note>
<para>For information about the default ports that the
OpenStack components use, see <link
xlink:href="http://docs.openstack.org/trunk/config-reference/content/firewalls-default-ports.html">
<citetitle>Appendix A. Firewalls and default
ports</citetitle>
</link> in the <citetitle>OpenStack Configuration
Reference</citetitle>.</para>
</note>
</section>
</section>