Jump to: navigation, search

RunningQuantumV2Api

Revision as of 08:36, 6 July 2012 by AkihiroMotoki (talk)

Quantum v2 API

Current Limitations

  • Quantum DHCP code is still in review. With the current master branch, VMs need to have a their IPs configured manually using VNC access to the VM.
   To use DHCP, please see the section Quantum DHCP in this document.

In order to run Quantum using the v2 api the following steps are need:

  • First download a copy of devstack.
git clone git://github.com/openstack-dev/devstack.git


(L.2054)
NET_ID=$(python $QUANTUM_CLIENT_DIR/quantumclient/shell.py net-create --os_token $Q_ADMIN_USERNAME --os_url http://$Q_HOST:$Q_PORT --tenant_id $TENANT_ID net1 | grep ' id ' | get_field 2)

(L.2057)
python $QUANTUM_CLIENT_DIR/quantumclient/shell.py subnet-create --os_token $Q_ADMIN_USERNAME --os_url http://$Q_HOST:$Q_PORT --tenant_id $TENANT_ID --ip_version 4 --gateway  $NETWORK_GATEWAY $NET_ID $FIXED_RANGE
  • Create a localrc file in your devstack repo that contains the following:
ENABLED_SERVICES="g-api,g-reg,key,n-api,n-cpu,n-sch,n-vnc,horizon,mysql,rabbit,openstackx,q-svc,q-agt"
Q_PLUGIN=openvswitch
ADMIN_PASSWORD=password
MYSQL_PASSWORD=password
RABBIT_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=tokentoken
SCHEDULER=nova.scheduler.simple.SimpleScheduler
LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
NOVA_USE_QUANTUM_API=v2
  • run stack.sh as normal to download code and get things running.

Create a network using Quantumv2

  • Determine the tenant-id:
$ SERVICE_ENDPOINT=http://localhost:35357/v2.0
$ SERVICE_TOKEN=tokentoken
$ keystone --token $SERVICE_TOKEN --endpoint $SERVICE_ENDPOINT tenant-list
+----------------------------------+--------------------+---------+
|                id                |        name        | enabled |
+----------------------------------+--------------------+---------+
| 0331b94a864a46f9b5ce7e188c115c29 | invisible_to_admin |   True  |
| 118c80482f8e4bbc83661399e93ab020 |      service       |   True  |
| 7c46d68545ca49e4b52e5bc0be9e2a2a |       admin        |   True  |
| 9b234056142543949c95601d7bb77b9b |        demo        |   True  |
+----------------------------------+--------------------+---------+
  • Using the id for the demo user create a network:
$quantumv2 --os_token ADMIN --os_url http://localhost:9696/ net-create --tenant_id 9b234056142543949c95601d7bb77b9b mynet
Created a new network:
+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| admin_state_up | True                                 |
| id             | 335b9d39-f803-4e38-9236-cc7fd047baab |
| name           | mynet                                |
| status         | ACTIVE                               |
| subnets        |                                      |
| tenant_id      | 9b234056142543949c95601d7bb77b9b     |
+----------------+--------------------------------------+
  • Associate a subnet with this network:
$quantumv2 --os_token ADMIN --os_url http://localhost:9696/ subnet-create --tenant_id 9b234056142543949c95601d7bb77b9b --ip_version 4 --gateway 10.2.2.1  335b9d39-f803-4e38-9236-cc7fd047baab 10.2.2.0/24
Created a new subnet:
+------------+--------------------------------------+
| Field      | Value                                |
+------------+--------------------------------------+
| cidr       | 10.2.2.0/24                          |
| gateway_ip | 10.2.2.1                             |
| id         | badb639d-8191-47d2-a6fa-6bc81beae97f |
| ip_version | 4                                    |
| network_id | 335b9d39-f803-4e38-9236-cc7fd047baab |
+------------+--------------------------------------+
  • Boot a VM using this network (the VM will get a NIC for each network owned by that tenant. The --nic option is not yet support):
$IMG_ID=`nova image-list | grep cirros | grep -v kernel | grep -v ram | awk -F "|" '{print $2}'`
$ nova boot --image $IMG_ID --flavor 1 test1
+------------------------+--------------------------------------+
| Property               | Value                                |
+------------------------+--------------------------------------+
| OS-DCF:diskConfig      | MANUAL                               |
| OS-EXT-STS:power_state | 0                                    |
| OS-EXT-STS:task_state  | scheduling                           |
| OS-EXT-STS:vm_state    | building                             |
| accessIPv4             |                                      |
| accessIPv6             |                                      |
| adminPass              | 4X6a5z55WFxT                         |
| config_drive           |                                      |
| created                | 2012-06-30T02:25:12Z                 |
| flavor                 | m1.tiny                              |
| hostId                 |                                      |
| id                     | 7ee202a1-f6e6-4e68-b6c3-dc7489ddb433 |
| image                  | cirros-0.3.0-x86_64-uec              |
| key_name               |                                      |
| metadata               | {}                                   |
| name                   | test1                                |
| progress               | 0                                    |
| status                 | BUILD                                |
| tenant_id              | 9b234056142543949c95601d7bb77b9b     |
| updated                | 2012-06-30T02:25:12Z                 |
| user_id                | 0c23bf7f644a404896d1387e2bb97540     |
+------------------------+--------------------------------------+


$ nova list
+--------------------------------------+-------+--------+----------------+
| ID                                   | Name  | Status | Networks       |
+--------------------------------------+-------+--------+----------------+
| 7ee202a1-f6e6-4e68-b6c3-dc7489ddb433 | test1 | ACTIVE | mynet=10.2.2.2 |
+--------------------------------------+-------+--------+----------------+


Quantum DHCP

Quantum DHCP code is still in review. By default, VMs need to have a their IPs configured manually using VNC access to the VM.

To use DHCP, checkout the code for this review: https://review.openstack.org/#/c/9064/

Devstack is supported by adding the patch https://review.openstack.org/#/c/9362/ to you devstack repo. This requires adding "q-dhcp" to the "ENABLED_SERVICES". This will run the Quantum DHCP agent in a separate screen.

Limitations

  • Note: with v2, Quantum no longer uses the L3 + NAT logic from nova-network. Quantum will not have the equivalent functionality until F-3, so you won't be able to ping the VMs from the nova controller host.

Advanced Setups