mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8721: Fixed Setting details of VM through API results in removal of all other details except the one passed in API
This commit is contained in:
parent
cd02a59841
commit
728635a3d3
@ -94,7 +94,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
|
|||||||
private String instanceName;
|
private String instanceName;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs.")
|
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs.")
|
||||||
protected Map details;
|
protected Map<String, String> details;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
@ -136,13 +136,13 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
|
|||||||
return instanceName;
|
return instanceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getDetails() {
|
public Map<String, String> getDetails() {
|
||||||
if (this.details == null || this.details.isEmpty()) {
|
if (this.details == null || this.details.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection paramsCollection = this.details.values();
|
Collection<String> paramsCollection = this.details.values();
|
||||||
return (Map) (paramsCollection.toArray())[0];
|
return (Map<String, String>) (paramsCollection.toArray())[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -2147,7 +2147,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
String userData = cmd.getUserData();
|
String userData = cmd.getUserData();
|
||||||
Boolean isDynamicallyScalable = cmd.isDynamicallyScalable();
|
Boolean isDynamicallyScalable = cmd.isDynamicallyScalable();
|
||||||
String hostName = cmd.getHostName();
|
String hostName = cmd.getHostName();
|
||||||
Map details = cmd.getDetails();
|
Map<String,String> details = cmd.getDetails();
|
||||||
Account caller = CallContext.current().getCallingAccount();
|
Account caller = CallContext.current().getCallingAccount();
|
||||||
|
|
||||||
// Input validation and permission checks
|
// Input validation and permission checks
|
||||||
@ -2188,7 +2188,13 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (details != null && !details.isEmpty()) {
|
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);
|
_vmDao.saveDetails(vmInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user