Showing posts with label brctl. Show all posts
Showing posts with label brctl. Show all posts

Tuesday, May 6, 2014

Doing reverse lookups of information in order to find things in Openstack

One of the most annoying things I find in Openstack is the lack of use of user friendly names. It's very tedious to reverse lookup information for troubleshooting and configuration.

For example, say I want to find out which tap port on my VM is connected to an openvswitch bridge. I would have to look up the VM in nova and find the corresponding IP assigned to it.

[root@centos-6-5-openstack ~(keystone_admin)]# nova list
+--------------------------------------+------+--------+------------+-------------+---------------------+
| ID                                   | Name | Status | Task State | Power State | Networks            |
+--------------------------------------+------+--------+------------+-------------+---------------------+
| 8b3ecae9-7b59-4b6f-a0a0-bbd5ab5aa629 | aa   | ACTIVE | -          | Running     | net1=192.168.251.10 |

| a679f6f9-bd7d-4e31-95a6-9776c44f0a4a | bb   | ACTIVE | -          | Running     | net1=192.168.251.12 |

Then I would list the ports in neutron.

[root@centos-6-5-openstack ~(keystone_admin)]# neutron port-list
+--------------------------------------+-------------+-------------------+---------------------------------------------------------------------------------------+
| id                                   | name        | mac_address       | fixed_ips                                                                             |
+--------------------------------------+-------------+-------------------+---------------------------------------------------------------------------------------+
| 014d6bba-7ab9-4028-9cd9-dbe27bd51b83 |             | fa:16:3e:1b:19:7d | {"subnet_id": "8942189b-8fbf-44e9-adbb-d62dd0d27015", "ip_address": "192.168.250.10"} |
| 1d3246d7-adb1-4b18-a911-b36562c278e0 |             | fa:16:3e:bd:e9:69 | {"subnet_id": "0147052f-2a0b-4a5b-9930-1d4e258e0c1a", "ip_address": "192.168.251.10"} |
| 40b988aa-c016-4e85-b9cf-beeb4332ab04 |             | fa:16:3e:e1:7e:57 | {"subnet_id": "0147052f-2a0b-4a5b-9930-1d4e258e0c1a", "ip_address": "192.168.251.12"} |
| cb867d96-a4ed-449d-a35a-f3670a14e710 |             | fa:16:3e:ce:a5:7e | {"subnet_id": "0147052f-2a0b-4a5b-9930-1d4e258e0c1a", "ip_address": "192.168.251.11"} |
| d267267b-5630-43df-8a07-05793fd831d0 |             | fa:16:3e:61:84:91 | {"subnet_id": "8942189b-8fbf-44e9-adbb-d62dd0d27015", "ip_address": "192.168.250.11"} |
| f434c257-5bbf-42a6-9136-072d1104fa19 |               | fa:16:3e:24:18:08 | {"subnet_id": "0147052f-2a0b-4a5b-9930-1d4e258e0c1a", "ip_address": "192.168.251.1"}  |

+--------------------------------------+-------------+-------------------+---------------------------------------------------------------------------------------+

Next I would need to look at the mac address and do a lookup in ip address

After coming through the list I can then verify the tap address with ip address show tapxxxx

[root@centos-6-5-openstack ~(keystone_admin)]# ip a show tap40b988aa-c0
30: tap40b988aa-c0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
    link/ether fe:16:3e:e1:7e:57 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc16:3eff:fee1:7e57/64 scope link 
       valid_lft forever preferred_lft forever


And now I can do something useful like see which bridge the tap interface belongs to and verify the mac in the mac table.

[root@centos-6-5-openstack ~(keystone_admin)]# brctl show
bridge name bridge id STP enabled interfaces
qbr1d3246d7-ad 8000.4a04d0b90d18 no qvb1d3246d7-ad
tap1d3246d7-ad
qbr40b988aa-c0 8000.de752effa37c no qvb40b988aa-c0
tap40b988aa-c0
qbr7316a274-16 8000.8671bda4d699 no qvb7316a274-16
tap7316a274-16
qbrd06fccba-ad 8000.4613c3848432 no qvbd06fccba-ad
tapd06fccba-ad
[root@centos-6-5-openstack ~(keystone_admin)]# brctl showmacs qbr40b988aa-c0
port no mac addr is local? ageing timer
  1 de:75:2e:ff:a3:7c yes   0.00
  2 fe:16:3e:e1:7e:57 yes   0.00

or look at the openvswitch table and find out which bridge it belongs to

[root@centos-6-5-openstack ~(keystone_admin)]# ovs-vsctl list-ifaces br-int
int-br-ex
qr-87202226-14
qr-ba3e1c3b-49
qr-f2b01b2b-ad
qr-f434c257-5b
qvo1d3246d7-ad
qvo40b988aa-c0
qvo7316a274-16
qvod06fccba-ad
tapafe229a7-2e
tapca265ec6-29
tapcb867d96-a4
tape4751034-2c


This looks like a to do scripting project to get this information. 

Here I could create a table that would give me:

Nova ID
VM name
VM IP
VM Mac address
Neutron ID
tap interface
bridge mac table
openvswitch bridge