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

This commit is contained in:
Devdeep Singh 2013-05-17 17:01:17 +05:30
parent 107f492475
commit e520ff4568
2 changed files with 5 additions and 6 deletions

View File

@ -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;

View File

@ -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;
}