File tree Expand file tree Collapse file tree
api/src/org/apache/cloudstack/api/command/user/vm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
9494 private String instanceName ;
9595
9696 @ Parameter (name = ApiConstants .DETAILS , type = CommandType .MAP , description = "Details in key/value pairs." )
97- protected Map details ;
97+ protected Map < String , String > details ;
9898
9999 /////////////////////////////////////////////////////
100100 /////////////////// Accessors ///////////////////////
@@ -136,13 +136,13 @@ public String getInstanceName() {
136136 return instanceName ;
137137 }
138138
139- public Map getDetails () {
139+ public Map < String , String > getDetails () {
140140 if (this .details == null || this .details .isEmpty ()) {
141141 return null ;
142142 }
143143
144- Collection paramsCollection = this .details .values ();
145- return (Map ) (paramsCollection .toArray ())[0 ];
144+ Collection < String > paramsCollection = this .details .values ();
145+ return (Map < String , String > ) (paramsCollection .toArray ())[0 ];
146146 }
147147
148148/////////////////////////////////////////////////////
Original file line number Diff line number Diff line change @@ -2147,7 +2147,7 @@ public UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableEx
21472147 String userData = cmd .getUserData ();
21482148 Boolean isDynamicallyScalable = cmd .isDynamicallyScalable ();
21492149 String hostName = cmd .getHostName ();
2150- Map details = cmd .getDetails ();
2150+ Map < String , String > details = cmd .getDetails ();
21512151 Account caller = CallContext .current ().getCallingAccount ();
21522152
21532153 // Input validation and permission checks
@@ -2188,7 +2188,13 @@ public UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableEx
21882188 }
21892189
21902190 if (details != null && !details .isEmpty ()) {
2191- vmInstance .setDetails (details );
2191+ _vmDao .loadDetails (vmInstance );
2192+
2193+ for (Map .Entry <String ,String > entry : details .entrySet ()) {
2194+ if (entry instanceof Map .Entry ) {
2195+ vmInstance .setDetail (entry .getKey (), entry .getValue ());
2196+ }
2197+ }
21922198 _vmDao .saveDetails (vmInstance );
21932199 }
21942200
You can’t perform that action at this time.
0 commit comments