Jump to: navigation, search

Difference between revisions of "RunningQuantumV2Api"

m (Text replace - "__NOTOC__" to "")
 
(19 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
+
 
 
== Quantum v2 API ==
 
== 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 ''[[#qdhcp|Quantum DHCP]]'' in this document.
 
  
 
=== In order to run Quantum using the v2 api the following steps are need: ===
 
=== In order to run Quantum using the v2 api the following steps are need: ===
Line 15: Line 10:
 
</nowiki></pre>
 
</nowiki></pre>
  
 
+
* Add the following line to devstack/files/apt/general. It is a dependency bug in Ubuntu 12.04.
* Apply the following patch to your devstack repo: https://review.openstack.org/#/c/9161 .  
 
* Then modify the following lines in stack.sh. When fixing https://bugs.launchpad.net/quantum/+bug/1011759, subcommand and option names were changed, but devstack with Quantum v2 has not supported yet. (Note that it is temporary workaround.)
 
 
   
 
   
 
<pre><nowiki>
 
<pre><nowiki>
(L.2054)
+
python-pyparsing
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
 
</nowiki></pre>
 
 
 
* Create a localrc file in your devstack repo that contains the following:
 
 
<pre><nowiki>
 
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
 
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
* See [[QuantumDevstack]] for information about configuring devstack to use Quantum
 
* run stack.sh as normal to download code and get things running.
 
* run stack.sh as normal to download code and get things running.
  
 
== Create a network using Quantumv2 ==
 
== Create a network using Quantumv2 ==
* Determine the tenant-id:
+
 
 +
* Set envvars for quantum client.
 
   
 
   
 
<pre><nowiki>
 
<pre><nowiki>
$ SERVICE_ENDPOINT=http://localhost:35357/v2.0
+
$ . openrc
$ SERVICE_TOKEN=tokentoken
+
$ env | grep OS_
$ keystone --token $SERVICE_TOKEN --endpoint $SERVICE_ENDPOINT tenant-list
+
OS_PASSWORD=password
+----------------------------------+--------------------+---------+
+
OS_AUTH_URL=http://192.168.122.248:5000/v2.0
|                id                |        name        | enabled |
+
OS_USERNAME=demo
+----------------------------------+--------------------+---------+
+
OS_TENANT_NAME=demo
| 0331b94a864a46f9b5ce7e188c115c29 | invisible_to_admin |  True  |
 
| 118c80482f8e4bbc83661399e93ab020 |      service      |  True  |
 
| 7c46d68545ca49e4b52e5bc0be9e2a2a |      admin        |  True  |
 
| 9b234056142543949c95601d7bb77b9b |        demo       |  True  |
 
+----------------------------------+--------------------+---------+
 
 
</nowiki></pre>
 
</nowiki></pre>
  
* Using the id for the demo user create a network:
+
* Creating a network named mynet.
 
   
 
   
 
<pre><nowiki>
 
<pre><nowiki>
$quantumv2 --os_token ADMIN --os_url http://localhost:9696/ net-create --tenant_id 9b234056142543949c95601d7bb77b9b mynet
+
$ quantum net-create mynet # Creates a new network
Created a new network:
 
 
+----------------+--------------------------------------+
 
+----------------+--------------------------------------+
 
| Field          | Value                                |
 
| Field          | Value                                |
 
+----------------+--------------------------------------+
 
+----------------+--------------------------------------+
 
| admin_state_up | True                                |
 
| admin_state_up | True                                |
| id            | 335b9d39-f803-4e38-9236-cc7fd047baab |
+
| id            | c329c96f-a9e2-4035-9947-c2fd51b3224c |
 
| name          | mynet                                |
 
| name          | mynet                                |
 
| status        | ACTIVE                              |
 
| status        | ACTIVE                              |
 
| subnets        |                                      |
 
| subnets        |                                      |
| tenant_id      | 9b234056142543949c95601d7bb77b9b     |
+
| tenant_id      | ce829a76691c445db483b56a18e38ca0     |
 
+----------------+--------------------------------------+
 
+----------------+--------------------------------------+
 +
$ quantum net-list # Network shows up in list
 +
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
 +
| admin_state_up | id                                  | name  | status | subnets                              | tenant_id                        |
 +
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
 +
| True          | 17af5b57-bebc-4556-8c83-ea40f842488f | net1  | ACTIVE | 0f6c205c-1420-4724-a133-b0ca8b2117ff | ce829a76691c445db483b56a18e38ca0 |
 +
| True          | c329c96f-a9e2-4035-9947-c2fd51b3224c | mynet | ACTIVE |                                      | ce829a76691c445db483b56a18e38ca0 |
 +
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
 
</nowiki></pre>
 
</nowiki></pre>
  
* Associate a subnet with this network:
+
* Associate a subnet with this network (you can do this 0 or more times, but *beware* that some hypervisor drivers do not yet support networks with 0 IPv4 subnets - https://bugs.launchpad.net/nova/+bug/1039665):
 
   
 
   
 
<pre><nowiki>
 
<pre><nowiki>
$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
+
$ quantum subnet-create c329c96f-a9e2-4035-9947-c2fd51b3224c 10.2.2.0/24 # Creates a subnet
Created a new subnet:
+
+------------------+--------------------------------------------+
+------------+--------------------------------------+
+
| Field           | Value                                     |
| Field     | Value                               |
+
+------------------+--------------------------------------------+
+------------+--------------------------------------+
+
| allocation_pools | {"start": "10.2.2.2", "end": "10.2.2.254"} |
| cidr       | 10.2.2.0/24                         |
+
| cidr             | 10.2.2.0/24                               |
| gateway_ip | 10.2.2.1                             |
+
| gateway_ip       | 10.2.2.1                                   |
| id         | badb639d-8191-47d2-a6fa-6bc81beae97f |
+
| id               | 032b9a1a-6a01-4ff1-88f1-3ec61b460ddd      |
| ip_version | 4                                   |
+
| ip_version       | 4                                         |
| network_id | 335b9d39-f803-4e38-9236-cc7fd047baab |
+
| name            |                                            |
+------------+--------------------------------------+
+
| network_id       | c329c96f-a9e2-4035-9947-c2fd51b3224c      |
 +
| tenant_id        | ce829a76691c445db483b56a18e38ca0          |
 +
+------------------+--------------------------------------------+
 +
$ quantum net-list
 +
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
 +
| admin_state_up | id                                  | name  | status | subnets                              | tenant_id                        |
 +
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
 +
| True          | 17af5b57-bebc-4556-8c83-ea40f842488f | net1  | ACTIVE | 0f6c205c-1420-4724-a133-b0ca8b2117ff | ce829a76691c445db483b56a18e38ca0 |
 +
| True          | c329c96f-a9e2-4035-9947-c2fd51b3224c | mynet | ACTIVE | 032b9a1a-6a01-4ff1-88f1-3ec61b460ddd | ce829a76691c445db483b56a18e38ca0 |
 +
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
 
</nowiki></pre>
 
</nowiki></pre>
  
* 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):  
+
* Boot a VM using this network (the VM will get a NIC for each network owned by that tenant.  The --nic option is already supported):
 
   
 
   
 
<pre><nowiki>
 
<pre><nowiki>
$IMG_ID=`nova image-list | grep cirros | grep -v kernel | grep -v ram | awk -F "|" '{print $2}'`
+
$ 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
+
$ nova boot --image $IMG_ID --flavor 1 --nic net-id=c329c96f-a9e2-4035-9947-c2fd51b3224c test1
 
+------------------------+--------------------------------------+
 
+------------------------+--------------------------------------+
 
| Property              | Value                                |
 
| Property              | Value                                |
Line 108: Line 94:
 
| accessIPv4            |                                      |
 
| accessIPv4            |                                      |
 
| accessIPv6            |                                      |
 
| accessIPv6            |                                      |
| adminPass              | 4X6a5z55WFxT                         |
+
| adminPass              | KHZ9r9CHTQMw                         |
 
| config_drive          |                                      |
 
| config_drive          |                                      |
| created                | 2012-06-30T02:25:12Z                 |
+
| created                | 2012-08-01T13:49:09Z                 |
 
| flavor                | m1.tiny                              |
 
| flavor                | m1.tiny                              |
 
| hostId                |                                      |
 
| hostId                |                                      |
| id                    | 7ee202a1-f6e6-4e68-b6c3-dc7489ddb433 |
+
| id                    | 21a7f742-288f-4796-8e5f-d9c8741d4b75 |
 
| image                  | cirros-0.3.0-x86_64-uec              |
 
| image                  | cirros-0.3.0-x86_64-uec              |
| key_name              |                                     |
+
| key_name              | None                                |
 
| metadata              | {}                                  |
 
| metadata              | {}                                  |
 
| name                  | test1                                |
 
| name                  | test1                                |
 
| progress              | 0                                    |
 
| progress              | 0                                    |
 
| status                | BUILD                                |
 
| status                | BUILD                                |
| tenant_id              | 9b234056142543949c95601d7bb77b9b     |
+
| tenant_id              | ce829a76691c445db483b56a18e38ca0     |
| updated                | 2012-06-30T02:25:12Z                 |
+
| updated                | 2012-08-01T13:49:10Z                 |
| user_id                | 0c23bf7f644a404896d1387e2bb97540     |
+
| user_id                | 037c166e4363491fb25e4f669fa18e45     |
 
+------------------------+--------------------------------------+
 
+------------------------+--------------------------------------+
 
 
 
$ nova list
 
$ nova list
 
+--------------------------------------+-------+--------+----------------+
 
+--------------------------------------+-------+--------+----------------+
 
| ID                                  | Name  | Status | Networks      |
 
| ID                                  | Name  | Status | Networks      |
 
+--------------------------------------+-------+--------+----------------+
 
+--------------------------------------+-------+--------+----------------+
| 7ee202a1-f6e6-4e68-b6c3-dc7489ddb433 | test1 | ACTIVE | mynet=10.2.2.2 |
+
| 21a7f742-288f-4796-8e5f-d9c8741d4b75 | test1 | ACTIVE | mynet=10.2.2.2 |
 
+--------------------------------------+-------+--------+----------------+
 
+--------------------------------------+-------+--------+----------------+
 
</nowiki></pre>
 
</nowiki></pre>
  
 
== Quantum DHCP ==
 
<span id="qdhcp"></span>
 
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 ==
 
== Limitations ==

Latest revision as of 23:30, 17 February 2013

Quantum v2 API

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
  • Add the following line to devstack/files/apt/general. It is a dependency bug in Ubuntu 12.04.
python-pyparsing
  • See QuantumDevstack for information about configuring devstack to use Quantum
  • run stack.sh as normal to download code and get things running.

Create a network using Quantumv2

  • Set envvars for quantum client.
$ . openrc
$ env | grep OS_
OS_PASSWORD=password
OS_AUTH_URL=http://192.168.122.248:5000/v2.0
OS_USERNAME=demo
OS_TENANT_NAME=demo
  • Creating a network named mynet.
$ quantum net-create mynet # Creates a new network
+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| admin_state_up | True                                 |
| id             | c329c96f-a9e2-4035-9947-c2fd51b3224c |
| name           | mynet                                |
| status         | ACTIVE                               |
| subnets        |                                      |
| tenant_id      | ce829a76691c445db483b56a18e38ca0     |
+----------------+--------------------------------------+
$ quantum net-list # Network shows up in list
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
| admin_state_up | id                                   | name  | status | subnets                              | tenant_id                        |
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
| True           | 17af5b57-bebc-4556-8c83-ea40f842488f | net1  | ACTIVE | 0f6c205c-1420-4724-a133-b0ca8b2117ff | ce829a76691c445db483b56a18e38ca0 |
| True           | c329c96f-a9e2-4035-9947-c2fd51b3224c | mynet | ACTIVE |                                      | ce829a76691c445db483b56a18e38ca0 |
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
$ quantum subnet-create c329c96f-a9e2-4035-9947-c2fd51b3224c 10.2.2.0/24 # Creates a subnet
+------------------+--------------------------------------------+
| Field            | Value                                      |
+------------------+--------------------------------------------+
| allocation_pools | {"start": "10.2.2.2", "end": "10.2.2.254"} |
| cidr             | 10.2.2.0/24                                |
| gateway_ip       | 10.2.2.1                                   |
| id               | 032b9a1a-6a01-4ff1-88f1-3ec61b460ddd       |
| ip_version       | 4                                          |
| name             |                                            |
| network_id       | c329c96f-a9e2-4035-9947-c2fd51b3224c       |
| tenant_id        | ce829a76691c445db483b56a18e38ca0           |
+------------------+--------------------------------------------+
$ quantum net-list
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
| admin_state_up | id                                   | name  | status | subnets                              | tenant_id                        |
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
| True           | 17af5b57-bebc-4556-8c83-ea40f842488f | net1  | ACTIVE | 0f6c205c-1420-4724-a133-b0ca8b2117ff | ce829a76691c445db483b56a18e38ca0 |
| True           | c329c96f-a9e2-4035-9947-c2fd51b3224c | mynet | ACTIVE | 032b9a1a-6a01-4ff1-88f1-3ec61b460ddd | ce829a76691c445db483b56a18e38ca0 |
+----------------+--------------------------------------+-------+--------+--------------------------------------+----------------------------------+
  • Boot a VM using this network (the VM will get a NIC for each network owned by that tenant. The --nic option is already supported):
$ IMG_ID=`nova image-list | grep cirros | grep -v kernel | grep -v ram | awk -F "|" '{print $2}'`
$ nova boot --image $IMG_ID --flavor 1 --nic net-id=c329c96f-a9e2-4035-9947-c2fd51b3224c 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              | KHZ9r9CHTQMw                         |
| config_drive           |                                      |
| created                | 2012-08-01T13:49:09Z                 |
| flavor                 | m1.tiny                              |
| hostId                 |                                      |
| id                     | 21a7f742-288f-4796-8e5f-d9c8741d4b75 |
| image                  | cirros-0.3.0-x86_64-uec              |
| key_name               | None                                 |
| metadata               | {}                                   |
| name                   | test1                                |
| progress               | 0                                    |
| status                 | BUILD                                |
| tenant_id              | ce829a76691c445db483b56a18e38ca0     |
| updated                | 2012-08-01T13:49:10Z                 |
| user_id                | 037c166e4363491fb25e4f669fa18e45     |
+------------------------+--------------------------------------+
$ nova list
+--------------------------------------+-------+--------+----------------+
| ID                                   | Name  | Status | Networks       |
+--------------------------------------+-------+--------+----------------+
| 21a7f742-288f-4796-8e5f-d9c8741d4b75 | test1 | ACTIVE | mynet=10.2.2.2 |
+--------------------------------------+-------+--------+----------------+


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