cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: updated refs/heads/master to f96b89f
Date Fri, 05 Jul 2013 10:03:33 GMT
Updated Branches:
  refs/heads/master 88f67c128 -> f96b89f25


CLOUDSTACK-3273: ClassCastException when adding cache store via API

Filter the detail map sent over the wire into Map<String, String> before
processing underneath by  storage life cycle

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


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

Branch: refs/heads/master
Commit: f96b89f25e59a92b4e92a07fc54c8e6a9177b6c7
Parents: 88f67c1
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Fri Jul 5 15:31:26 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Fri Jul 5 15:32:41 2013 +0530

----------------------------------------------------------------------
 .../admin/storage/CreateCacheStoreCmd.java      | 26 ++++++++++++++------
 .../image/datastore/ImageStoreHelper.java       |  2 +-
 tools/marvin/marvin/integration/lib/utils.py    |  8 ++----
 3 files changed, 22 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f96b89f2/api/src/org/apache/cloudstack/api/command/admin/storage/CreateCacheStoreCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateCacheStoreCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateCacheStoreCmd.java
index ff01a40..f94207f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateCacheStoreCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateCacheStoreCmd.java
@@ -18,22 +18,22 @@
  */
 package org.apache.cloudstack.api.command.admin.storage;
 
-import java.util.Map;
-
+import com.cloud.storage.ImageStore;
+import com.cloud.user.Account;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.BaseCmd.CommandType;
 import org.apache.cloudstack.api.response.ImageStoreResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.log4j.Logger;
 
-import com.cloud.exception.DiscoveryException;
-import com.cloud.storage.ImageStore;
-import com.cloud.user.Account;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
 
 @APICommand(name = "createCacheStore", description="create cache store.", responseObject=ImageStoreResponse.class)
 public class CreateCacheStoreCmd extends BaseCmd {
@@ -76,7 +76,19 @@ public class CreateCacheStoreCmd extends BaseCmd {
     }
 
      public Map<String, String> getDetails() {
-        return details;
+         Map<String, String> detailsMap = null;
+         if (details != null && !details.isEmpty()) {
+             detailsMap = new HashMap<String, String>();
+             Collection<?> props = details.values();
+             Iterator<?> iter = props.iterator();
+             while (iter.hasNext()) {
+                 HashMap<String, String> detail = (HashMap<String, String>) iter.next();
+                 String key = detail.get("key");
+                 String value = detail.get("value");
+                 detailsMap.put(key, value);
+             }
+         }
+         return detailsMap;
     }
 
     public String getScope() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f96b89f2/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java
b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java
index a2d61f9..a641146 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java
@@ -95,7 +95,7 @@ public class ImageStoreHelper {
         if (details != null) {
             Iterator<String> keyIter = details.keySet().iterator();
             while (keyIter.hasNext()) {
-                String key = keyIter.next();
+                String key = keyIter.next().toString();
                 ImageStoreDetailVO detail = new ImageStoreDetailVO();
                 detail.setStoreId(store.getId());
                 detail.setName(key);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f96b89f2/tools/marvin/marvin/integration/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py
index 9ab199a..4eca8ba 100644
--- a/tools/marvin/marvin/integration/lib/utils.py
+++ b/tools/marvin/marvin/integration/lib/utils.py
@@ -185,16 +185,12 @@ def get_process_status(hostip, port, username, password, linklocalip,
process, h
     return res
 
 
-def isAlmostEqual(self, first_digit, second_digit, range=0):
+def isAlmostEqual(first_digit, second_digit, range=0):
     digits_equal_within_range = False
 
     try:
         if ((first_digit - range) < second_digit < (first_digit + range)):
             digits_equal_within_range = True
-
     except Exception as e:
-        self.fail(
-            "%s: Failed while comparing the numbers %s & %s" %
-            (e, first_digit, second_digit))
-
+        raise e
     return digits_equal_within_range


Mime
View raw message