Skip to content

Commit e520ff4

Browse files
committed
CLOUDSTACK-2122. Virtual machine id should be a required parameter for findHostsForMigration api. Fixing it.
1 parent 107f492 commit e520ff4

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

‎api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class FindHostsForMigrationCmd extends BaseListCmd {
4545
/////////////////////////////////////////////////////
4646

4747
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
48-
required=false, description="find hosts to which this VM can be migrated and flag the hosts with enough " +
48+
required=true, description="find hosts to which this VM can be migrated and flag the hosts with enough " +
4949
"CPU/RAM to host the VM")
5050
private Long virtualMachineId;
5151

‎server/src/com/cloud/server/ManagementServerImpl.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,17 +1086,16 @@ public Pair<List<? extends Host>, Integer> searchForServers(ListHostsCmd cmd) {
10861086

10871087
VMInstanceVO vm = _vmInstanceDao.findById(vmId);
10881088
if (vm == null) {
1089-
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find the VM with specified id");
1090-
ex.addProxyObject(vm, vmId, "vmId");
1089+
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find the VM with given id");
10911090
throw ex;
10921091
}
10931092

10941093
if (vm.getState() != State.Running) {
10951094
if (s_logger.isDebugEnabled()) {
1096-
s_logger.debug("VM is not Running, unable to migrate the vm" + vm);
1095+
s_logger.debug("VM is not running, cannot migrate the vm" + vm);
10971096
}
1098-
InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Running, unable to" +
1099-
" migrate the vm with specified id");
1097+
InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Running, cannot " +
1098+
"migrate the vm with specified id");
11001099
ex.addProxyObject(vm, vmId, "vmId");
11011100
throw ex;
11021101
}

0 commit comments

Comments
 (0)