[node-patches] Change in ovirt-node[master]: ui: Only fully populate the primary NIC

fabiand at fedoraproject.org fabiand at fedoraproject.org
Thu Sep 19 10:06:22 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: ui: Only fully populate the primary NIC
......................................................................

ui: Only fully populate the primary NIC

Previously informations about the configuration (e.g. IPv6 Addr., bridge
layout, ...) were also shown in the non-configured/non-primary NIC
fields (within the NIC details dialog).
Now only the fields of the primary/configured NIC are populated with the
configuration data.

Change-Id: I37abd1b1055e086ad252e03b04fa717a6c8f4b6f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1002832
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1007148
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/setup/core/network_page.py
1 file changed, 26 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/82/19382/1

diff --git a/src/ovirt/node/setup/core/network_page.py b/src/ovirt/node/setup/core/network_page.py
index 2bfd22d..f76464c 100644
--- a/src/ovirt/node/setup/core/network_page.py
+++ b/src/ovirt/node/setup/core/network_page.py
@@ -446,21 +446,23 @@
 
         is_primary_interface = model["iface"] == ifname
 
-        if not is_primary_interface:
-            # The config contains the information for the primary ifnamee,
-            # because this ifnamee is not the primaryifnameme we clear the
-            # config
-            model = dict((k, "") for k in model.keys())
+        link_status_txt = ("Connected" if nic.has_link()
+                           else "Disconnected")
+        vendor_txt = nic.vendor[:24] if nic.vendor else ""
 
-        ipaddr, netmask, gateway, vlanid = (model["ipaddr"], model["netmask"],
-                                            model["gateway"], model["vlanid"])
-
-        ip6addr, ip6netmask, ip6gateway, ip6bootproto = (ip6model["ipaddr"],
-                                                         ip6model["netmask"],
-                                                         ip6model["gateway"],
-                                                         ip6model["bootproto"])
+        self.plugin._model_extra.update({
+            "dialog.nic.driver": nic.driver,
+            "dialog.nic.vendor": vendor_txt,
+            "dialog.nic.link_status": link_status_txt,
+            "dialog.nic.hwaddress": nic.hwaddr,
+        })
 
         bootproto = model["bootproto"]
+        ipaddr = model["ipaddr"]
+        netmask = model["netmask"]
+        gateway =model["gateway"]
+        vlanid = model["vlanid"]
+
         if model["bootproto"] == "dhcp":
             if nic.exists():
                 routes = utils.network.Routes()
@@ -471,27 +473,24 @@
             if ipaddr:
                 bootproto = "static"
 
-        link_status_txt = ("Connected" if nic.has_link()
-                           else "Disconnected")
-        vendor_txt = nic.vendor[:24] if nic.vendor else ""
-
-        self.plugin._model_extra.update({
-            "dialog.nic.driver": nic.driver,
-            "dialog.nic.vendor": vendor_txt,
-            "dialog.nic.link_status": link_status_txt,
-            "dialog.nic.hwaddress": nic.hwaddr,
-
+        nicfields = {
             "dialog.nic.ipv4.bootproto": bootproto,
             "dialog.nic.ipv4.address": ipaddr,
             "dialog.nic.ipv4.netmask": netmask,
             "dialog.nic.ipv4.gateway": gateway,
-            "dialog.nic.ipv6.bootproto": ip6bootproto,
-            "dialog.nic.ipv6.address": ip6addr,
-            "dialog.nic.ipv6.netmask": ip6netmask,
-            "dialog.nic.ipv6.gateway": ip6gateway,
+            "dialog.nic.ipv6.bootproto": ip6model["bootproto"],
+            "dialog.nic.ipv6.address": ip6model["ipaddr"],
+            "dialog.nic.ipv6.netmask": ip6model["netmask"],
+            "dialog.nic.ipv6.gateway": ip6model["gateway"],
             "dialog.nic.vlanid": vlanid,
             "dialog.nic.layout_bridged": m_layout["layout"] == "bridged",
-        })
+        }
+        self.plugin._model_extra.update(nicfields)
+
+        if not is_primary_interface:
+            # Unset all NIC fields. Because their values are only relevant
+            # for the primary interface
+            self.plugin._model_extra.update(dict.fromkeys(nicfields.keys()))
 
         self.logger.debug("model: %s" % self.plugin.model())
 


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

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