diff --git a/src/kickstarts/contrail-ubuntu.ks b/src/kickstarts/contrail-ubuntu.ks index d4c01c8f..6cb64a27 100755 --- a/src/kickstarts/contrail-ubuntu.ks +++ b/src/kickstarts/contrail-ubuntu.ks @@ -119,6 +119,7 @@ apt-get update apt-get -y install puppet apt-get -y install python-netaddr apt-get -y install ifenslave-2.6=1.1.0-19ubuntu5 +apt-get -y install vlan # Packages needed to get Inventory and Monitoring Info apt-get -y install sysstat diff --git a/src/kickstarts/contrail-ubuntu_trusty.ks b/src/kickstarts/contrail-ubuntu_trusty.ks index 8f9fbdfc..9640672b 100755 --- a/src/kickstarts/contrail-ubuntu_trusty.ks +++ b/src/kickstarts/contrail-ubuntu_trusty.ks @@ -131,6 +131,7 @@ apt-get update apt-get -y install biosdevname apt-get -y install python-netaddr apt-get -y install ifenslave=2.4ubuntu1 +apt-get -y install vlan # Packages needed to get Inventory and Monitoring Info apt-get -y install sysstat diff --git a/src/kickstarts/contrail-ubuntu_xenial.ks b/src/kickstarts/contrail-ubuntu_xenial.ks index c2ce24fd..015bab6c 100644 --- a/src/kickstarts/contrail-ubuntu_xenial.ks +++ b/src/kickstarts/contrail-ubuntu_xenial.ks @@ -89,6 +89,7 @@ apt-get update apt-get -y install biosdevname apt-get -y install python-netaddr apt-get -y install ifenslave=2.4ubuntu1 +apt-get -y install vlan # Packages needed to get Inventory and Monitoring Info apt-get -y install sysstat diff --git a/src/kickstarts/interface_setup.py b/src/kickstarts/interface_setup.py index bc0c7289..f7f5f4de 100644 --- a/src/kickstarts/interface_setup.py +++ b/src/kickstarts/interface_setup.py @@ -410,11 +410,16 @@ def create_bond_members(self): def create_vlan_interface(self): '''Create interface config for vlan sub interface''' interface = 'vlan'+self.vlan - cfg = ['auto %s' %interface, - 'iface %s inet static' %interface, - 'address %s' %self.ipaddr, - 'netmask %s' %self.netmask, - 'vlan-raw-device %s' %self.device] + if self.dhcp: + cfg = ['auto %s' %interface, + 'iface %s inet dhcp' %interface, + 'vlan-raw-device %s' %self.device] + else: + cfg = ['auto %s' %interface, + 'iface %s inet static' %interface, + 'address %s' %self.ipaddr, + 'netmask %s' %self.netmask, + 'vlan-raw-device %s' %self.device] if self.gw: cfg.append('gateway %s' %self.gw) if self.mtu: diff --git a/src/server_mgr_main.py b/src/server_mgr_main.py index 0af1720c..956a15a9 100755 --- a/src/server_mgr_main.py +++ b/src/server_mgr_main.py @@ -3672,8 +3672,16 @@ def build_server_cfg(self, server): d_gw = intf.get('default_gateway', None) dhcp = intf.get('dhcp', None) mtu = intf.get('mtu', '') + vlan = intf.get('vlan','') + if mtu: mtu = '--mtu %s' %mtu + + if vlan: + vlan = '--vlan %s' %vlan + else: + vlan = '' + type = intf.get('type', None) #form string if type and type.lower() == 'bond': @@ -3682,32 +3690,32 @@ def build_server_cfg(self, server): intf.get('member_interfaces', [])) if dhcp: device_str+= ("python /root/interface_setup.py \ ---device %s --members %s --bond-opts \"%s\" --dhcp\n") % \ - (name, " ".join(member_intfs), json.dumps(bond_opts)) +--device %s --members %s --bond-opts \"%s\" --dhcp %s\n") % \ + (name, " ".join(member_intfs), json.dumps(bond_opts), vlan) #If bond interface is the management interface you need to set the gateway elif ((mgmt_intf == name) and d_gw): device_str+= ("python /root/interface_setup.py \ ---device %s --members %s --bond-opts \"%s\" --ip %s --gw %s\n") % \ - (name, " ".join(member_intfs), json.dumps(bond_opts), ip_addr, d_gw) +--device %s --members %s --bond-opts \"%s\" --ip %s --gw %s %s\n") % \ + (name, " ".join(member_intfs), json.dumps(bond_opts), ip_addr, d_gw, vlan) else: device_str+= ("python /root/interface_setup.py \ ---device %s --members %s --bond-opts \"%s\" --ip %s\n") % \ - (name, " ".join(member_intfs), json.dumps(bond_opts), ip_addr) +--device %s --members %s --bond-opts \"%s\" --ip %s %s\n") % \ + (name, " ".join(member_intfs), json.dumps(bond_opts), ip_addr, vlan) execute_script = True else: #Take the mac_address as the name as the interface may be renamed after reboot if 'mac_address' in intf: name = intf['mac_address'].lower() if dhcp: - device_str+= ("python /root/interface_setup.py --device %s --dhcp\n") %(name) + device_str+= ("python /root/interface_setup.py --device %s --dhcp %s\n") %(name, vlan) else: #For static managment interface pass the default gateway if (mgmt_intf == intf_name) and d_gw: - device_str+= ("python /root/interface_setup.py --device %s --ip %s --gw %s\n") % \ - (name, ip_addr, d_gw) + device_str+= ("python /root/interface_setup.py --device %s --ip %s --gw %s %s\n") % \ + (name, ip_addr, d_gw, vlan) else: - device_str+= ("python /root/interface_setup.py --device %s --ip %s\n") % \ - (name, ip_addr) + device_str+= ("python /root/interface_setup.py --device %s --ip %s %s\n") % \ + (name, ip_addr, vlan) execute_script = True # Build route configuration and add it route_str = self.build_route_cfg(server)