Skip to content

Commit

Permalink
Closes-Bug: #1639351
Browse files Browse the repository at this point in the history
Configure default-gateway for bonded interfaces if it is specified in the json file

Change-Id: Icc5d556a4e6577c6cc9e2a35c8359283cdb68092
  • Loading branch information
sgurumurthy committed Nov 4, 2016
1 parent 0e242fb commit 1e58085
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/server_mgr_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3457,21 +3457,32 @@ def build_server_cfg(self, server):
bond_opts = intf.get('bond_options', {})
member_intfs = self.get_member_interfaces(network_dict,
intf.get('member_interfaces', []))
device_str+= ("python /root/interface_setup.py \
--device %s --members %s --bond-opts \"%s\" --ip %s %s\n") % \
(name,
" ".join(member_intfs),
json.dumps(bond_opts), ip_addr, mtu)
if 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)
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)
execute_script = True
else:
if 'mac_address' in intf:
name = intf['mac_address'].lower()
if dhcp:
device_str+= ("python /root/interface_setup.py --device %s --dhcp %s\n") % \
(name, mtu)
if d_gw:
device_str+= ("python /root/interface_setup.py --device %s --gw %s --dhcp\n") % \
(name, d_gw)
else:
device_str+= ("python /root/interface_setup.py --device %s --dhcp\n") % \
(name)
else:
device_str+= ("python /root/interface_setup.py --device %s --ip %s --gw %s %s\n") % \
(name, ip_addr, d_gw, mtu)
if d_gw:
device_str+= ("python /root/interface_setup.py --device %s --ip %s --gw %s\n") % \
(name, ip_addr, d_gw)
else:
device_str+= ("python /root/interface_setup.py --device %s --ip %s\n") % \
(name, ip_addr)
execute_script = True
# Build route configuration and add it
route_str = self.build_route_cfg(server)
Expand Down

0 comments on commit 1e58085

Please sign in to comment.