~freyes/+junk/lp1387390

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/context.py

  • Committer: David Della Vecchia
  • Date: 2015-09-28 21:24:44 UTC
  • mto: This revision was merged to the branch mainline in revision 174.
  • Revision ID: ddv@canonical.com-20150928212444-9dq6ynacrfuwv0q2
Implementing new charmhelpers-based upgrade action

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# You should have received a copy of the GNU Lesser General Public License
15
15
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
16
16
 
 
17
import glob
17
18
import json
18
19
import os
19
20
import re
1378
1379
            ports = mappings.values()
1379
1380
            napi_settings = NeutronAPIContext()()
1380
1381
            mtu = napi_settings.get('network_device_mtu')
 
1382
            all_ports = set()
 
1383
            # If any of ports is a vlan device, its underlying device must have
 
1384
            # mtu applied first.
 
1385
            for port in ports:
 
1386
                for lport in glob.glob("/sys/class/net/%s/lower_*" % port):
 
1387
                    lport = os.path.basename(lport)
 
1388
                    all_ports.add(lport.split('_')[1])
 
1389
 
 
1390
            all_ports = list(all_ports)
 
1391
            all_ports.extend(ports)
1381
1392
            if mtu:
1382
 
                ctxt["devs"] = '\\n'.join(ports)
 
1393
                ctxt["devs"] = '\\n'.join(all_ports)
1383
1394
                ctxt['mtu'] = mtu
1384
1395
 
1385
1396
        return ctxt