Skip to content

Commit 3435a76

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 5f734f7 commit 3435a76

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
@@ -6215,8 +6215,8 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
62156215
}
62166216
}
62176217

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

62226222
// Check if destination host is up.

0 commit comments

Comments
 (0)