cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [25/50] [abbrv] git commit: updated refs/heads/feature/systemvm-persistent-config to 4fe7264
Date Wed, 04 Feb 2015 20:28:45 GMT
Fix: the update_config.py was not parsing the incoming guest net configuration properly

Added comments to the CitrixResourceBase class: do not destroy the cd-rom


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b45aa8d8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b45aa8d8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b45aa8d8

Branch: refs/heads/feature/systemvm-persistent-config
Commit: b45aa8d840e10867cbbb7c93e789792f2f978156
Parents: 1a81bbf
Author: wilderrodrigues <wrodrigues@schubergphilis.com>
Authored: Sat Jan 17 19:50:40 2015 +0100
Committer: wilderrodrigues <wrodrigues@schubergphilis.com>
Committed: Wed Feb 4 18:47:07 2015 +0100

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java  |  1 +
 .../config/opt/cloud/bin/update_config.py       | 61 +++++++++-----------
 2 files changed, 29 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b45aa8d8/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index e49f109..6f5d5c0 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -1612,6 +1612,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
             if (result != null) {
                 return new CheckSshAnswer(cmd, "Can not ping System vm " + vmName + "due
to:" + result);
             }
+            //Do not destroy the disk here! It will stio the patching process. Please, don't!
             //destroyPatchVbd(conn, vmName);
         } catch (final Exception e) {
             return new CheckSshAnswer(cmd, e);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b45aa8d8/systemvm/patches/debian/config/opt/cloud/bin/update_config.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/update_config.py b/systemvm/patches/debian/config/opt/cloud/bin/update_config.py
index 8bb5916..ea21455 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/update_config.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/update_config.py
@@ -51,52 +51,46 @@ def process_file():
     # Converge
     finish_config()
 
-def is_guestnet_configured(guestnet_dict, key):
+def is_guestnet_configured(guestnet_dict, keys):
     
-    existing_key = None
+    existing_keys = []
     new_eth_key = None
     
-    for k1, v in guestnet_dict.iteritems():
-        for k2 in key:
-            if k1 == k2 and len(guestnet_dict[k1]) > 0:
-                existing_key = k1
-        if existing_key:
-            break
-    
-    if not existing_key:
-        return False
+    for k1, v1 in guestnet_dict.iteritems():
+        if k1 in keys and len(v1) > 0:
+            existing_keys.append(k1)
     
     file = open(jsonCmdConfigPath)
     new_guestnet_dict = json.load(file)
     
-    for k1, v in new_guestnet_dict.iteritems():
-        for k2 in key:
-            if k1 == k2 and len(new_guestnet_dict[k1]) > 0:
-                new_eth_key = k1
-        if new_eth_key:
-            break
+    '''
+    Check if we have a new guest network ready to be setup
+    '''
+    device = new_guestnet_dict['device']
     
-    if not new_eth_key:
+    if device in existing_keys:
         '''
-        Why is the new guest net dictionary empty?
-          1. Might be a bug on the Java side.
-        Return True so we won't process an empty file. However, we have to investigate it!
+        Device already configured, ignore.
         '''
         return True
-
-    old_eth = guestnet_dict[existing_key][0]
-    new_eth = new_guestnet_dict[new_eth_key][0]
     
-    new_mac = new_eth["mac_address"].encode('utf-8')
-    old_mac = old_eth["mac_address"].encode('utf-8')
-    new_ip = new_eth["router_guest_ip"].encode('utf-8')
-    old_ip = old_eth["router_guest_ip"].encode('utf-8')
+    exists = False
     
-    if (new_mac == old_mac) and (new_ip == old_ip):
-        print "[WARN] Guest Network already configured. Will skip the file to avoid RTNETLINK
errors."
-        return True
+    for key in existing_keys:
+        for interface in guestnet_dict[key]:
+            new_mac = new_guestnet_dict["mac_address"].encode('utf-8')
+            old_mac = interface["mac_address"].encode('utf-8')
+            new_ip = new_guestnet_dict["router_guest_ip"].encode('utf-8')
+            old_ip = interface["router_guest_ip"].encode('utf-8')
     
-    return False
+            if (new_mac == old_mac) and (new_ip == old_ip):
+                exists = True
+                break
+        
+        if exists:
+            break
+        
+    return exists
 
 if not (os.path.isfile(jsonCmdConfigPath) and os.access(jsonCmdConfigPath, os.R_OK)):
     print "[ERROR]: You are telling me to process %s, but i can't access it" % jsonCmdConfigPath
@@ -115,7 +109,8 @@ if sys.argv[1] == "guest_network.json":
         file = open(currentGuestNetConfig)
         guestnet_dict = json.load(file)
     
-        if not is_guestnet_configured(guestnet_dict, ['eth1', 'eth2', 'eth3', 'eth4', 'eth5']):
+        if not is_guestnet_configured(guestnet_dict, ['eth1', 'eth2', 'eth3', 'eth4', 'eth5',
'eth6', 'eth7', 'eth8', 'eth9']):
+            print "[INFO] Processing Guest Network."
             process_file()
         else:
             print "[INFO] No need to process Guest Network."


Mime
View raw message