BryanMLima commented on code in PR #6491:
URL: https://github.com/apache/cloudstack/pull/6491#discussion_r910280121


##########
api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java:
##########
@@ -152,20 +153,17 @@ public ApiCommandResourceType getApiResourceType() {
     @Override
     public void execute() {
         if (hostId == null && MapUtils.isEmpty(migrateVolumeTo)) {
-            throw new InvalidParameterValueException(String.format("Either %s 
or %s  must be passed for migrating the VM", ApiConstants.HOST_ID, 
ApiConstants.MIGRATE_TO));
-        }
-
-        UserVm userVm = _userVmService.getUserVm(getVirtualMachineId());
-        if (userVm == null) {
-            throw new InvalidParameterValueException("Unable to find the VM by 
id=" + getVirtualMachineId());
+            throw new InvalidParameterValueException(String.format("Either %s 
or %s  must be passed for migrating the VM.", ApiConstants.HOST_ID, 
ApiConstants.MIGRATE_TO));
         }
 
+        VirtualMachine userVm = _userVmService.getVm(getVirtualMachineId());
         if (!VirtualMachine.State.Running.equals(userVm.getState()) && hostId 
!= null) {
-            throw new InvalidParameterValueException(String.format("VM ID: %s 
is not in Running state to migrate it to new host", userVm.getUuid()));
+            throw new InvalidParameterValueException(String.format("VM [%s] is 
not in the Running state to migrate it to the new host.", userVm));

Review Comment:
   You are correct, I made the change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to