Files
openstacksdk/doc/source/users/guides/compute.rst
liuxiaoyang f18dc29eb0 Add doc8 rule and check doc/source files
doc8 is a linter for documents and used in openstack-manuals.
It is better to enforce document linters for simple checking.
This change is to add doc8 in tox file and fix line too long
in some files.

The current rules are as bellow:
- invalid rst format - D000
- lines should not be longer than 79 characters - D001
  - RST exception: line with no whitespace except in the beginning
  - RST exception: lines with http or https urls
  - RST exception: literal blocks
  - RST exception: rst target directives
- no trailing whitespace - D002
- no tabulation for indentation - D003
- no carriage returns (use unix newlines) - D004
- no newline at end of file - D005

Change-Id: I5b409fbfd95e05921310c6ecf4afea0220fb0bf0
2017-08-23 08:27:31 -04:00

90 lines
2.6 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Using OpenStack Compute
=======================
Before working with the Compute service, you'll need to create a connection
to your OpenStack cloud by following the :doc:`connect` user guide. This will
provide you with the ``conn`` variable used in the examples below.
.. contents:: Table of Contents
:local:
The primary resource of the Compute service is the server.
List Servers
------------
A **server** is a virtual machine that provides access to a compute instance
being run by your cloud provider.
.. literalinclude:: ../examples/compute/list.py
:pyobject: list_servers
Full example: `compute resource list`_
List Images
-----------
An **image** is the operating system you want to use for your server.
.. literalinclude:: ../examples/compute/list.py
:pyobject: list_images
Full example: `compute resource list`_
List Flavors
------------
A **flavor** is the resource configuration for a server. Each flavor is a
unique combination of disk, memory, vCPUs, and network bandwidth.
.. literalinclude:: ../examples/compute/list.py
:pyobject: list_flavors
Full example: `compute resource list`_
List Networks
-------------
A **network** provides connectivity to servers.
.. literalinclude:: ../examples/network/list.py
:pyobject: list_networks
Full example: `network resource list`_
Create Key Pair
---------------
A **key pair** is the public key and private key of
`publickey cryptography`_. They are used to encrypt and decrypt login
information when connecting to your server.
.. literalinclude:: ../examples/compute/create.py
:pyobject: create_keypair
Full example: `compute resource create`_
Create Server
-------------
At minimum, a server requires a name, an image, a flavor, and a network on
creation. You can discover the names and IDs of these attributes by listing
them as above and then using the find methods to get the appropriate
resources.
Ideally you'll also create a server using a keypair so you can login to that
server with the private key.
Servers take time to boot so we call ``wait_for_server`` to wait
for it to become active.
.. literalinclude:: ../examples/compute/create.py
:pyobject: create_server
Full example: `compute resource create`_
.. _compute resource list: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/compute/list.py
.. _network resource list: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/network/list.py
.. _compute resource create: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/compute/create.py
.. _publickey cryptography: https://en.wikipedia.org/wiki/Public-key_cryptography