OpenStack: Booting A Tenant Instance

From DocWiki

Jump to: navigation, search

This section describes how to boot a tenant instance on an OpenStack compute node. Note: You can accomplish the same task using the OpenStack dashboard. Only the CLI procedure is described here.

Prerequisites

To boot a tenant instance on a compute node, you must first have:

  • A running control node.
  • A running compute node. The control and compute nodes can be on the same server, as on an AIO installation.
  • A tenant network as described in Creating a tenant network.
  • At least one image stored in Glance on the compute node as described in OpenStack:_Storing_Images_In_Glance.
  • An SSH key on a node for remote access to the OpenStack nodes as described in Creating SSH keys.

Procedure

  1. Boot an Instance (Cirros image example shown below):
    1. Run the neutron net-list command to get a list of networks:
      root@all-in-one:~# neutron net-list
    2. Boot the instance, using the ID for the private network (Private_Net10 in this example) from the net-list output in the --nic net-id= field:
      nova boot --image cirros-x86_64 --flavor m1.tiny --key_name aio-key --nic net-id=42823c88-bb86-4e9a-9f7b-ef1c0631ee5e test-vm1
  2. Verify that your instance has spawned successfully. Note: The first time an instance is launched on the system it can take a bit longer to boot than subsequent launches of instances:
    nova show test-vm1
  3. Verify connectivity to the instance from the AIO node. Since namespaces are being used in this model, you will need to run the commands from the context of the qrouter using the ip netns exec qrouter syntax.
    1. List the qrouter to get its router-id:
      root@all-in-one:~# neutron router-list
    2. Alternatively, you can get the qrouter ID using the ip command:
      root@all-in-one:~# ip netns
    3. Connect to the qrouter and get a list of its addresses.
      ip netns exec qrouter-<neutron-router-id> ip addr list
    4. Ping the instance from the qrouter.
      ip netns exec qrouter-<neutron-router-id> ping <fixed-ip-of-instance>
    5. SSH into the instance from the qrouter:
      ip netns exec qrouter-<neutron-router-id> ssh cirros@<fixed-ip-of-instance>
  4. Get the internal fixed IP of your instance with the following command:
    nova show <your_instance_name>
  5. Create and associate a Floating IP:
    1. Get a list of the networks:
      neutron net-list
    2. Get a list of the ports:
      neutron port-list
    3. Copy the correct IDs:
      neutron floatingip-create --port_id <internal VM port-id> <public net-id>
  6. From an external host, ping and SSH to your instance using the "floating_ip_address":
    ping <floating_ip>

Complete Example:

root@all-in-one:~# neutron net-list
+--------------------------------------+----------------+------------------------------------------------------+
| id                                   | name           | subnets                                              |
+--------------------------------------+----------------+------------------------------------------------------+
| 42823c88-bb86-4e9a-9f7b-ef1c0631ee5e | Private_Net10  | f48bca75-7fe4-4510-b9fd-c0323e416376 10.10.10.0/24   |
| 85650115-093b-49be-9fe1-ba2d34b4d3e2 | Public_Network | 2d89ac21-3611-44ef-b5d7-924fd7854e0d 192.168.81.0/24 |
+--------------------------------------+----------------+------------------------------------------------------+

root@all-in-one:~# nova boot --image cirros-x86_64 --flavor m1.tiny --key_name aio-key --nic net-id=42823c88-bb86-4e9a-9f7b-ef1c0631ee5e test-vm1

root@all-in-one:~# nova show test-vm1
??

root@all-in-one:~# neutron router-list
+--------------------------------------+-------------+-----------------------------------------------------------------------------+
| id                                   | name        | external_gateway_info                                                       |
+--------------------------------------+-------------+-----------------------------------------------------------------------------+
| 58d8840a-74ca-48a2-a6f2-7853eef9a36e | os-router-1 | {"network_id": "85650115-093b-49be-9fe1-ba2d34b4d3e2", "enable_snat": true} |
+--------------------------------------+-------------+-----------------------------------------------------------------------------+

root@all-in-one:~# ip netns
qdhcp-d7c039ae-6f11-429b-aaf9-10a2d659608a
qrouter-58d8840a-74ca-48a2-a6f2-7853eef9a36e

root@all-in-one:~# ip netns exec qrouter-58d8840a-74ca-48a2-a6f2-7853eef9a36e ip addr list

root@all-in-one:~# ip netns exec qrouter-58d8840a-74ca-48a2-a6f2-7853eef9a36e ping 10.10.10.2

root@all-in-one:~# nova show test-vm1
??

root@all-in-one:~# neutron net-list
??

root@all-in-one:~# neutron port-list
??

root@all-in-one:~# neutron floatingip-create --port_id 5510471e-2b48-4736-9112-aee22f3c6ecb e1a31822-26f1-461a-85b9-7d1e084e619c
Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    | 10.10.10.2                           |
| floating_ip_address | 192.168.81.12                        |
| floating_network_id | e1a31822-26f1-461a-85b9-7d1e084e619c |
| id                  | 48ffe524-43bc-44fc-85b5-9c568ed64af1 |
| port_id             | 5510471e-2b48-4736-9112-aee22f3c6ecb |
| router_id           | 526f262b-225e-4e1d-9a5b-1619f806960a |
| tenant_id           | 5ed6e50345bb49cfa0090746fdb68533     |
+---------------------+--------------------------------------+

root@all-in-one:~# ping 192.168.81.12

Rating: 0.0/5 (0 votes cast)

Personal tools