User Guides: Fix wrong indentation
The extra spaces let to wrong output, indent content properly. Change-Id: Ib4680791940268b9377e2730374933c908454ada
This commit is contained in:
parent
7656aa9e9d
commit
7cd2b4fb35
@ -55,7 +55,7 @@ The following program lists servers by using the Compute API v2.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
from credentials import get_nova_credentials_v2
|
||||
from novaclient.client import Client
|
||||
@ -66,13 +66,13 @@ The following program lists servers by using the Compute API v2.
|
||||
#. Instantiate the ``nova_client`` client object by using the
|
||||
``credentials`` dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nova_client = Client(**credentials)
|
||||
|
||||
#. List servers by calling ``servers.list`` on ``nova_client`` object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
print(nova_client.servers.list())
|
||||
|
||||
@ -98,7 +98,7 @@ The following program creates a server (VM) by using the Compute API v2.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
from credentials import get_nova_credentials_v2
|
||||
@ -110,7 +110,7 @@ The following program creates a server (VM) by using the Compute API v2.
|
||||
#. Instantiate the ``nova_client`` client object by using the
|
||||
``credentials`` dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nova_client = Client(**credentials)
|
||||
|
||||
@ -118,7 +118,7 @@ The following program creates a server (VM) by using the Compute API v2.
|
||||
the ``cirros`` image, the ``m1.tiny`` flavor, and the ``private``
|
||||
network:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
image = nova_client.images.find(name="cirros")
|
||||
flavor = nova_client.flavors.find(name="m1.tiny")
|
||||
@ -126,7 +126,7 @@ The following program creates a server (VM) by using the Compute API v2.
|
||||
|
||||
#. To create the server, use the network, image, and flavor:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nics = [{'net-id': net.id}]
|
||||
instance = nova_client.servers.create(name="vm2", image=image,
|
||||
@ -135,7 +135,7 @@ The following program creates a server (VM) by using the Compute API v2.
|
||||
#. Run the "Sleep for five seconds" command, and determine whether
|
||||
the server/vm was created by calling ``nova_client.servers.list()``:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
print("Sleeping for 5s after create command")
|
||||
time.sleep(5)
|
||||
@ -177,7 +177,7 @@ The following program deletes a server (VM) by using the Compute API v2.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
from credentials import get_nova_credentials_v2
|
||||
@ -189,7 +189,7 @@ The following program deletes a server (VM) by using the Compute API v2.
|
||||
#. Instantiate the ``nova_client`` client object by using the
|
||||
``credentials`` dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nova_client = Client(**credentials)
|
||||
|
||||
@ -200,7 +200,7 @@ The following program deletes a server (VM) by using the Compute API v2.
|
||||
b. Iterate over ``servers_list`` and compare name with ``vm1``.
|
||||
|
||||
c. If true, set the variable name ``server_exists`` to ``True``
|
||||
and break from the for loop:
|
||||
and break from the for loop:
|
||||
|
||||
.. code-block:: python
|
||||
:linenos:
|
||||
@ -219,7 +219,7 @@ The following program deletes a server (VM) by using the Compute API v2.
|
||||
#. If the server exists, run the ``delete`` method of the
|
||||
``nova_client.servers`` object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nova_client.servers.delete(s)
|
||||
|
||||
@ -260,7 +260,7 @@ Compute API v2.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
from credentials import get_nova_credentials_v2
|
||||
from novaclient.client import Client
|
||||
@ -288,15 +288,15 @@ Compute API v2.
|
||||
#. Instantiate the ``nova_client`` client object by using the
|
||||
``credentials`` dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nova_client = Client(**credentials)
|
||||
|
||||
|
||||
#. Get the server instance using ``server_id`` and print the details by
|
||||
calling ``print_server`` method:
|
||||
calling ``print_server`` method:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
server_id = '99889c8d-113f-4a7e-970c-77f1916bfe14'
|
||||
server = nova_client.servers.get(server_id)
|
||||
@ -313,13 +313,13 @@ calling ``print_server`` method:
|
||||
|
||||
#. Get the updated instance of the server:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
server_updated = nova_client.servers.get(server_id)
|
||||
|
||||
#. Call ``print_server`` again to check the update server details:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
print_server(server_updated)
|
||||
|
||||
@ -357,7 +357,7 @@ Compute API v2.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
from credentials import get_nova_credentials_v2
|
||||
from novaclient.client import Client
|
||||
@ -382,19 +382,19 @@ Compute API v2.
|
||||
#. Instantiate the ``nova_client`` client object by using the
|
||||
``credentials`` dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nova_client = Client(**credentials)
|
||||
|
||||
#. List flavors by calling ``list()`` on ``nova_client.flavors`` object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
flavors_list = nova_client.flavors.list()
|
||||
|
||||
#. Print the flavor details, id and name by calling ``print_flavors``:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
print_flavors(flavors_list)
|
||||
|
||||
@ -424,7 +424,7 @@ the Compute API v2.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
from credentials import get_nova_credentials_v2
|
||||
from novaclient.client import Client
|
||||
@ -452,20 +452,20 @@ the Compute API v2.
|
||||
#. Instantiate the ``nova_client`` client object by using the
|
||||
``credentials`` dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nova_client = Client(**credentials)
|
||||
|
||||
#. List floating IPs by calling ``list()`` on ``nova_client.floating_ips``
|
||||
object:
|
||||
object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
ip_list = nova_client.floating_ips.list()
|
||||
|
||||
#. Print the floating IP object details by calling ``print_values_ip``:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
print_values_ip(ip_list)
|
||||
|
||||
@ -493,7 +493,7 @@ The following program lists the hosts by using the Compute API v2.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
from credentials import get_nova_credentials_v2
|
||||
from novaclient.client import Client
|
||||
@ -502,8 +502,8 @@ The following program lists the hosts by using the Compute API v2.
|
||||
The ``print_hosts`` method is defined in ``utils.py`` and prints the
|
||||
host object details:
|
||||
|
||||
.. code-block:: python
|
||||
:linenos:
|
||||
.. code-block:: python
|
||||
:linenos:
|
||||
|
||||
def print_hosts(host_list):
|
||||
for host in host_list:
|
||||
@ -519,19 +519,19 @@ The following program lists the hosts by using the Compute API v2.
|
||||
#. Instantiate the ``nova_client`` client object by using the
|
||||
``credentials`` dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
nova_client = Client(**credentials)
|
||||
|
||||
#. List hosts by calling ``list()`` on ``nova_client.hosts`` object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
host_list = nova_client.hosts.list()
|
||||
|
||||
#. Print the host object details by calling ``print_hosts(host_list)``:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
print_hosts(host_list)
|
||||
|
||||
|
@ -414,7 +414,7 @@ To delete a network:
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
from neutronclient.v2_0 import client
|
||||
from credentials import get_credentials
|
||||
@ -424,13 +424,13 @@ To delete a network:
|
||||
#. Instantiate the ``neutron`` client object by using the ``credentials``
|
||||
dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
neutron = client.Client(**credentials)
|
||||
|
||||
#. Delete the network:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
:linenos:
|
||||
|
||||
body_sample = {'network': {'name': network_name,
|
||||
@ -494,7 +494,7 @@ This example queries OpenStack Networking to list all routers.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
:linenos:
|
||||
|
||||
from neutronclient.v2_0 import client
|
||||
@ -506,13 +506,13 @@ This example queries OpenStack Networking to list all routers.
|
||||
#. Instantiate the ``neutron`` client object by using the ``credentials``
|
||||
dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
neutron = client.Client(**credentials)
|
||||
|
||||
#. List the routers:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
:linenos:
|
||||
|
||||
routers_list = neutron.list_routers(retrieve_all=True)
|
||||
@ -549,7 +549,7 @@ This example queries OpenStack Networking to list security groups.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
from neutronclient.v2_0 import client
|
||||
from credentials import get_credentials
|
||||
@ -560,13 +560,13 @@ This example queries OpenStack Networking to list security groups.
|
||||
#. Instantiate the ``neutron`` client object by using the ``credentials``
|
||||
dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
neutron = client.Client(**credentials)
|
||||
|
||||
#. List Security groups
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
sg = neutron.list_security_groups()
|
||||
print(sg)
|
||||
@ -599,7 +599,7 @@ This example queries OpenStack Networking to list subnets.
|
||||
|
||||
#. Import the following modules:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
from neutronclient.v2_0 import client
|
||||
from credentials import get_credentials
|
||||
@ -608,15 +608,15 @@ This example queries OpenStack Networking to list subnets.
|
||||
#. Get credentials. See :ref:'Get credentials <get-credentials>'.
|
||||
|
||||
#. Instantiate the ``neutron`` client object by using the ``credentials``
|
||||
dictionary object:
|
||||
dictionary object:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
neutron = client.Client(**credentials)
|
||||
|
||||
#. List subnets:
|
||||
|
||||
.. code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
subnets = neutron.list_subnets()
|
||||
print(subnets)
|
||||
|
Loading…
x
Reference in New Issue
Block a user