Skip to content

Commit

Permalink
vlan interface creation fails if the pre-up does "ifconfig up" of the…
Browse files Browse the repository at this point in the history
… vlan

interface that is being brought up. This is not an issue for physical interfaces,
but fails if the VLAN is created on top of SR-IOV VFs. post-up should be
used instead of pre-up as the interface would have been created by then.

Change-Id: If7988947cf758776e36cbe5df87e9f55e40c44bb
Closes-bug: 1573255
  • Loading branch information
srajag committed May 24, 2016
1 parent 4158fce commit 9d08ef1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions contrail_provisioning/compute/network.py
Expand Up @@ -311,8 +311,12 @@ def _rewrite_net_interfaces_file(self, dev, mac, vhost_ip, netmask, gateway_ip,
# add manual entry for dev
local("echo 'auto %s' >> %s" %(dev, temp_intf_file))
local("echo 'iface %s inet manual' >> %s" %(dev, temp_intf_file))
local("echo ' pre-up ifconfig %s up' >> %s" %(dev, temp_intf_file))
local("echo ' post-down ifconfig %s down' >> %s" %(dev, temp_intf_file))
if vlan:
local("echo ' post-up ifconfig %s up' >> %s" %(dev, temp_intf_file))
local("echo ' pre-down ifconfig %s down' >> %s" %(dev, temp_intf_file))
else:
local("echo ' pre-up ifconfig %s up' >> %s" %(dev, temp_intf_file))
local("echo ' post-down ifconfig %s down' >> %s" %(dev, temp_intf_file))
if (esxi_vm):
device_driver = local("ethtool -i %s | grep driver | cut -f 2 -d ' '" %dev, capture=True)
if (device_driver == "vmxnet3"):
Expand Down Expand Up @@ -344,7 +348,10 @@ def _rewrite_net_interfaces_file(self, dev, mac, vhost_ip, netmask, gateway_ip,
if (device_driver == "vmxnet3"):
local("echo ' pre-up ethtool --offload %s rx off' >> %s" %(dev, temp_intf_file))
local("echo ' pre-up ethtool --offload %s tx off' >> %s" %(dev, temp_intf_file))
local("sed -i '/auto %s/ a\iface %s inet manual\\n pre-up ifconfig %s up\\n post-down ifconfig %s down\' %s"% (dev, dev, dev, dev, temp_intf_file))
if vlan:
local("sed -i '/auto %s/ a\iface %s inet manual\\n post-up ifconfig %s up\\n pre-down ifconfig %s down\' %s"% (dev, dev, dev, dev, temp_intf_file))
else:
local("sed -i '/auto %s/ a\iface %s inet manual\\n pre-up ifconfig %s up\\n post-down ifconfig %s down\' %s"% (dev, dev, dev, dev, temp_intf_file))
if esxi_vm and vmpg_mtu:
intf = self.get_secondary_device(self.dev)
mac_addr = self.get_if_mac(intf)
Expand Down

0 comments on commit 9d08ef1

Please sign in to comment.