Atom feed of this document
 

 Commands in component extension

All component extension commands below can be done on any hosts under only admin role.

[Note]Note

please ensure that the following environment variables are set. These are used by the various clients to access Keystone.

export OS_USERNAME=admin
export OS_PASSWORD=adminpassword
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controlnode:5000/v2.0/

  • Settings

    We need some VMs and a quantum network to experiment. Here they are:

    gongysh@gongysh-laptop:~$ nova list
    +--------------------------------------+-----------+--------+---------------+
    | ID                                   | Name      | Status | Networks      |
    +--------------------------------------+-----------+--------+---------------+
    | c394fcd0-0baa-43ae-a793-201815c3e8ce | myserver1 | ACTIVE | net1=10.0.1.3 |
    | 2d604e05-9a6c-4ddb-9082-8a1fbdcc797d | myserver2 | ACTIVE | net1=10.0.1.4 |
    | c7c0481c-3db8-4d7a-a948-60ce8211d585 | myserver3 | ACTIVE | net1=10.0.1.5 |
    +--------------------------------------+-----------+--------+---------------+
    gongysh@gongysh-laptop:~$ quantum net-list 
    +--------------------------------------+------+--------------------------------------+
    | id                                   | name | subnets                              |
    +--------------------------------------+------+--------------------------------------+
    | 89dca1c6-c7d4-4f7a-b730-549af0fb6e34 | net1 | f6c832e3-9968-46fd-8e45-d5cf646db9d1 |
    +--------------------------------------+------+--------------------------------------+
  • Manage components in quantum deployment

    Component is a name for logic parts running in a quantum deployment. They are divided into groups, such as agent, plugin and service. Each group will have types. For example, there are 'Linux bridge agent, DHCP agent, Open vSwitch agent' in agent group. There are many kinds of plugins in plugin group too, such as coreplugin, lbaas plugin.

    1. List all components

      quantum component-list
      +--------------------------------------+--------------------+-------+----------+-------+
      | id                                   | type               | host  | disabled | state |
      +--------------------------------------+--------------------+-------+----------+-------+
      | 1b69828d-6a9b-4826-87cd-1757f0e27f31 | Linux bridge agent | HostA | False    | XXX   |
      | a0c1c21c-d4f4-4577-9ec7-908f2d48622d | DHCP agent         | HostA | False    | :-)   |
      | ed96b856-ae0f-4d75-bb28-40a47ffd7695 | Linux bridge agent | HostB | False    | :-)   |
      | f28aa126-6edb-4ea5-a81e-8850876bc0a8 | DHCP agent         | HostB | False    | :-)   |
      +--------------------------------------+--------------------+-------+----------+-------+
      
      [Note]Note

      'host' is just a logic name for each component.

      Just as shown, we have four agents now, and they have reported their state. This command has a 'service_down_time' optional argument with default value 60 seconds. The state will be ':-)' if the component reported the state within this time. Otherwise the state is 'xxx'. So let us fix the 'Linux bridge agent' on HostA and get a ':-)' for it.

    2. List the DHCP agents hosting a given network

      In some deployments, one DCHP agent are not enough to hold all the network data. In addtion, we should have backup for it even when the deployment is small one. The same network can be assigned to more than DHCP agent and one DHCP agent can host more than one networks. Let's first go with command that lists DHCP agents hosting a given network.

      gongysh@gongysh-laptop:~$ quantum dhcp-agent-list net1
      +--------------------------------------+-------+----------+-------+
      | id                                   | host  | disabled | state |
      +--------------------------------------+-------+----------+-------+
      | a0c1c21c-d4f4-4577-9ec7-908f2d48622d | HostA | False    | :-)   |
      +--------------------------------------+-------+----------+-------+
                                      
    3. List the networks hosted by a given DHCP agent

      This command is the sister one with prevous.

      gongysh@gongysh-laptop:~$ quantum network-dhcp-agent-list a0c1c21c-d4f4-4577-9ec7-908f2d48622d
      +--------------------------------------+------+--------------------------------------+
      | id                                   | name | subnets                              |
      +--------------------------------------+------+--------------------------------------+
      | 89dca1c6-c7d4-4f7a-b730-549af0fb6e34 | net1 | f6c832e3-9968-46fd-8e45-d5cf646db9d1 |
      +--------------------------------------+------+--------------------------------------+
                                      
    4. Show the component's detail information

      'component-list' is just giving very general information for components. To know the detail information of a component, we can use 'component-show'.

      gongysh@gongysh-laptop:~$ quantum component-show a0c1c21c-d4f4-4577-9ec7-908f2d48622d
      +---------------------+----------------------------------------------------------+
      | Field               | Value                                                    |
      +---------------------+----------------------------------------------------------+
      | _current_time       | 2012-12-18T08:54:08.503839                               |
      | binary              | quantum-dhcp-agent                                       |
      | configurations      | {                                                        |
      |                     |      "subnets": "1",                                     |
      |                     |      "use_namespaces": "True",                           |
      |                     |      "dhcp_driver": "quantum.agent.linux.dhcp.Dnsmasq",  |
      |                     |      "networks": "1",                                    |
      |                     |      "dhcp_lease_time": "120",                           |
      |                     |      "ports": "5"                                        |
      |                     | }                                                        |
      | created_at          | 2012-12-18T03:38:13.000000                               |
      | description         |                                                          |
      | disabled            | False                                                    |
      | group               | agent                                                    |
      | heartbeat_timestamp | 2012-12-18T08:53:56.000000                               |
      | host                | HostA                                                    |
      | id                  | a0c1c21c-d4f4-4577-9ec7-908f2d48622d                     |
      | topic               | dhcp_agent                                               |
      | type                | DHCP agent                                               |
      +---------------------+----------------------------------------------------------+
                                      

      In the above output, the '_current_time' is quantum-server's current UTC time. 'heartbeat_timestamp' is the time on quantum server too. So we don't need all components synced to quantum server's time for this extension to run well. 'configurations' is about the component's static configuraiton or run time data. We can see that this component is a DHCP agent, and it is hosting one network, one subnet and 5 ports.

      Different type of agents has different detail. Below is information for a 'Linux bridge agent'

      gongysh@gongysh-laptop:~$ quantum component-show ed96b856-ae0f-4d75-bb28-40a47ffd7695
      +---------------------+--------------------------------------+
      | Field               | Value                                |
      +---------------------+--------------------------------------+
      | _current_time       | 2012-12-18T08:59:47.752584           |
      | binary              | quantum-linuxbridge-agent            |
      | configurations      | {                                    |
      |                     |      "physnet1": "eth0",             |
      |                     |      "devices": "4"                  |
      |                     | }                                    |
      | created_at          | 2012-12-18T03:49:52.000000           |
      | description         |                                      |
      | disabled            | False                                |
      | group               | agent                                |
      | heartbeat_timestamp | 2012-12-18T08:59:45.000000           |
      | host                | HostB                                |
      | id                  | ed96b856-ae0f-4d75-bb28-40a47ffd7695 |
      | topic               | N/A                                  |
      | type                | Linux bridge agent                   |
      +---------------------+--------------------------------------+
                                      

      Just as shown, we can see bridge-mapping, and the number of VM's virtual nics on this L2 agent.

  • Manage assignment of networks to DHCP agent

    We have shown 'network-dhcp-agent-list' and 'dhcp-agent-list' command. Now let's look at how to add a network to a DHCP agent and remove one from it.

    1. Default scheduling

      When a network is created, we will try to schedule it to an active DHCP agent. If there are many active DHCP agents, we select one randomly. ( We can design more sophisiticated scheduling algorithm just like we do in nova-schedule.)

      gongysh@gongysh-laptop:~$ quantum net-create net2
      Created a new network:
      +---------------------------+--------------------------------------+
      | Field                     | Value                                |
      +---------------------------+--------------------------------------+
      | admin_state_up            | True                                 |
      | id                        | 9b96b14f-71b8-4918-90aa-c5d705606b1a |
      | name                      | net2                                 |
      | provider:network_type     | vlan                                 |
      | provider:physical_network | physnet1                             |
      | provider:segmentation_id  | 1001                                 |
      | router:external           | False                                |
      | shared                    | False                                |
      | status                    | ACTIVE                               |
      | subnets                   |                                      |
      | tenant_id                 | b7445f221cda4f4a8ac7db6b218b1339     |
      +---------------------------+--------------------------------------+
      gongysh@gongysh-laptop:~$ quantum dhcp-agent-list net2
      +--------------------------------------+-------+----------+-------+
      | id                                   | host  | disabled | state |
      +--------------------------------------+-------+----------+-------+
      | a0c1c21c-d4f4-4577-9ec7-908f2d48622d | HostA | False    | :-)   |
      +--------------------------------------+-------+----------+-------+
      gongysh@gongysh-laptop:~$ quantum subnet-create net2 9.0.1.0/24 --name subnet2
      Created a new subnet:
      +------------------+------------------------------------------+
      | Field            | Value                                    |
      +------------------+------------------------------------------+
      | allocation_pools | {"start": "9.0.1.2", "end": "9.0.1.254"} |
      | cidr             | 9.0.1.0/24                               |
      | dns_nameservers  |                                          |
      | enable_dhcp      | True                                     |
      | gateway_ip       | 9.0.1.1                                  |
      | host_routes      |                                          |
      | id               | 6979b71a-0ae8-448c-aa87-65f68eedcaaa     |
      | ip_version       | 4                                        |
      | name             | subnet2                                  |
      | network_id       | 9b96b14f-71b8-4918-90aa-c5d705606b1a     |
      | tenant_id        | b7445f221cda4f4a8ac7db6b218b1339         |
      +------------------+------------------------------------------+
      
                                      

      We can see it is still allocated to DHCP agent on HostA. If we want to validate the behavior via dnsmasq, don't forget to create a subnet for the network since DHCP agent starts the dnsmasq only if there is a DHCP enabled subnet on it.

    2. Assign a network to a given DHCP agent

      Since we have two DHCP agents, we want another DHCP agent to host the network too.

      gongysh@gongysh-laptop:~$ quantum dhcp-agent-add-network f28aa126-6edb-4ea5-a81e-8850876bc0a8 net2
      Added network net2 to dhcp agent
      gongysh@gongysh-laptop:~$ quantum dhcp-agent-list net2
      +--------------------------------------+-------+----------+-------+
      | id                                   | host  | disabled | state |
      +--------------------------------------+-------+----------+-------+
      | a0c1c21c-d4f4-4577-9ec7-908f2d48622d | HostA | False    | :-)   |
      | f28aa126-6edb-4ea5-a81e-8850876bc0a8 | HostB | False    | :-)   |
      +--------------------------------------+-------+----------+-------+
                                      

      We can see Both DHCP agents are hosting 'net2' network.

    3. Remove a network from a given DHCP agent

      This command is the sister one of preious command. Let's remove 'net2' from HostA's DHCP agent.

      gongysh@gongysh-laptop:~$ quantum dhcp-agent-remove-network a0c1c21c-d4f4-4577-9ec7-908f2d48622d net2
      Removed network net2 to dhcp agent
      gongysh@gongysh-laptop:~$ quantum dhcp-agent-list net2
      +--------------------------------------+-------+----------+-------+
      | id                                   | host  | disabled | state |
      +--------------------------------------+-------+----------+-------+
      | f28aa126-6edb-4ea5-a81e-8850876bc0a8 | HostB | False    | :-)   |
      +--------------------------------------+-------+----------+-------+
                                      

      We can see now only HostB's DHCP agent is hosting 'net2' network.

  • Experiment HA of DHCP agent

    First we will boot a VM on net2, then we let both DHCP agents host 'net2'. After that, we fail the agent in turn and to see if the VM can still get the IP during that time.

    1. Boot a VM on net2

      gongysh@gongysh-laptop:~$ quantum net-list
      +--------------------------------------+------+--------------------------------------+
      | id                                   | name | subnets                              |
      +--------------------------------------+------+--------------------------------------+
      | 89dca1c6-c7d4-4f7a-b730-549af0fb6e34 | net1 | f6c832e3-9968-46fd-8e45-d5cf646db9d1 |
      | 9b96b14f-71b8-4918-90aa-c5d705606b1a | net2 | 6979b71a-0ae8-448c-aa87-65f68eedcaaa |
      +--------------------------------------+------+--------------------------------------+
      gongysh@gongysh-laptop:~$ nova boot --image tty --flavor 1 myserver4 --nic net-id=9b96b14f-71b8-4918-90aa-c5d705606b1a
      gongysh@gongysh-laptop:~$ nova list
      +--------------------------------------+-----------+--------+---------------+
      | ID                                   | Name      | Status | Networks      |
      +--------------------------------------+-----------+--------+---------------+
      | c394fcd0-0baa-43ae-a793-201815c3e8ce | myserver1 | ACTIVE | net1=10.0.1.3 |
      | 2d604e05-9a6c-4ddb-9082-8a1fbdcc797d | myserver2 | ACTIVE | net1=10.0.1.4 |
      | c7c0481c-3db8-4d7a-a948-60ce8211d585 | myserver3 | ACTIVE | net1=10.0.1.5 |
      | f62f4731-5591-46b1-9d74-f0c901de567f | myserver4 | ACTIVE | net2=9.0.1.2  |
      +--------------------------------------+-----------+--------+---------------+
                                      
    2. Make sure both DHCP agents hosting 'net2'

      We can use commands shown before to assign the network to agents.

      gongysh@gongysh-laptop:~$ quantum dhcp-agent-list net2
      +--------------------------------------+-------+----------+-------+
      | id                                   | host  | disabled | state |
      +--------------------------------------+-------+----------+-------+
      | a0c1c21c-d4f4-4577-9ec7-908f2d48622d | HostA | False    | :-)   |
      | f28aa126-6edb-4ea5-a81e-8850876bc0a8 | HostB | False    | :-)   |
      +--------------------------------------+-------+----------+-------+
                                      
    3. Testing the HA

      Step 1. Login to the myserver4 VM, and run 'udhcpc'

      Step 2. Stop the DHCP agent on HostA (Beside stoping the quantum-dhcp-agent binary, we must make sure dnsmasq processes are gone too.)

      Step 3. Run 'udhcpc' in VM. We can see it can get the wanted IP.

      Step 4. Stop the DHCp agent on HostB too.

      Step 5. Run 'udhcpc' in VM. We can see it cannot get the wanted IP.

      Step 6. Start DHCP agent on HostB. We can see VM can get the wanted IP again.

  • Disable and remove a component

    Amin user wants to disable a component if there is a system upgrade planned, whatever hardware or software. Some components which support scheduling support disable or enable too, such as 'L3 agent' and 'DHCP agent'. Once the component is disabled, the scheduler will not schedule new resources to the component. After the component is disabled, we can remove the component. However, we need to remove the resources on the component before we remove the component itself.

    To run the commands below, we need first stop the DHCP agent on HostA.

    gongysh@gongysh-laptop:~/git/python-quantumclient$ quantum component-update --disable a0c1c21c-d4f4-4577-9ec7-908f2d48622d
    Updated component: a0c1c21c-d4f4-4577-9ec7-908f2d48622d
    gongysh@gongysh-laptop:~/git/python-quantumclient$ quantum component-list 
    +--------------------------------------+--------------------+-------+----------+-------+
    | id                                   | type               | host  | disabled | state |
    +--------------------------------------+--------------------+-------+----------+-------+
    | 1b69828d-6a9b-4826-87cd-1757f0e27f31 | Linux bridge agent | HostA | False    | :-)   |
    | a0c1c21c-d4f4-4577-9ec7-908f2d48622d | DHCP agent         | HostA | True     | XXX   |
    | ed96b856-ae0f-4d75-bb28-40a47ffd7695 | Linux bridge agent | HostB | False    | :-)   |
    | f28aa126-6edb-4ea5-a81e-8850876bc0a8 | DHCP agent         | HostB | False    | :-)   |
    +--------------------------------------+--------------------+-------+----------+-------+
    gongysh@gongysh-laptop:~/git/python-quantumclient$ quantum component-delete a0c1c21c-d4f4-4577-9ec7-908f2d48622d
    Deleted component: a0c1c21c-d4f4-4577-9ec7-908f2d48622d
    gongysh@gongysh-laptop:~/git/python-quantumclient$ quantum component-list 
    +--------------------------------------+--------------------+-------+----------+-------+
    | id                                   | type               | host  | disabled | state |
    +--------------------------------------+--------------------+-------+----------+-------+
    | 1b69828d-6a9b-4826-87cd-1757f0e27f31 | Linux bridge agent | HostA | False    | :-)   |
    | ed96b856-ae0f-4d75-bb28-40a47ffd7695 | Linux bridge agent | HostB | False    | :-)   |
    | f28aa126-6edb-4ea5-a81e-8850876bc0a8 | DHCP agent         | HostB | False    | :-)   |
    +--------------------------------------+--------------------+-------+----------+-------+
                                    

    After deletion, if we restart the DHCP agent, it will in component list again.



loading table of contents...