list_nics vlan tagging support

Bug #1316690 reported by sean redmond
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
quantum-gateway (Juju Charms Collection)
Fix Released
Medium
Liam Young

Bug Description

When I attempt to use a VLAN tagged interface for juju value 'flat-interface' in charm nova-compute I get the below failure in quantum-gateway:

2014-05-06 14:35:04 INFO juju-log Wrote template /etc/neutron/metering_agent.ini.
2014-05-06 14:35:04 INFO config-changed Device "eth2.3397@eth2" does not exist.
2014-05-06 14:35:04 INFO config-changed Traceback (most recent call last):
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/config-changed", line 180, in <module>
2014-05-06 14:35:04 INFO config-changed hooks.execute(sys.argv)
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/charmhelpers/core/hookenv.py", line 381, in execute
2014-05-06 14:35:04 INFO config-changed self._hooks[hook_name]()
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/charmhelpers/core/host.py", line 217, in wrapped_f
2014-05-06 14:35:04 INFO config-changed f(*args)
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/config-changed", line 87, in config_changed
2014-05-06 14:35:04 INFO config-changed CONFIGS.write_all()
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/charmhelpers/contrib/openstack/templating.py", line 262, in write_all
2014-05-06 14:35:04 INFO config-changed [self.write(k) for k in self.templates.iterkeys()]
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/charmhelpers/contrib/openstack/templating.py", line 251, in write
2014-05-06 14:35:04 INFO config-changed _out = self.render(config_file)
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/charmhelpers/contrib/openstack/templating.py", line 222, in render
2014-05-06 14:35:04 INFO config-changed ctxt = self.templates[config_file].context()
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/charmhelpers/contrib/openstack/templating.py", line 88, in context
2014-05-06 14:35:04 INFO config-changed _ctxt = context()
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/quantum_contexts.py", line 135, in __call__
2014-05-06 14:35:04 INFO config-changed hwaddrs[get_nic_hwaddr(nic)] = nic
2014-05-06 14:35:04 INFO config-changed File "/var/lib/juju/agents/unit-quantum-gateway-0/charm/hooks/charmhelpers/core/host.py", line 292, in get_nic_hwaddr
2014-05-06 14:35:04 INFO config-changed ip_output = subprocess.check_output(cmd)
2014-05-06 14:35:04 INFO config-changed File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
2014-05-06 14:35:04 INFO config-changed raise CalledProcessError(retcode, cmd, output=output)
2014-05-06 14:35:04 INFO config-changed subprocess.CalledProcessError: Command '['ip', '-o', '-0', 'addr', 'show', 'eth2.3397@eth2']' returned non-zero exit status 1

looking Inside hooks/charmhelpers/core/host.py the below function looks to be the suspect

def list_nics(nic_type):
    '''Return a list of nics of given type(s)'''
    if isinstance(nic_type, basestring):
        int_types = [nic_type]
    else:
        int_types = nic_type
    interfaces = []
    for int_type in int_types:
        cmd = ['ip', 'addr', 'show', 'label', int_type + '*']
        ip_output = subprocess.check_output(cmd).split('\n')
        ip_output = (line for line in ip_output if line)
        for line in ip_output:
            if line.split()[1].startswith(int_type):
                interfaces.append(line.split()[1].replace(":", ""))
    return interfaces

I can see we are splitting on ':' and don't consider that an '@' maybe present so our return looks like this:

 ubuntu@os-nc-02:/var/log/juju$ ip addr show label eth*
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
    link/ether b8:ca:3a:6c:87:5c brd ff:ff:ff:ff:ff:ff
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq master ovs-system state DOWN group default qlen 1000
    link/ether b8:ca:3a:6c:87:5d brd ff:ff:ff:ff:ff:ff
4: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether b8:ca:3a:6c:87:58 brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether b8:ca:3a:6c:87:5a brd ff:ff:ff:ff:ff:ff
12: eth2.3397@eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default
    link/ether b8:ca:3a:6c:87:58 brd ff:ff:ff:ff:ff:ff
    inet 172.27.192.37/23 brd 172.27.193.255 scope global eth2.3397
       valid_lft forever preferred_lft forever
13: eth2.2803@eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default
    link/ether b8:ca:3a:6c:87:58 brd ff:ff:ff:ff:ff:ff
    inet 0.0.0.0/24 brd 46.37.172.255 scope global eth2.2803
       valid_lft forever preferred_lft forever
14: eth2.3104@eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default
    link/ether b8:ca:3a:6c:87:58 brd ff:ff:ff:ff:ff:ff
    inet 172.28.196.87/25 brd 172.28.196.127 scope global eth2.3104
       valid_lft forever preferred_lft forever
ubuntu@os-nc-02:/var/log/juju$

If we then try and use this returned value like the below we get the error found in the juju log:

ubuntu@wqjxc:~$ ip -o -0 addr show eth2.3397\@eth2
Device "eth2.3397@eth2" does not exist.

However if we strip from the '@' instead of the ':' it would look like the below.

ubuntu@wqjxc:~$ ip -o -0 addr show eth2.3397
13: eth2.3397@eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default \ link/ether b8:ca:3a:6c:52:55 brd ff:ff:ff:ff:ff:ff

--The interface files looks like this--

auto eth2.3397
source /etc/network/eth2.3397.config

--The eth2.3397.config file looks like this--

iface eth2.3397 inet static
address 172.27.192.37
netmask 255.255.254.0

Tags: openstack

Related branches

James Page (james-page)
Changed in quantum-gateway (Juju Charms Collection):
assignee: nobody → Liam Young (gnuoy)
James Page (james-page)
Changed in quantum-gateway (Juju Charms Collection):
importance: Undecided → Medium
status: New → Triaged
tags: added: openstack
Revision history for this message
Paul Gear (paulgear) wrote :

This is due to a bug in charm-helpers/code/host.py which falsely assumes that only bond interfaces have VLANs. I've proposed a merge into charm-helpers trunk to fix this: https://code.launchpad.net/~paulgear/charm-helpers/charm-helpers/+merge/247378

Revision history for this message
Paul Gear (paulgear) wrote :

Fix for this has been merged into charm-helpers (see above for link).

James Page (james-page)
Changed in quantum-gateway (Juju Charms Collection):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.