CLOUDSTACK-2122. Virtual machine id should be a required parameter for 
findHostsForMigration api. Fixing it.


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

Branch: refs/heads/rbd-snap-clone
Commit: e520ff456801e9a7b57fe56ee78f4f649675c082
Parents: 107f492
Author: Devdeep Singh <devd...@gmail.com>
Authored: Fri May 17 17:01:17 2013 +0530
Committer: Devdeep Singh <devd...@gmail.com>
Committed: Fri May 17 17:01:17 2013 +0530

----------------------------------------------------------------------
 .../admin/host/FindHostsForMigrationCmd.java       |    2 +-
 .../src/com/cloud/server/ManagementServerImpl.java |    9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e520ff45/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
 
b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
index e6e45cc..b2d77b8 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
@@ -45,7 +45,7 @@ public class FindHostsForMigrationCmd extends BaseListCmd {
     /////////////////////////////////////////////////////
 
     @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, 
entityType = UserVmResponse.class,
-            required=false, description="find hosts to which this VM can be 
migrated and flag the hosts with enough " +
+            required=true, description="find hosts to which this VM can be 
migrated and flag the hosts with enough " +
                 "CPU/RAM to host the VM")
     private Long virtualMachineId;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e520ff45/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java 
b/server/src/com/cloud/server/ManagementServerImpl.java
index f74b7ad..06c0f96 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1086,17 +1086,16 @@ public class ManagementServerImpl extends ManagerBase 
implements ManagementServe
 
         VMInstanceVO vm = _vmInstanceDao.findById(vmId);
         if (vm == null) {
-            InvalidParameterValueException ex = new 
InvalidParameterValueException("Unable to find the VM with specified id");
-            ex.addProxyObject(vm, vmId, "vmId");
+            InvalidParameterValueException ex = new 
InvalidParameterValueException("Unable to find the VM with given id");
             throw ex;
         }
 
         if (vm.getState() != State.Running) {
             if (s_logger.isDebugEnabled()) {
-                s_logger.debug("VM is not Running, unable to migrate the vm" + 
vm);
+                s_logger.debug("VM is not running, cannot migrate the vm" + 
vm);
             }
-            InvalidParameterValueException ex = new 
InvalidParameterValueException("VM is not Running, unable to" +
-                    " migrate the vm with specified id");
+            InvalidParameterValueException ex = new 
InvalidParameterValueException("VM is not Running, cannot " +
+                    "migrate the vm with specified id");
             ex.addProxyObject(vm, vmId, "vmId");
             throw ex;
         }

Reply via email to