DaanHoogland commented on code in PR #6491:
URL: https://github.com/apache/cloudstack/pull/6491#discussion_r912839904
##########
api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java:
##########
@@ -152,20 +153,17 @@ public ApiCommandResourceType getApiResourceType() {
@Override
public void execute() {
if (hostId == null && MapUtils.isEmpty(migrateVolumeTo)) {
- throw new InvalidParameterValueException(String.format("Either %s
or %s must be passed for migrating the VM", ApiConstants.HOST_ID,
ApiConstants.MIGRATE_TO));
- }
-
- UserVm userVm = _userVmService.getUserVm(getVirtualMachineId());
- if (userVm == null) {
- throw new InvalidParameterValueException("Unable to find the VM by
id=" + getVirtualMachineId());
+ throw new InvalidParameterValueException(String.format("Either %s
or %s must be passed for migrating the VM.", ApiConstants.HOST_ID,
ApiConstants.MIGRATE_TO));
}
+ VirtualMachine userVm = _userVmService.getVm(getVirtualMachineId());
Review Comment:
how about the `null` check that used to be there? in
`UserVmManagerImpl.getVM(long)` I see no sign of `null`-safety.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]