You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/07/05 12:03:21 UTC
git commit: updated refs/heads/4.2 to e0e8cb0
Updated Branches:
refs/heads/4.2 bccf5d8ea -> e0e8cb0d9
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 <ts...@apache.org>
(cherry picked from commit f96b89f25e59a92b4e92a07fc54c8e6a9177b6c7)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e0e8cb0d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e0e8cb0d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e0e8cb0d
Branch: refs/heads/4.2
Commit: e0e8cb0d96275f8d87d0598450016c19e05ef9e8
Parents: bccf5d8
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Fri Jul 5 15:31:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Fri Jul 5 15:33:10 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/e0e8cb0d/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/e0e8cb0d/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/e0e8cb0d/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