fixed NPE

This commit is contained in:
Anthony Xu 2013-10-23 15:23:35 -07:00
parent a94acc5a43
commit 187e328f6c
1 changed files with 14 additions and 12 deletions

View File

@ -169,7 +169,6 @@ public class XenServer56FP1Resource extends XenServer56Resource {
vmr.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
vmr.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
Map<String, String> details = vmSpec.getDetails();
if (isDmcEnabled(conn, host) && vmSpec.isEnableDynamicallyScaleVm()) {
//scaling is allowed
vmr.memoryStaticMin = getStaticMin(vmSpec.getOs(), vmSpec.getBootloader() == BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam());
@ -193,18 +192,21 @@ public class XenServer56FP1Resource extends XenServer56Resource {
vmr.VCPUsMax = 32L;
}
String timeoffset = details.get("timeoffset");
if (timeoffset != null) {
Map<String, String> platform = vmr.platform;
platform.put("timeoffset", timeoffset);
vmr.platform = platform;
}
Map<String, String> details = vmSpec.getDetails();
if ( details != null ) {
String timeoffset = details.get("timeoffset");
if (timeoffset != null) {
Map<String, String> platform = vmr.platform;
platform.put("timeoffset", timeoffset);
vmr.platform = platform;
}
String coresPerSocket = details.get("cpu.corespersocket");
if (coresPerSocket != null) {
Map<String, String> platform = vmr.platform;
platform.put("cores-per-socket", coresPerSocket);
vmr.platform = platform;
String coresPerSocket = details.get("cpu.corespersocket");
if (coresPerSocket != null) {
Map<String, String> platform = vmr.platform;
platform.put("cores-per-socket", coresPerSocket);
vmr.platform = platform;
}
}
vmr.VCPUsAtStartup = (long) vmSpec.getCpus();