[node-patches] Change in ovirt-node[master]: network: Fix network layout selection

fabiand at fedoraproject.org fabiand at fedoraproject.org
Fri Jul 5 14:06:06 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: network: Fix network layout selection
......................................................................

network: Fix network layout selection

Previously the bridged layout could be set in the NIC details dialog,
but it couldn't be switched back to the direct (bridgeless) mode.
Now the bridged mode can be turned on and off as expected.

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/14/16514/1

diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 1e410f8..4b2f265 100644
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -552,16 +552,23 @@
     [('layout', 'bridged')]
     """
     keys = ("OVIRT_NETWORK_LAYOUT",)
-    known_layouts = ["bridged",
-                     # bridged way, a bridge is created for BOOTIF
 
-                     "direct"
-                     # The BOOTIF NIC is configured directly
-                     ]
+    # The BOOTIF NIC is configured directly
+    LAYOUT_DIRECT = "direct"
+
+    # bridged way, a bridge is created for BOOTIF
+    LAYOUT_BRIDGED = "bridged"
+
+    known_layouts = [LAYOUT_DIRECT,
+                     LAYOUT_BRIDGED]
+
+    default_layout = LAYOUT_DIRECT
 
     @NodeConfigFileSection.map_and_update_defaults_decorator
-    def update(self, layout):
-        assert layout in self.known_layouts
+    def update(self, layout=None):
+        if layout == self.default_layout:
+            layout = None
+        assert layout in self.known_layouts + [None]
 
     def configure_bridged(self):
         return self.update("bridged")
diff --git a/src/ovirt/node/setup/core/network_page.py b/src/ovirt/node/setup/core/network_page.py
index 1656e6b..b3f7aab 100644
--- a/src/ovirt/node/setup/core/network_page.py
+++ b/src/ovirt/node/setup/core/network_page.py
@@ -284,11 +284,9 @@
             self.application.notice("Flashing lights now")
             return
 
-        e_changes_h = plugins.Changeset(effective_changes)
-
         nameservers = []
         dns_keys = ["dns[0]", "dns[1]"]
-        if e_changes_h.contains_any(dns_keys):
+        if effective_changes.contains_any(dns_keys):
             nameservers += effective_model.values_for(dns_keys)
         if nameservers:
             self.logger.info("Setting new nameservers: %s" % nameservers)
@@ -298,7 +296,7 @@
 
         timeservers = []
         ntp_keys = ["ntp[0]", "ntp[1]"]
-        if e_changes_h.contains_any(ntp_keys):
+        if effective_changes.contains_any(ntp_keys):
             timeservers += effective_model.values_for(ntp_keys)
         if timeservers:
             self.logger.info("Setting new timeservers: %s" % timeservers)
@@ -307,7 +305,7 @@
             txs += model.transaction()
 
         hostname_keys = ["hostname"]
-        if e_changes_h.contains_any(hostname_keys):
+        if effective_changes.contains_any(hostname_keys):
             value = effective_model.values_for(hostname_keys)
             self.logger.info("Setting new hostname: %s" % value)
             model = defaults.Hostname()
@@ -315,7 +313,7 @@
             txs += model.transaction()
 
         # For the NIC details dialog:
-        if e_changes_h.contains_any(self._nic_details_group):
+        if effective_changes.contains_any(self._nic_details_group):
             # If any networking related key was changed, reconfigure networking
             # Fetch the values for the nic keys, they are used as arguments
             args = effective_model.values_for(self._nic_details_group)
@@ -364,7 +362,7 @@
         else:
             self.logger.debug("No ipv4 interface configuration found")
 
-        # A hack to also set the BOOTIF when IPv& is used in a second
+        # A hack to also set the BOOTIF when IPv6 is used in a second
         enable_bootif = lambda: model.update(iface=iface)
 
         if ipv6_bootproto == "none":
@@ -392,6 +390,8 @@
         mt = defaults.NetworkLayout()
         if layout_bridged:
             mt.configure_bridged()
+        else:
+            mt.configure_direct()
 
         # Return the resulting transaction
         txs = model.transaction()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib70c81ca70abeb84393e2a88b2287b8e208d2104
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