[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #3638: UEFI Support on CloudStack

2019-12-17 Thread GitBox
sureshanaparti commented on a change in pull request #3638: UEFI Support on 
CloudStack
URL: https://github.com/apache/cloudstack/pull/3638#discussion_r356214213
 
 

 ##
 File path: server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java
 ##
 @@ -166,6 +166,11 @@ protected VirtualMachineTO 
toVirtualMachineTO(VirtualMachineProfile vmProfile) {
 offering.getRamSize() * 1024l * 1024l, null, null, 
vm.isHaEnabled(), vm.limitCpuUse(), vm.getVncPassword());
 to.setBootArgs(vmProfile.getBootArgs());
 
+String bootType = (String)vmProfile.getParameter(new 
VirtualMachineProfile.Param("BootType"));
+if (bootType != null && !bootType.isEmpty()) {
 
 Review comment:
   can use StringUtils


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #3638: UEFI Support on CloudStack

2019-12-17 Thread GitBox
sureshanaparti commented on a change in pull request #3638: UEFI Support on 
CloudStack
URL: https://github.com/apache/cloudstack/pull/3638#discussion_r356211331
 
 

 ##
 File path: 
server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
 ##
 @@ -112,6 +117,16 @@
 VMTemplateVO template = (VMTemplateVO)vmProfile.getTemplate();
 Account account = vmProfile.getOwner();
 
+boolean isVMDeployedWithUefi = false;
+UserVmDetailVO userVmDetailVO = 
_userVmDetailsDao.findDetail(vmProfile.getId(), "UEFI");
+if(userVmDetailVO != null){
+if ("secure".equalsIgnoreCase(userVmDetailVO.getValue()) || 
"legacy".equalsIgnoreCase(userVmDetailVO.getValue())) {
 
 Review comment:
   define enum globally for boot types & modes (secure and legacy) and use it 
across, whenever applicable.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #3638: UEFI Support on CloudStack

2019-12-17 Thread GitBox
sureshanaparti commented on a change in pull request #3638: UEFI Support on 
CloudStack
URL: https://github.com/apache/cloudstack/pull/3638#discussion_r356213475
 
 

 ##
 File path: server/src/main/java/com/cloud/deploy/FirstFitPlanner.java
 ##
 @@ -218,6 +230,20 @@ public int compare(Long o1, Long o2) {
 });
 }
 
+private Long getHostsByCapability(List hostList, String 
hostCapability) {
+int totalHostswithCapability = 0;
+for (Long host : hostList) { //TODO: Fix this in single query instead 
of polling request for each Host
+Map details = hostDetailsDao.findDetails(host);
+if (details.containsKey(Host.HOST_UEFI_ENABLE)) {
+if 
(details.get(Host.HOST_UEFI_ENABLE).equalsIgnoreCase("Yes")) {
+totalHostswithCapability++;
 
 Review comment:
   Better return here when a host found with UEFI capability as that satisfies 
the return cond.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #3638: UEFI Support on CloudStack

2019-12-17 Thread GitBox
sureshanaparti commented on a change in pull request #3638: UEFI Support on 
CloudStack
URL: https://github.com/apache/cloudstack/pull/3638#discussion_r356214635
 
 

 ##
 File path: server/src/main/java/com/cloud/server/ManagementServerImpl.java
 ##
 @@ -1183,6 +1187,16 @@ private HypervisorType getHypervisorType(VMInstanceVO 
vm, StoragePool srcVolumeP
 throw ex;
 }
 
+UserVmDetailVO userVmDetailVO = 
_UserVmDetailsDao.findDetail(vm.getId(), "UEFI");
+if (userVmDetailVO != null){
+s_logger.info(" Live Migration of UEFI enabled VM : " + 
vm.getInstanceName()+ " is not supported");
+if("legacy".equalsIgnoreCase(userVmDetailVO.getValue()) || 
"secure".equalsIgnoreCase(userVmDetailVO.getValue())) {
 
 Review comment:
   enum for boot mode


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #3638: UEFI Support on CloudStack

2019-12-17 Thread GitBox
sureshanaparti commented on a change in pull request #3638: UEFI Support on 
CloudStack
URL: https://github.com/apache/cloudstack/pull/3638#discussion_r358759269
 
 

 ##
 File path: 
api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
 ##
 @@ -245,6 +252,22 @@ public Long getDomainId() {
 return domainId;
 }
 
+private ApiConstants.BootType  getBootType() {
+
+if (StringUtils.isNotBlank(bootType)) {
+try {
+String type = bootType.trim().toUpperCase();
+return ApiConstants.BootType.valueOf(type);
+} catch (IllegalArgumentException e) {
+String errMesg = "Invalid bootType " + bootType + "Specified 
for vm " + getName()
++ " Valid values are: UEFI,BIOS ";
 
 Review comment:
   Use the enum for valid values.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #3638: UEFI Support on CloudStack

2019-12-17 Thread GitBox
sureshanaparti commented on a change in pull request #3638: UEFI Support on 
CloudStack
URL: https://github.com/apache/cloudstack/pull/3638#discussion_r358759670
 
 

 ##
 File path: 
api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
 ##
 @@ -257,12 +280,35 @@ public Long getDomainId() {
 }
 }
 }
+if(getBootType() != null){ // export to get
+if(getBootType() == ApiConstants.BootType.UEFI) {
+customparameterMap.put(getBootType().toString(), 
getBootMode().toString());
+}
+}
+
 if (rootdisksize != null && 
!customparameterMap.containsKey("rootdisksize")) {
 customparameterMap.put("rootdisksize", rootdisksize.toString());
 }
 return customparameterMap;
 }
 
+
+public ApiConstants.BootMode getBootMode() {
+if (StringUtils.isNotBlank(bootMode)) {
+try {
+String mode = bootMode.trim().toUpperCase();
+return ApiConstants.BootMode.valueOf(mode);
+} catch (IllegalArgumentException e) {
+String errMesg = "Invalid bootMode " + bootMode + "Specified 
for vm " + getName()
++ " Valid values are: LEGACY,SECURE ";
 
 Review comment:
   Use the enum for valid values.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #3638: UEFI Support on CloudStack

2019-12-10 Thread GitBox
sureshanaparti commented on a change in pull request #3638: UEFI Support on 
CloudStack
URL: https://github.com/apache/cloudstack/pull/3638#discussion_r356206740
 
 

 ##
 File path: 
engine/orchestration/src/main/java/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
 ##
 @@ -269,4 +270,23 @@ public void disconnectFrom(NetworkEntity netowrk, short 
nicId) {
 
 }
 
+@Override
+public void setParamsToEntity(Map 
map) {
+if (this.vmEntityVO != null) {
+Map details = this.vmEntityVO.getDetails();
+
+if (details == null) {
 
 Review comment:
   Better get and validate details when map is not empty.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services