[node-patches] Change in ovirt-node[master]: ui: Don't assume a set BOOTIF
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Thu Jun 13 13:05:47 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: ui: Don't assume a set BOOTIF
......................................................................
ui: Don't assume a set BOOTIF
Previously the UI used the BOOTIF param to determin the primary
interface. Because this param is not always set (e.g. after
auto-install). There is now a logic which treis to detect the configured
(or primary) NIC.
Change-Id: Ib58a1dae6e36aa3b9c16bec66bfdd6eb56d05c9e
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/setup/core/logging_page.py
M src/ovirt/node/utils/network.py
2 files changed, 30 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/69/15669/1
diff --git a/src/ovirt/node/setup/core/logging_page.py b/src/ovirt/node/setup/core/logging_page.py
index 52da61a..270cd18 100644
--- a/src/ovirt/node/setup/core/logging_page.py
+++ b/src/ovirt/node/setup/core/logging_page.py
@@ -71,7 +71,9 @@
ui.Divider("divider[0]")
]
- if not utils.network.is_configured():
+ net_is_configured = utils.network.NodeNetwork().is_configured()
+
+ if not net_is_configured:
ws.extend([ui.Notice("network.notice",
"Networking is not configured, " +
"please configure it before rsyslog " +
@@ -81,17 +83,17 @@
ws.extend([ui.Label("rsyslog.header", "RSyslog is an enhanced multi-" +
"threaded syslogd"),
ui.Entry("rsyslog.address", "Server Address:",
- enabled=utils.network.is_configured()),
+ enabled=net_is_configured),
ui.Entry("rsyslog.port", "Server Port:",
- enabled=utils.network.is_configured()),
+ enabled=net_is_configured),
ui.Divider("divider[1]"),
ui.Label("netconsole.label",
"Netconsole service allows a remote sys" +
"log daemon to record printk() messages"),
ui.Entry("netconsole.address", "Server Address:",
- enabled=utils.network.is_configured()),
+ enabled=net_is_configured),
ui.Entry("netconsole.port", "Server Port:",
- enabled=utils.network.is_configured())
+ enabled=net_is_configured)
])
page = ui.Page("page", ws)
diff --git a/src/ovirt/node/utils/network.py b/src/ovirt/node/utils/network.py
index ce24b07..420deb6 100644
--- a/src/ovirt/node/utils/network.py
+++ b/src/ovirt/node/utils/network.py
@@ -523,6 +523,21 @@
return candidates
+ def configured_nic(self):
+ """Return the (probably) primary NIC of this system
+ We identify it by looking if a config exists
+ """
+ candidate = None
+ candidates = NodeNetwork().nics()
+ for nic in candidates.values():
+ if nic.is_configured():
+ candidate = nic
+ break
+ return candidate
+
+ def is_configured(self):
+ return self.configured_nic() is not None
+
class Routes(base.Base):
def default(self):
@@ -568,12 +583,16 @@
return socket.inet_ntop(family, packed)
-def networking_status(iface):
+def networking_status(ifname=None):
status = "Not connected"
+ nn = NodeNetwork()
+ nic = nn.build_nic_model(ifname) if ifname else nn.configured_nic()
+
addresses = []
- if iface:
- nic = NIC(iface)
+ if nic:
+ ifname = nic.ifname
+
addresses = nic.ip_addresses()
has_address = any([a is not None for a in addresses.values()])
@@ -582,7 +601,7 @@
if has_address:
status = "Connected"
- summary = (status, iface, addresses)
+ summary = (status, ifname, addresses)
LOGGER.debug(summary)
return summary
--
To view, visit http://gerrit.ovirt.org/15669
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib58a1dae6e36aa3b9c16bec66bfdd6eb56d05c9e
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