You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/09/21 09:01:36 UTC
[GitHub] [cloudstack] weizhouapache commented on a change in pull request #5469: server: add vm boot details for start vm api
weizhouapache commented on a change in pull request #5469:
URL: https://github.com/apache/cloudstack/pull/5469#discussion_r712842171
##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -2884,15 +2889,30 @@ protected boolean applyUserData(HypervisorType hyperVisorType, UserVm vm, Nic ni
public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException {
Map<VirtualMachineProfile.Param, Object> additonalParams = null;
if (cmd.getBootIntoSetup() != null) {
- if (additonalParams == null) {
- additonalParams = new HashMap<>();
- }
+ additonalParams = new HashMap<>();
if (s_logger.isTraceEnabled()) {
s_logger.trace(String.format("Adding %s into the param map", VirtualMachineProfile.Param.BootIntoSetup.getName()));
}
additonalParams.put(VirtualMachineProfile.Param.BootIntoSetup, cmd.getBootIntoSetup());
}
+ UserVmDetailVO uefiDetail = userVmDetailsDao.findDetail(cmd.getId(), ApiConstants.BootType.UEFI.toString());
+ if (uefiDetail != null) {
+ if (additonalParams == null) {
Review comment:
would it be better to do ?
```
Map<VirtualMachineProfile.Param, Object> additonalParams = new HashMap<>();
```
##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -2884,15 +2889,30 @@ protected boolean applyUserData(HypervisorType hyperVisorType, UserVm vm, Nic ni
public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException {
Map<VirtualMachineProfile.Param, Object> additonalParams = null;
if (cmd.getBootIntoSetup() != null) {
- if (additonalParams == null) {
- additonalParams = new HashMap<>();
- }
+ additonalParams = new HashMap<>();
if (s_logger.isTraceEnabled()) {
s_logger.trace(String.format("Adding %s into the param map", VirtualMachineProfile.Param.BootIntoSetup.getName()));
}
additonalParams.put(VirtualMachineProfile.Param.BootIntoSetup, cmd.getBootIntoSetup());
}
+ UserVmDetailVO uefiDetail = userVmDetailsDao.findDetail(cmd.getId(), ApiConstants.BootType.UEFI.toString());
+ if (uefiDetail != null) {
+ if (additonalParams == null) {
+ additonalParams = new HashMap<>();
+ }
+ if (s_logger.isTraceEnabled()) {
+ s_logger.trace(String.format("Adding boot options (%s, %s, %s) into the param map for VM start as UEFI detail(%s=%s) found for the VM",
+ VirtualMachineProfile.Param.UefiFlag.getName(),
+ VirtualMachineProfile.Param.BootType.getName(),
+ VirtualMachineProfile.Param.BootMode.getName(),
+ uefiDetail.getName(),
+ uefiDetail.getValue()));
+ }
+ additonalParams.put(VirtualMachineProfile.Param.UefiFlag, "Yes");
Review comment:
@shwstppr
can you extract this to method ? that's Daan often asked :-D
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org