Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.4k
Boot into hardware setup menu on Vmware#4021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
a9f46d3
fixes and comments addressed
DaanHoogland edb227f
add boolean flag boot into bios
DaanHoogland 00488ef
new parameter and since attributes
DaanHoogland 0764336
acception boot into bios paramter
DaanHoogland 76076c2
factor out implement method
DaanHoogland f5c970f
enable setup on vm bootoptions
29334c2
(re)boot into bios full stack?
DaanHoogland 72b1392
enterSetup as boolean (part 1)
DaanHoogland 274f2e3
enterSetup as boolean (part 2)
d7590a8
ui fields (unconditionally)
ab01d48
trace value of param before and after job queue
4183ed6
guard log against npe
92c367a
pass parameter on start of existing VM
a050733
moving parameter for passing down
b42624f
log-trace
96b1d12
just retrieve param, not param of param
DaanHoogland 4786e33
more trace
DaanHoogland 5f4301e
tracerest
fbc674b
enable BIOS setup only on vmware
d6354bb
log and passthrough param on startVM
d3b5304
barf if bootintobios on non-vmware
6982472
import
DaanHoogland a6e81d7
silly unmnecessary npe
DaanHoogland a596cfe
trace parameter adding
d42e7d4
keep result for next pass
1229e05
boot into setup (not necessarily BIOS)
b4d97dd
readability comments aplied
DaanHoogland 5325bc3
don't reboot if setup requested but not set
357dccd
inject implementer
ba9e853
no name in bean
5cb7a2b
further modularisation
DaanHoogland 448cd2e
nested virtualisation flags available in unit tests and prod
69db80a
log name not nics
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9 api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5 api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 12 additions & 6 deletions
18 api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -113,12 +113,15 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityG | ||
| @Parameter(name = ApiConstants.NETWORK_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = NetworkResponse.class, description = "list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter") | ||
| private List<Long> networkIds; | ||
| @Parameter(name = ApiConstants.BOOT_TYPE, type = CommandType.STRING, required = false, description = "Guest VM Boot option either custom[UEFI] or default boot [BIOS]") | ||
| @Parameter(name = ApiConstants.BOOT_TYPE, type = CommandType.STRING, required = false, description = "Guest VM Boot option either custom[UEFI] or default boot [BIOS]", since = "4.14.0.0") | ||
| private String bootType; | ||
| @Parameter(name = ApiConstants.BOOT_MODE, type = CommandType.STRING, required = false, description = "Boot Mode [Legacy] or [Secure] Applicable when Boot Type Selected is UEFI, otherwise Legacy By default for BIOS") | ||
| @Parameter(name = ApiConstants.BOOT_MODE, type = CommandType.STRING, required = false, description = "Boot Mode [Legacy] or [Secure] Applicable when Boot Type Selected is UEFI, otherwise Legacy By default for BIOS", since = "4.14.0.0") | ||
| private String bootMode; | ||
| @Parameter(name = ApiConstants.BOOT_INTO_SETUP, type = CommandType.BOOLEAN, required = false, description = "Boot into hardware setup or not (ignored if startVm = false, only valid for vmware)", since = "4.15.0.0") | ||
| private Boolean bootIntoSetup; | ||
| //DataDisk information | ||
| @ACL | ||
| @Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "the ID of the disk offering for the virtual machine. If the template is of ISO format," | ||
| @@ -281,15 +284,14 @@ public Map<String, String> getDetails() { | ||
| } | ||
| } | ||
| } | ||
| if(getBootType() != null){ // export to get | ||
| if(getBootType() == ApiConstants.BootType.UEFI) { | ||
| customparameterMap.put(getBootType().toString(), getBootMode().toString()); | ||
| } | ||
| if (ApiConstants.BootType.UEFI.equals(getBootType())) { | ||
DaanHoogland marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| customparameterMap.put(getBootType().toString(), getBootMode().toString()); | ||
| } | ||
| if (rootdisksize != null && !customparameterMap.containsKey("rootdisksize")) { | ||
| customparameterMap.put("rootdisksize", rootdisksize.toString()); | ||
| } | ||
| return customparameterMap; | ||
| } | ||
| @@ -577,6 +579,10 @@ public boolean getCopyImageTags() { | ||
| return copyImageTags == null ? false : copyImageTags; | ||
| } | ||
| public Boolean getBootIntoSetup() { | ||
| return bootIntoSetup; | ||
| } | ||
| ///////////////////////////////////////////////////// | ||
| /////////////// API Implementation/////////////////// | ||
| ///////////////////////////////////////////////////// | ||
7 changes: 7 additions & 0 deletions
7 api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7 api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3 api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 61 additions & 5 deletions
66 engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -889,6 +889,11 @@ public void advanceStart(final String vmUuid, final Map<VirtualMachineProfile.Pa | ||
| final AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext(); | ||
| if ( jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) { | ||
| if (s_logger.isTraceEnabled()) { | ||
| s_logger.trace(String.format("start parameter value of %s == %s during dispatching", | ||
| VirtualMachineProfile.Param.BootIntoSetup.getName(), | ||
| (params == null?"<very null>":params.get(VirtualMachineProfile.Param.BootIntoSetup)))); | ||
| } | ||
| // avoid re-entrance | ||
| VmWorkJobVO placeHolder = null; | ||
| final VirtualMachine vm = _vmDao.findByUuid(vmUuid); | ||
| @@ -901,6 +906,11 @@ public void advanceStart(final String vmUuid, final Map<VirtualMachineProfile.Pa | ||
| } | ||
| } | ||
| } else { | ||
| if (s_logger.isTraceEnabled()) { | ||
| s_logger.trace(String.format("start parameter value of %s == %s during processing of queued job", | ||
| VirtualMachineProfile.Param.BootIntoSetup.getName(), | ||
| (params == null?"<very null>":params.get(VirtualMachineProfile.Param.BootIntoSetup)))); | ||
| } | ||
| final Outcome<VirtualMachine> outcome = startVmThroughJobQueue(vmUuid, params, planToDeploy, planner); | ||
| try { | ||
| @@ -1064,10 +1074,7 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil | ||
| } | ||
| final VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm, template, offering, owner, params); | ||
| s_logger.info(" Uefi params " + "UefiFlag: " + params.get(VirtualMachineProfile.Param.UefiFlag) | ||
| + " Boot Type: " + params.get(VirtualMachineProfile.Param.BootType) | ||
| + " Boot Mode: " + params.get(VirtualMachineProfile.Param.BootMode) | ||
| ); | ||
| logBootModeParameters(params); | ||
| DeployDestination dest = null; | ||
| try { | ||
| dest = _dpMgr.planDeployment(vmProfile, plan, avoids, planner); | ||
| @@ -1137,6 +1144,8 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil | ||
| final VirtualMachineTO vmTO = hvGuru.implement(vmProfile); | ||
| checkAndSetEnterSetupMode(vmTO, params); | ||
| handlePath(vmTO.getDisks(), vm.getHypervisorType()); | ||
| cmds = new Commands(Command.OnError.Stop); | ||
| @@ -1315,6 +1324,30 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil | ||
| } | ||
| } | ||
| private void logBootModeParameters(Map<VirtualMachineProfile.Param, Object> params) { | ||
| StringBuffer msgBuf = new StringBuffer("Uefi params "); | ||
| boolean log = false; | ||
| if (params.get(VirtualMachineProfile.Param.UefiFlag) != null) { | ||
| msgBuf.append(String.format("UefiFlag: %s ", params.get(VirtualMachineProfile.Param.UefiFlag))); | ||
| log = true; | ||
| } | ||
| if (params.get(VirtualMachineProfile.Param.BootType) != null) { | ||
| msgBuf.append(String.format("Boot Type: %s ", params.get(VirtualMachineProfile.Param.BootType))); | ||
| log = true; | ||
| } | ||
| if (params.get(VirtualMachineProfile.Param.BootMode) != null) { | ||
| msgBuf.append(String.format("Boot Mode: %s ", params.get(VirtualMachineProfile.Param.BootMode))); | ||
| log = true; | ||
| } | ||
| if (params.get(VirtualMachineProfile.Param.BootIntoSetup) != null) { | ||
| msgBuf.append(String.format("Boot into Setup: %s ", params.get(VirtualMachineProfile.Param.BootIntoSetup))); | ||
| log = true; | ||
| } | ||
| if (log) { | ||
| s_logger.info(msgBuf.toString()); | ||
DaanHoogland marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| } | ||
| // Add extra config data to the vmTO as a Map | ||
| private void addExtraConfig(VirtualMachineTO vmTO) { | ||
| Map<String, String> details = vmTO.getDetails(); | ||
| @@ -3094,13 +3127,21 @@ public void advanceReboot(final String vmUuid, final Map<VirtualMachineProfile.P | ||
| final VirtualMachine vm = _vmDao.findByUuid(vmUuid); | ||
| placeHolder = createPlaceHolderWork(vm.getId()); | ||
| try { | ||
| if (s_logger.isTraceEnabled()) { | ||
| s_logger.trace(String.format("reboot parameter value of %s == %s at orchestration", VirtualMachineProfile.Param.BootIntoSetup.getName(), | ||
| (params == null? "<very null>":params.get(VirtualMachineProfile.Param.BootIntoSetup)))); | ||
| } | ||
| orchestrateReboot(vmUuid, params); | ||
| } finally { | ||
| if (placeHolder != null) { | ||
| _workJobDao.expunge(placeHolder.getId()); | ||
| } | ||
| } | ||
| } else { | ||
| if (s_logger.isTraceEnabled()) { | ||
| s_logger.trace(String.format("reboot parameter value of %s == %s through job-queue", VirtualMachineProfile.Param.BootIntoSetup.getName(), | ||
| (params == null? "<very null>":params.get(VirtualMachineProfile.Param.BootIntoSetup)))); | ||
| } | ||
| final Outcome<VirtualMachine> outcome = rebootVmThroughJobQueue(vmUuid, params); | ||
| try { | ||
| @@ -3150,7 +3191,9 @@ private void orchestrateReboot(final String vmUuid, final Map<VirtualMachineProf | ||
| final Commands cmds = new Commands(Command.OnError.Stop); | ||
| RebootCommand rebootCmd = new RebootCommand(vm.getInstanceName(), getExecuteInSequence(vm.getHypervisorType())); | ||
| rebootCmd.setVirtualMachine(getVmTO(vm.getId())); | ||
| VirtualMachineTO vmTo = getVmTO(vm.getId()); | ||
| checkAndSetEnterSetupMode(vmTo, params); | ||
| rebootCmd.setVirtualMachine(vmTo); | ||
| cmds.addCommand(rebootCmd); | ||
| _agentMgr.send(host.getId(), cmds); | ||
| @@ -3170,6 +3213,14 @@ private void orchestrateReboot(final String vmUuid, final Map<VirtualMachineProf | ||
| } | ||
| } | ||
| private void checkAndSetEnterSetupMode(VirtualMachineTO vmTo, Map<VirtualMachineProfile.Param, Object> params) { | ||
| Boolean enterSetup = (Boolean)params.get(VirtualMachineProfile.Param.BootIntoSetup); | ||
| if (s_logger.isTraceEnabled()) { | ||
| s_logger.trace(String.format("orchestrating VM reboot for '%s' %s set to %s", vmTo.getName(), VirtualMachineProfile.Param.BootIntoSetup, enterSetup)); | ||
| } | ||
| vmTo.setEnterHardwareSetup(enterSetup == null ? false : enterSetup); | ||
| } | ||
| protected VirtualMachineTO getVmTO(Long vmId) { | ||
| final VMInstanceVO vm = _vmDao.findById(vmId); | ||
| final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm); | ||
| @@ -5223,6 +5274,11 @@ private Pair<JobInfo.Status, String> orchestrateStart(final VmWorkStart work) th | ||
| } | ||
| assert vm != null; | ||
| Boolean enterSetup = (Boolean)work.getParams().get(VirtualMachineProfile.Param.BootIntoSetup); | ||
| if (s_logger.isTraceEnabled()) { | ||
| s_logger.trace(String.format("orchestrating VM start for '%s' %s set to %s", vm.getInstanceName(), VirtualMachineProfile.Param.BootIntoSetup, enterSetup)); | ||
| } | ||
| try{ | ||
| orchestrateStart(vm.getUuid(), work.getParams(), work.getPlan(), _dpMgr.getDeploymentPlannerByName(work.getDeploymentPlanner())); | ||
| } | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DaanHoogland Is hardware setup same as boot setup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in hindsite this name should have been something like "bootIntoFirmware". many names have passed the catwalk. on resource level it is called enterHardwareSetup on API it is bootIntoSetup.