[node-patches] Change in ovirt-node[master]: disable networking completely when nics are set to disabled
jboggs at redhat.com
jboggs at redhat.com
Wed Aug 22 17:15:46 UTC 2012
Joey Boggs has uploaded a new change for review.
Change subject: disable networking completely when nics are set to disabled
......................................................................
disable networking completely when nics are set to disabled
rhbz#827309
Change-Id: I610206ac8192d0c2f51ec1ff0e5415c7022420fb
Signed-off-by: Joey Boggs <jboggs at redhat.com>
---
M scripts/ovirtnode/network.py
1 file changed, 33 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/20/7420/1
diff --git a/scripts/ovirtnode/network.py b/scripts/ovirtnode/network.py
index 4e1440b..e61af22 100644
--- a/scripts/ovirtnode/network.py
+++ b/scripts/ovirtnode/network.py
@@ -150,8 +150,13 @@
self.BR_CONFIG += "set %s/GATEWAY %s\n" % (BR_ROOT, \
OVIRT_VARS["OVIRT_IP_GATEWAY"])
- self.IF_CONFIG += "set %s/ONBOOT yes" % IF_ROOT
- self.BR_CONFIG += "set %s/ONBOOT yes" % BR_ROOT
+ if self.disabled_nic == 1:
+ self.BR_CONFIG += "set %s/ONBOOT no" % BR_ROOT
+ self.IF_CONFIG += "set %s/ONBOOT no" % IF_ROOT
+ else:
+ self.IF_CONFIG += "set %s/ONBOOT yes" % IF_ROOT
+ self.BR_CONFIG += "set %s/ONBOOT yes" % BR_ROOT
+
self.IF_CONFIG = self.IF_CONFIG.split("\n")
self.BR_CONFIG = self.BR_CONFIG.split("\n")
try:
@@ -304,30 +309,31 @@
_functions.augtool(oper, key, "")
logger.debug("Updating bridge config")
- for line in self.BR_CONFIG:
- logger.debug(line)
- try:
- oper, key, value = line.split()
- _functions.augtool(oper, key, value)
- except:
+ if not self.disabled_nic == 1:
+ for line in self.BR_CONFIG:
+ logger.debug(line)
try:
- oper, key = line.split()
- _functions.augtool(oper, key, "")
+ oper, key, value = line.split()
+ _functions.augtool(oper, key, value)
except:
- pass
+ try:
+ oper, key = line.split()
+ _functions.augtool(oper, key, "")
+ except:
+ pass
- logger.debug("Updating VLAN config")
- for line in self.VL_CONFIG.split("\n"):
- logger.debug(line)
- try:
- oper, key, value = line.split()
- _functions.augtool(oper, key, value)
- except:
+ logger.debug("Updating VLAN config")
+ for line in self.VL_CONFIG.split("\n"):
+ logger.debug(line)
try:
- oper, key = line.split()
- _functions.augtool(oper, key, "")
+ oper, key, value = line.split()
+ _functions.augtool(oper, key, value)
except:
- pass
+ try:
+ oper, key = line.split()
+ _functions.augtool(oper, key, "")
+ except:
+ pass
# preserve current MAC mappings for *all physical* network interfaces
logger.debug("Preserving current MAC mappings")
@@ -352,8 +358,12 @@
logger.debug("Storing %s" % nic)
_functions.ovirt_store_config("%s%s" % (self.IFSCRIPTS_PATH, nic))
_functions.ovirt_store_config(self.NTP_CONFIG_FILE)
- _functions.augtool("set", \
- "/files/etc/sysconfig/network/NETWORKING", "yes")
+ if self.disabled_nic == 1:
+ _functions.augtool("set", \
+ "/files/etc/sysconfig/network/NETWORKING", "no")
+ else:
+ _functions.augtool("set", \
+ "/files/etc/sysconfig/network/NETWORKING", "yes")
_functions.ovirt_store_config("/etc/sysconfig/network")
_functions.ovirt_store_config("/etc/hosts")
_functions.ovirt_store_config("/etc/udev/rules.d/" + \
--
To view, visit http://gerrit.ovirt.org/7420
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I610206ac8192d0c2f51ec1ff0e5415c7022420fb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>
More information about the node-patches
mailing list