cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 5f04aa5
Date Wed, 26 Aug 2015 10:38:57 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master e2a0d18a8 -> 5f04aa568


CLOUDSTACK-8721: Fixed Setting details of VM through API results in removal of all other details
except the one passed in API


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

Branch: refs/heads/master
Commit: 728635a3d3c4a4080ebcbcfbee54c0450b10012d
Parents: cd02a59
Author: Anshul Gangwar <anshul.gangwar@citrix.com>
Authored: Mon Aug 10 16:13:42 2015 +0530
Committer: Anshul Gangwar <anshul.gangwar@citrix.com>
Committed: Mon Aug 10 16:14:04 2015 +0530

----------------------------------------------------------------------
 .../cloudstack/api/command/user/vm/UpdateVMCmd.java       |  8 ++++----
 server/src/com/cloud/vm/UserVmManagerImpl.java            | 10 ++++++++--
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/728635a3/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
index 6954832..458122d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
@@ -94,7 +94,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
     private String instanceName;
 
     @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details
in key/value pairs.")
-    protected Map details;
+    protected Map<String, String> details;
 
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
@@ -136,13 +136,13 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
         return instanceName;
     }
 
-    public Map getDetails() {
+    public Map<String, String> getDetails() {
         if (this.details == null || this.details.isEmpty()) {
             return null;
         }
 
-        Collection paramsCollection = this.details.values();
-        return (Map) (paramsCollection.toArray())[0];
+        Collection<String> paramsCollection = this.details.values();
+        return (Map<String, String>) (paramsCollection.toArray())[0];
     }
 
 /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/728635a3/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index a3f4b82..248c6f2 100644
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2147,7 +2147,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         String userData = cmd.getUserData();
         Boolean isDynamicallyScalable = cmd.isDynamicallyScalable();
         String hostName = cmd.getHostName();
-        Map details = cmd.getDetails();
+        Map<String,String> details = cmd.getDetails();
         Account caller = CallContext.current().getCallingAccount();
 
         // Input validation and permission checks
@@ -2188,7 +2188,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         }
 
         if (details != null && !details.isEmpty()) {
-            vmInstance.setDetails(details);
+            _vmDao.loadDetails(vmInstance);
+
+            for(Map.Entry<String,String> entry : details.entrySet()) {
+                if(entry instanceof Map.Entry) {
+                    vmInstance.setDetail(entry.getKey(), entry.getValue());
+                }
+            }
             _vmDao.saveDetails(vmInstance);
         }
 


Mime
View raw message