[node-patches] Change in ovirt-node[master]: ui: Don't rely on OVIRT_BOOTIF
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Mon Feb 11 11:45:58 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: ui: Don't rely on OVIRT_BOOTIF
......................................................................
ui: Don't rely on OVIRT_BOOTIF
Previously the UI relied on OVIRT_BOOTIF to determin the primary
interface. This lead to problems because OVIRT_BOOTIF is erased at each
boot.
Now the primary interface is determined by looking at the system wide
ifcfg files.
Change-Id: I7ace62b39d37d2b81054ac8b676eb3448acb1c09
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/config/network.py
M scripts/tui/src/ovirt/node/setup/network_page.py
2 files changed, 36 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/20/11920/1
diff --git a/scripts/tui/src/ovirt/node/config/network.py b/scripts/tui/src/ovirt/node/config/network.py
index 8ce8482..754998e 100644
--- a/scripts/tui/src/ovirt/node/config/network.py
+++ b/scripts/tui/src/ovirt/node/config/network.py
@@ -19,10 +19,10 @@
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
from ovirt.node import utils, base
-from ovirt.node.config import defaults
from ovirt.node.utils import AugeasWrapper as Augeas
import logging
import os
+import glob
"""
Some convenience functions related to networking
@@ -188,6 +188,17 @@
return value
+def ifaces():
+ """Returns all configured ifaces
+ """
+ ifaces = []
+ filepath = "/etc/sysconfig/network-scripts/ifcfg-"
+ for fn in glob.glob("%s*" % filepath):
+ iface = fn[len(filepath):]
+ ifaces.append(iface)
+ return ifaces
+
+
def node_bridge():
"""Return the configured bridge
@@ -195,12 +206,23 @@
Ifname of a configured bridge or None if none is configured
"""
bridge = None
- model = defaults.Network()
- iface = model.retrieve()["iface"]
- vlan = model.retrieve()["vlanid"]
- if iface:
- if vlan is not None:
- iface = "%s.%s" % (iface, vlan)
+ for iface in ifaces():
nic = Ifcfg(iface)
- bridge = nic.bridge
+ if nic.type == u"Bridge":
+ bridge = iface
+ break
return bridge
+
+
+def node_bridge_slave():
+ """Returns the interface which is the slave of the configfured bridge
+ """
+ slave = None
+ bridge = node_bridge()
+ if bridge:
+ for iface in ifaces():
+ nic = Ifcfg(iface)
+ if nic.bridge == bridge:
+ slave = iface
+ break
+ return slave
diff --git a/scripts/tui/src/ovirt/node/setup/network_page.py b/scripts/tui/src/ovirt/node/setup/network_page.py
index a4233f6..29a8074 100644
--- a/scripts/tui/src/ovirt/node/setup/network_page.py
+++ b/scripts/tui/src/ovirt/node/setup/network_page.py
@@ -268,8 +268,12 @@
self.logger.debug("live: %s" % live)
self.logger.debug("cfg: %s" % cfg)
- if cfg["iface"] != iface:
- # create empty config if we are not editing the bootif
+ # The primary interface of this Node:
+ node_bridge_slave = config.network.node_bridge_slave()
+
+ if node_bridge_slave != iface:
+ # The config contains the information for the primary iface,
+ # because this iface is not the primary iface we clear the config
cfg = {k: "" for k in cfg.keys()}
ipaddr, netmask, gateway, vlanid = (cfg["ipaddr"], cfg["netmask"],
--
To view, visit http://gerrit.ovirt.org/11920
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ace62b39d37d2b81054ac8b676eb3448acb1c09
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
More information about the node-patches
mailing list