cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From likit...@apache.org
Subject git commit: updated refs/heads/master to 6a4a11e
Date Wed, 13 Aug 2014 11:05:14 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 4c4d89f4d -> 6a4a11ed7


CLOUDSTACK-7334. [VMware] AddHost command fails if there is a space in the VMware DC/Cluster
name.
URL decode vCenter path during cluster discovery.


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

Branch: refs/heads/master
Commit: 6a4a11ed71fe37e0b100303ceca897f33687a4d8
Parents: 4c4d89f
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Wed Feb 5 10:52:05 2014 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Wed Aug 13 16:24:14 2014 +0530

----------------------------------------------------------------------
 .../vmware/VmwareServerDiscoverer.java          | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a4a11ed/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
index e0c1931..0916813 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -68,6 +68,7 @@ import org.apache.log4j.Logger;
 import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
+import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URLDecoder;
 import java.util.HashMap;
@@ -150,10 +151,14 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
Discoverer
                 _clusterDetailsDao.persist(clusterId, clusterDetails);
             }
             String updatedInventoryPath = validateCluster(url, vmwareDc);
-            if (!url.getPath().equals(updatedInventoryPath)) {
-                // If url from API doesn't specify DC then update url in database with DC
associated with this zone.
-                clusterDetails.put("url", url.getScheme() + "://" + url.getHost() + updatedInventoryPath);
-                _clusterDetailsDao.persist(clusterId, clusterDetails);
+            try {
+                if (!URLDecoder.decode(url.getPath(), "UTF-8").equals(updatedInventoryPath))
{
+                    // If url from API doesn't specify DC then update url in database with
DC associated with this zone.
+                    clusterDetails.put("url", url.getScheme() + "://" + url.getHost() + updatedInventoryPath);
+                    _clusterDetailsDao.persist(clusterId, clusterDetails);
+                }
+            } catch(UnsupportedEncodingException e) {
+                throw new DiscoveredWithErrorException("Unable to decode URL path, URL path
: " + url.getPath(), e);
             }
         } else {
             // For legacy zones insist on the old model of asking for credentials for each
cluster being added.
@@ -455,12 +460,17 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
Discoverer
         String vmwareDcNameFromDb;
         String vmwareDcNameFromApi;
         String vCenterHost;
-        String updatedInventoryPath = url.getPath();
+        String updatedInventoryPath;
         String clusterName = null;
+        String inventoryPath;
 
         vmwareDcNameFromApi = vmwareDcNameFromDb = vmwareDc.getVmwareDatacenterName();
         vCenterHost = vmwareDc.getVcenterHost();
-        String inventoryPath = url.getPath();
+        try {
+            inventoryPath = updatedInventoryPath = URLDecoder.decode(url.getPath(), "UTF-8");
+        } catch(UnsupportedEncodingException e) {
+            throw new DiscoveredWithErrorException("Unable to decode URL path, URL path :
" + url.getPath(), e);
+        }
 
         assert (inventoryPath != null);
 


Mime
View raw message