Skip to content

Commit cad9a05

Browse files
committed
Prevent NPE if hypervisor capabilies are null
If the hypervisor's capabilites are null CloudRuntimeException will be thrown; Format the error message
1 parent 06454ff commit cad9a05

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6208,8 +6208,8 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
62086208
}
62096209
}
62106210

6211-
if (!capabilities.isStorageMotionSupported()) {
6212-
throw new CloudRuntimeException("Migration with storage isn't supported on hypervisor " + srcHost.getHypervisorType() + " of version " + srcHost.getHypervisorVersion());
6211+
if (capabilities == null || !capabilities.isStorageMotionSupported()) {
6212+
throw new CloudRuntimeException(String.format("Migration with storage isn't supported on hypervisor %s of version %s", srcHost.getHypervisorType(), srcHost.getHypervisorVersion()));
62136213
}
62146214

62156215
// Check if destination host is up.

0 commit comments

Comments
 (0)