'ip addr show label' command returns vlan interfaces in an unusable format

Bug #1382050 reported by Chris Johnston
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
Medium
Jorge Niedbalski

Bug Description

the 'ip addr show label' command the charm uses displays vlan interfaces on bonds in the following format which is not able to used, for example bond0.10@bond0, when we just want bond0.10. The next step should be to open the bug against the quantum-gateway charm for this issue.

$ ip addr show label bond0.10
6: bond0.10@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 08:00:27:16:b9:5f brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.255 scope global bond0.10
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe16:b95f/64 scope link
valid_lft forever preferred_lft forever

The following patch is what we used to split "bond0.10@bond0" on '@' and only return the first field "bond0.10"

=== modified file 'hooks/charmhelpers/core/host.py'
--- hooks/charmhelpers/core/host.py 2014-08-13 15:56:32 +0000
+++ hooks/charmhelpers/core/host.py 2014-08-29 20:39:24 +0000
@@ -13,6 +13,7 @@
import subprocess
import hashlib
import apt_pkg
+import re

from collections import OrderedDict

@@ -281,7 +282,11 @@
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(":", ""))
+ if re.search('@', line):
+ interfaces.append(line.split()[1].replace(":", "").split("@")[0])
+ else:
+ interfaces.append(line.split()[1].replace(":", ""))
return interfaces

Tags: cts

Related branches

description: updated
Matt Rae (mattrae)
description: updated
Changed in charm-helpers:
status: New → Confirmed
assignee: nobody → Jorge Niedbalski (niedbalski)
importance: Undecided → Medium
status: Confirmed → Fix Committed
Changed in charm-helpers:
status: Fix Committed → 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.