[node-patches] Change in ovirt-node[master]: tui: Convenience functions for net configuration
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Thu Jan 10 17:14:21 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: tui: Convenience functions for net configuration
......................................................................
tui: Convenience functions for net configuration
A couple of convenience functions were added to allow a better network
configuration without the need to know which values have to be set in
the defaults file.
Change-Id: Ie5b630dba4f431ff4d0d6d8c086828872bba8678
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/config/defaults.py
M scripts/tui/src/ovirt/node/setup/network_page.py
2 files changed, 23 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/84/10884/1
diff --git a/scripts/tui/src/ovirt/node/config/defaults.py b/scripts/tui/src/ovirt/node/config/defaults.py
index eb9e3a2..d1f5179 100644
--- a/scripts/tui/src/ovirt/node/config/defaults.py
+++ b/scripts/tui/src/ovirt/node/config/defaults.py
@@ -356,6 +356,23 @@
tx.append(ReloadNetworkConfiguration())
return tx
+ def configure_no_networking(self, iface=None):
+ """Can be used to disable all networking
+ """
+ iface = iface or self.retrieve()["iface"]
+ name = iface + "-DISABLED"
+ self.update(name, None, None, None, None, None)
+
+ def configure_dhcp(self, iface, vlanid=None):
+ """Can be used to configure NIC iface on the vlan vlanid with DHCP
+ """
+ self.update(iface, "dhcp", None, None, None, vlanid)
+
+ def configure_static(self, iface, ipaddr, netmask, gateway, vlanid):
+ """Can be used to configure a static IP on a NIC
+ """
+ self.update(iface, "static", ipaddr, netmask, gateway, vlanid)
+
class Hostname(NodeConfigFileSection):
"""Configure hostname
diff --git a/scripts/tui/src/ovirt/node/setup/network_page.py b/scripts/tui/src/ovirt/node/setup/network_page.py
index 58f97be..a2c99ec 100644
--- a/scripts/tui/src/ovirt/node/setup/network_page.py
+++ b/scripts/tui/src/ovirt/node/setup/network_page.py
@@ -25,6 +25,9 @@
import ovirt.node.setup.ping
"""
Network page plugin
+
+TODO use inotify+thread or so to monitor resolv.conf/ntp.conf for changes and
+ update UI
"""
@@ -344,14 +347,13 @@
iface = self._model_extra["dialog.nic.iface"]
if bootproto == "none":
self.logger.debug("Configuring no networking")
- name = iface + "-DISABLED"
- model.update(name, None, None, None, None, None)
+ model.configure_no_networking(iface)
elif bootproto == "dhcp":
self.logger.debug("Configuring dhcp")
- model.update(iface, "dhcp", None, None, None, vlanid)
+ model.configure_dhcp(iface, vlanid)
elif bootproto == "static":
self.logger.debug("Configuring static ip")
- model.update(iface, "static", ipaddr, netmask, gateway, vlanid)
+ model.configure_static(iface, ipaddr, netmask, gateway, vlanid)
else:
self.logger.debug("No interface configuration found")
# Return the resulting transaction
--
To view, visit http://gerrit.ovirt.org/10884
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5b630dba4f431ff4d0d6d8c086828872bba8678
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