From 7b6aadfa21b5e3b2172882ba7f503a0a4d212776 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Tue, 27 Nov 2007 22:18:45 +0000 Subject: [PATCH] Support multiple interfaces. --- source/steps/GetAndUpdateNodeDetails.py | 3 +++ source/steps/WriteNetworkConfig.py | 26 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/source/steps/GetAndUpdateNodeDetails.py b/source/steps/GetAndUpdateNodeDetails.py index 3db047d..475847b 100644 --- a/source/steps/GetAndUpdateNodeDetails.py +++ b/source/steps/GetAndUpdateNodeDetails.py @@ -38,6 +38,7 @@ def Run( vars, log ): SKIP_HARDWARE_REQUIREMENT_CHECK Whether or not we should skip hardware requirement checks NODE_SESSION The session value returned from BootGetNodeDetails + NODE_NETWORKS The networks associated with this node Return 1 if able to contact PLC and get node info. Raise a BootManagerException if anything fails. @@ -103,6 +104,8 @@ def Run( vars, log ): if not got_primary: raise BootManagerException, "Node did not have a primary network." + + vars['NODE_NETWORKS']= node_networks log.write( "Primary network as returned from PLC: %s\n" % str(network) ) diff --git a/source/steps/WriteNetworkConfig.py b/source/steps/WriteNetworkConfig.py index f92985c..67bd8e1 100644 --- a/source/steps/WriteNetworkConfig.py +++ b/source/steps/WriteNetworkConfig.py @@ -48,6 +48,7 @@ def Run( vars, log ): (always starts with TEMP_PATH) NETWORK_SETTINGS A dictionary of the values from the network configuration file + NODE_NETWORKS All the network associated with this node Sets the following variables: None """ @@ -161,3 +162,28 @@ def Run( vars, log ): network_file.write( "GATEWAY=%s\n" % gateway ) network_file.close() network_file= None + + interface = 1 + for network in vars['NODE_NETWORKS']: + if network['is_primary'] == 1: + continue + if method == "static" or method == "dhcp": + f = file("%s/etc/sysconfig/network-scripts/ifcfg-eth%d" % + (SYSIMG_PATH, interface), "w") + f.write("DEVICE=eth%d\n" % interface) + f.write("HWADDR=%s\n" % mac) + f.write("ONBOOT=yes\n") + f.write("USERCTL=no\n") + if method == "static": + f.write("BOOTPROTO=static\n") + f.write("IPADDR=%s\n" % network['ip']) + f.write("NETMASK=%s\n" % network['netmask']) + elif method == "dhcp": + f.write("BOOTPROTO=dhcp\n") + if network['hostname']: + f.write("DHCP_HOSTNAME=%s\n" % network['hostname']) + else: + f.write("DHCP_HOSTNAME=%s\n" % hostname) + f.write("DHCLIENTARGS='-R subnet-mask'\n") + f.close() + -- 2.43.0