From e520ff456801e9a7b57fe56ee78f4f649675c082 Mon Sep 17 00:00:00 2001 From: Devdeep Singh Date: Fri, 17 May 2013 17:01:17 +0530 Subject: [PATCH] CLOUDSTACK-2122. Virtual machine id should be a required parameter for findHostsForMigration api. Fixing it. --- .../api/command/admin/host/FindHostsForMigrationCmd.java | 2 +- server/src/com/cloud/server/ManagementServerImpl.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) 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 e6e45cc7246..b2d77b85dd2 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; diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index f74b7ad964c..06c0f964ccb 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; }