fixed a class cast exception

This commit is contained in:
Alex Huang 2013-06-25 16:19:46 -07:00
parent c1272055c5
commit fe4cc37e15
1 changed files with 3 additions and 2 deletions

View File

@ -150,9 +150,10 @@ public class MigrateVMCmd extends BaseAsyncCmd {
migratedVm = _userVmService.vmStorageMigration(getVirtualMachineId(), destStoragePool);
}
if (migratedVm != null) {
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", (UserVm)migratedVm).get(0);
UserVm vm = _entityMgr.findById(UserVm.class, migratedVm.getId());
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", vm).get(0);
response.setResponseName(getCommandName());
this.setResponseObject(response);
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm");
}