[node-patches] Change in ovirt-node[master]: network: Allow setting a static IP

fabiand at fedoraproject.org fabiand at fedoraproject.org
Fri Oct 19 11:01:50 UTC 2012


Fabian Deutsch has uploaded a new change for review.

Change subject: network: Allow setting a static IP
......................................................................

network: Allow setting a static IP

Previously the information to do static IP configuration didn't get it
into the configuring component. Now the information is set correctly in
/etc/defaults/ovirt.

rhbz#867784

Change-Id: Icdd0888977ec808b54bdc801e418e6bf16c2cd99
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/ovirt-config-setup.py
1 file changed, 31 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/73/8673/1

diff --git a/scripts/ovirt-config-setup.py b/scripts/ovirt-config-setup.py
index 1180bf2..3c0ce97 100755
--- a/scripts/ovirt-config-setup.py
+++ b/scripts/ovirt-config-setup.py
@@ -1566,16 +1566,6 @@
                     msg += "  - IPv4 Netmask Address\n"
                 if self.ipv4_netdevgateway.value() == "":
                     msg += "  - IPv4 Gateway Address\n"
-                if msg == "":
-                    augtool("set", "/files/" + OVIRT_DEFAULTS +
-                            "/OVIRT_IP_ADDRESS", '"' +
-                            self.ipv4_netdevip.value() + '"')
-                    augtool("set", "/files/" + OVIRT_DEFAULTS +
-                            "/OVIRT_IP_NETMASK", '"' +
-                            self.ipv4_netdevmask.value() + '"')
-                    augtool("set", "/files/" + OVIRT_DEFAULTS +
-                            "/OVIRT_IP_GATEWAY", '"' +
-                            self.ipv4_netdevgateway.value() + '"')
 
             if self.static_ipv6_nic_proto.value() == 1:
                 if self.ipv6_netdevmask.value() == "":
@@ -1595,24 +1585,25 @@
                                                 self.ipv4_netdevgateway.value()
                 self.reset_screen_colors()
                 return
-            else:
-                # if exists remove static keys from dictionary
-                if "OVIRT_IP_ADDRESS" in OVIRT_VARS:
-                    del OVIRT_VARS["OVIRT_IP_ADDRESS"]
-                if "OVIRT_IP_NETMASK" in OVIRT_VARS:
-                    del OVIRT_VARS["OVIRT_IP_NETMASK"]
-                if "OVIRT_IP_GATEWAY" in OVIRT_VARS:
-                    del OVIRT_VARS["OVIRT_IP_GATEWAY"]
-                if "OVIRT_IPV6" in OVIRT_VARS:
-                    del OVIRT_VARS["OVIRT_IPV6"]
-                if "OVIRT_ADDRESS" in OVIRT_VARS:
-                    del OVIRT_VARS["OVIRT_IPV6_ADDRESS"]
-                if "OVIRT_IPV6_NETMASK" in OVIRT_VARS:
-                    del OVIRT_VARS["OVIRT_IPV6_NETMASK"]
-                if "OVIRT_IPV6_GATEWAY" in OVIRT_VARS:
-                    del OVIRT_VARS["OVIRT_IPV6_GATEWAY"]
-                if "OVIRT_VLAN" in OVIRT_VARS:
-                    del OVIRT_VARS["OVIRT_VLAN"]
+
+            # If we are here: All checks passed, let's clean and set new values
+            # clean: if exists remove static keys from dictionary
+            if "OVIRT_IP_ADDRESS" in OVIRT_VARS:
+                del OVIRT_VARS["OVIRT_IP_ADDRESS"]
+            if "OVIRT_IP_NETMASK" in OVIRT_VARS:
+                del OVIRT_VARS["OVIRT_IP_NETMASK"]
+            if "OVIRT_IP_GATEWAY" in OVIRT_VARS:
+                del OVIRT_VARS["OVIRT_IP_GATEWAY"]
+            if "OVIRT_IPV6" in OVIRT_VARS:
+                del OVIRT_VARS["OVIRT_IPV6"]
+            if "OVIRT_ADDRESS" in OVIRT_VARS:
+                del OVIRT_VARS["OVIRT_IPV6_ADDRESS"]
+            if "OVIRT_IPV6_NETMASK" in OVIRT_VARS:
+                del OVIRT_VARS["OVIRT_IPV6_NETMASK"]
+            if "OVIRT_IPV6_GATEWAY" in OVIRT_VARS:
+                del OVIRT_VARS["OVIRT_IPV6_GATEWAY"]
+            if "OVIRT_VLAN" in OVIRT_VARS:
+                del OVIRT_VARS["OVIRT_VLAN"]
 
             gridform = GridForm(self.screen, "", 2, 2)
             gridform.add(Label("Configuring Networking"), 0, 0)
@@ -1642,6 +1633,18 @@
             augtool("rm", "/files/" + OVIRT_DEFAULTS +
                     "/OVIRT_IPV6_GATEWAY", "")
 
+            # ... set new values:
+            if self.static_ipv4_nic_proto.value() == 1:
+                augtool("set", "/files/" + OVIRT_DEFAULTS +
+                        "/OVIRT_IP_ADDRESS", '"' +
+                        self.ipv4_netdevip.value() + '"')
+                augtool("set", "/files/" + OVIRT_DEFAULTS +
+                        "/OVIRT_IP_NETMASK", '"' +
+                        self.ipv4_netdevmask.value() + '"')
+                augtool("set", "/files/" + OVIRT_DEFAULTS +
+                        "/OVIRT_IP_GATEWAY", '"' +
+                        self.ipv4_netdevgateway.value() + '"')
+
             if self.netvlanid.value() != "":
                 augtool("set", "/files/" + OVIRT_DEFAULTS + "/OVIRT_VLAN",
                         '"' + self.netvlanid.value() + '"')


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

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