use of com.vmware.vim25.VirtualMachineBootOptions in project cloudstack by apache.
the class VmwareResource method canSetEnableSetupConfig.
/**
* set the boot into setup option if possible
* @param vmMo vmware view on the vm
* @param virtualMachine orchestration spec for the vm
* @return true unless reboot into setup is requested and vmware is unable to comply
*/
private boolean canSetEnableSetupConfig(VirtualMachineMO vmMo, VirtualMachineTO virtualMachine) {
if (virtualMachine.isEnterHardwareSetup()) {
VirtualMachineBootOptions bootOptions = new VirtualMachineBootOptions();
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
if (s_logger.isDebugEnabled()) {
s_logger.debug(String.format("configuring VM '%s' to reboot into hardware setup menu.", virtualMachine.getName()));
}
bootOptions.setEnterBIOSSetup(virtualMachine.isEnterHardwareSetup());
vmConfigSpec.setBootOptions(bootOptions);
try {
if (!vmMo.configureVm(vmConfigSpec)) {
return false;
}
} catch (Exception e) {
s_logger.error(String.format("failed to reconfigure VM '%s' to boot into hardware setup menu", virtualMachine.getName()), e);
return false;
}
}
return true;
}
Aggregations