CLOUDSTACK-3851 [VMWare] VM start fails with NPE while trying to retrieve cores per socket

If VMware host version is ESXi 4.1 and vCenter version is 5.0 or later, number of cores per socket of a VM running on ESXi 4.1 host would be undefined as it's not supported for versions prior to 5.0.
Hence expecting undefined/null value for that and handling it.

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>
This commit is contained in:
Sateesh Chodapuneedi 2013-08-20 13:28:14 +05:30
parent a5ada3f363
commit cc18ca79fc

View File

@ -2205,7 +2205,8 @@ public class VirtualMachineMO extends BaseMO {
if (apiVersion.compareTo("5.0") < 0) {
return 1;
}
return (Integer)_context.getVimClient().getDynamicProperty(_mor, "config.hardware.numCoresPerSocket");
Integer coresPerSocket = (Integer) _context.getVimClient().getDynamicProperty(_mor, "config.hardware.numCoresPerSocket");
return coresPerSocket != null? coresPerSocket : 1;
}
public int getVirtualHardwareVersion() throws Exception {