[node-patches] Change in ovirt-node[node-3.0]: setup: Disable network page when managed

fabiand at fedoraproject.org fabiand at fedoraproject.org
Wed Mar 5 11:27:19 UTC 2014


Fabian Deutsch has uploaded a new change for review.

Change subject: setup: Disable network page when managed
......................................................................

setup: Disable network page when managed

Previously the suer could edit the network connections even when the
system was managed.
This could lead to problems when the management instance did a network
configuration which wasn'tunderstood by the TUI.
To prevent these kind of problems the NIC details dialog is now disabled
when any NIC on the Node is managed.

Change-Id: Ia0ec61ec3c655fea0b8274519e105e4c7a74409f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1065385
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/config/defaults.py
M src/ovirt/node/plugins.py
M src/ovirt/node/setup/core/network_page.py
3 files changed, 30 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/00/25400/1

diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 68e4496..ad9fb5b 100644
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -1530,3 +1530,9 @@
 
     def transaction(self):
         return None
+
+    def is_managed(self):
+        return True if self.retrieve()["managed_by"] else False
+
+    def has_managed_ifnames(self):
+        return True if self.retrieve()["managed_ifnames"] else False
diff --git a/src/ovirt/node/plugins.py b/src/ovirt/node/plugins.py
index 282f5b5..cb8ae6f 100644
--- a/src/ovirt/node/plugins.py
+++ b/src/ovirt/node/plugins.py
@@ -488,7 +488,7 @@
         self.add(widgets)
 
     def subset(self, paths):
-        return [self[p] for p in paths]
+        return [self[p] for p in paths if p in self]
 
     def group(self, paths):
         """Group the specified (by-path) widgets
diff --git a/src/ovirt/node/setup/core/network_page.py b/src/ovirt/node/setup/core/network_page.py
index 34d5781..0751945 100644
--- a/src/ovirt/node/setup/core/network_page.py
+++ b/src/ovirt/node/setup/core/network_page.py
@@ -32,6 +32,13 @@
 """
 
 
+def has_managed_ifnames():
+    """Determin if any NIC is managed
+    """
+    mgmt = defaults.Management()
+    return mgmt.has_managed_ifnames()
+
+
 class NicTable(ui.Table):
     def __init__(self, path, height=3, multi=False):
         header = "Device  Status       Model         MAC Address"
@@ -54,7 +61,10 @@
         for name, nic in sorted(model.nics().items()):
             if first_nic is None:
                 first_nic = name
-            is_cfg = "Configured" if nic.is_configured() else "Unconfigured"
+            if has_managed_ifnames():
+                is_cfg = "Managed"
+            else:
+                is_cfg = "Configured" if nic.is_configured() else "Unconfigured"
             description = " ".join([justify(nic.ifname, 7),
                                     justify(is_cfg, 12),
                                     justify(nic.vendor, 13),
@@ -183,6 +193,18 @@
         page = ui.Page("page", ws)
         # Save it "locally" as a dict, for better accessability
         self.widgets.add(page)
+
+        #
+        # NIC Deatils Dialog and Bond creation is disabled
+        # when Node is managed
+        #
+        if has_managed_ifnames():
+            self._nic_details_group.enabled(False)
+            self.widgets["button.toggle_bond"].enabled(False)
+            nictbl = self.widgets["nics"]
+            nictbl.on_activate.clear()
+            nictbl.label(nictbl.label() + " (read-only/managed)")
+
         return page
 
     def _build_dialog(self, path, txt, widgets):


-- 
To view, visit http://gerrit.ovirt.org/25400
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0ec61ec3c655fea0b8274519e105e4c7a74409f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: node-3.0
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list