Skip to content

UEFI Support on CloudStack - #3638

Merged
andrijapanicsb merged 2 commits into
apache:masterfrom
pavanaravapalli:uefisupport
Mar 13, 2020
Merged

UEFI Support on CloudStack#3638
andrijapanicsb merged 2 commits into
apache:masterfrom
pavanaravapalli:uefisupport

Conversation

@pavanaravapalli

@pavanaravapallipavanaravapalli commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

Description

To Enable UEFI Support for Guest VM's deployed on Hypervisors[ KVM, VMware] in Cloud Stack.

Known things.

  • UEFI Capability for existing hosts [Vmware, KVM] is not supported, this marked for future enhancement.
  • KVM Host has dependancy on two pre-check conditions 1. OVMF package 2. uefi.properties configured properly or not.
  • Cloud Admin is responsible for updating newly added KVM host(s) with relevant uefi.properties. If mismatch in the config params of uefi.properties , UEFI deploy VM will throw libvirt exception.
  • For normal template selected and deployed with UEFI [legacy, secure] options , There won’t be any Exception thrown by Cloud Stack. VM will be in Running state in Cloud Stack, where as actually it’s ended up booting issue’s on Host due to wrong template/OS deployed to UEFI firmware. Also vice versa also can be happend. This is known behaviour, and uefi enable intelligence can be addressed in the next enhancement when it’s planned.
  • Cloud Admin is responsible to prepare Guest VM template which enabled with UEFI support.
  • Make sure to deploy a VM manually on Hypervisor and verify UEFI enabled template , prior to on-boarding to CloudStack.

Refer below doc for more information.
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Enable+UEFI+booting+for+Instance

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

KVM Host configuration

  • Install OVMF package by following instruction from the link here
  • Create uefi.properties file at location /etc/cloudstack/agent/uefi.properties
  • insert loader details with respective to the ovmf package would like to integrate. for example
    image

How Has This Been Tested?

HypervisorUEFI LegacyUEFI SecureManual Dev Testing Find outs [Linux & Windows ] with Uefi Legacy & Secure templates
KVM RHEL / CentOS (7.x)YesHypervisor Not SupportedPassed
KVM RHEL/ CentOS (8.x)YesYesPassed
Vmware ESXI(5.5)YesHypervisor Not SupportedPassed
VMware ESXI(6.5)YesYesPassed

KVM

  1. Prepared KVM [ RHEL 8 ] host UEFI enabled by installing OVMF package and configuring libvirt with nvram params
  2. Installed cloud stack agent rpm on KVM host.
  3. Created & updated uefi.properties configuration file with UEFI params as describe above in "KVM Host Configuration".
  4. Added KVM Host to a Cluster in Cloud Stack.
  5. Prepared & registered 'Windows Server 2016' & 'Cent OS 7.x' [KVM] templates on to CloudStack. i.e UEFI enabled.
  6. Deployed a VM [ boot options as UEFI -> Secure , UEFI -> Legacy ]with Windows Server 2016
    template and verified the UEFI boot information.
  7. Deployed a VM [ boot options as UEFI -> Secure , UEFI -> Legacy ]with Cent OS 7.x template and verified the UEFI boot information.

Note: brctl-utils package is deprecated in RHEL 8. We have force installed epel7 rpm in RHEL 8 and configured KVM agent.

VM Booting with UEFI firmware

image

Windows Server 2016 VM Secure boot enabled
image

Windows Server 2016 VM Secure boot disabled
image

Cent OS 7 Linux : Secure boot enabled
image

VMware

  1. Added VMware ESXi[6.5] Host in Cloud Stack Vmware Cluster
  2. Prepared & registered 'Windows Server 2016' [Vmware] templates on to CloudStack. i.e UEFI
    enabled.
  3. Deployed a VM [ boot options as UEFI -> Secure , UEFI -> Legacy ]with Windows Server 2016
    template and verified the UEFI boot information.

Windows Server 2106 VM Secure boot disabled
image

Windows Server 2106 VM Secure boot enabled
image

UEFI Enabled Host

image

Guest VM Uefi Boot Details

image

@nathanejohnson

nathanejohnson commented Oct 16, 2019

Copy link
Copy Markdown
Member

@pavanaravapalli first off glad to see this PR! it doesn't seem to compile just now, I marked in the review where it's complaining.

Here is a log of

mvn install -Dnoredist

compile.log

@nvazqueznvazquez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pavanaravapalli. I left some code review comments. Can you also add documentation? For example for KVM it seems to need some properties set in order to work properly

@nvazquez

Copy link
Copy Markdown
Contributor

Hi @nathanejohnson are you planning to test this PR?

@nathanejohnson

Copy link
Copy Markdown
Member

@nvazquez I'm going to test on kvm. would be good to get a volunteer for vmware as well

@nvazquez

Copy link
Copy Markdown
Contributor

@nathanejohnson sure, I can manually test it on Vmware once the PR is complete
@pavanaravapalli please let us know when this is complete, afaik it is still in progress right?

@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

@nvazquez I am working on it. I will address your review comments given in the PR#3643. I have created another PR#3643 for the same branch due to some forking issue.

@nathanejohnson@nvazquez
Please refer the PR#3643 for future reference.
I am closing this PR

@ustcweizhou

Copy link
Copy Markdown
Contributor

@pavanaravapalli you do not need to create new pull request.
you can push your new commits (or force-push to overwrite existing commit) to your github.

@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

Since PR#3643's forked branch been obsoleted, re-opening this PR.

@pavanaravapalli
pavanaravapalliforce-pushed the uefisupport branch 2 times, most recently from f69ee48 to 2f8300dCompareNovember 20, 2019 13:36
@pavanaravapallipavanaravapalli changed the title WIP: UEFI Support on CloudStackUEFI Support on CloudStackNov 20, 2019
@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

Thanks @pavanaravapalli. I left some code review comments. Can you also add documentation? For example for KVM it seems to need some properties set in order to work properly

Updated Description with KVM related uefi.properties information.
Also refer to the Design doc for more information.

@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

@nvazquez@nathanejohnson
PR is in good shape now, Can you test functionality and provide review comments.

@yadvr

yadvr commented Dec 7, 2019

Copy link
Copy Markdown
Member

@blueorangutan package

@yadvryadvr added this to the 4.14.0.0 milestone Dec 7, 2019
@blueorangutan

Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✖centos6 ✖centos7 ✖debian. JID-435

@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

@sureshanaparti, review comments addressed as suggested

@sureshanapartisureshanaparti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the changes for UEFI support. Code changes LGTM.

Comment threadserver/src/main/java/com/cloud/deploy/FirstFitPlanner.java Outdated
Comment threadserver/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java Outdated
Comment threadserver/src/main/java/com/cloud/server/ManagementServerImpl.java Outdated
@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

@pavanaravapalli I don't think you had anymore functional changes to make so it is fine by me to leave thos fixes for a new PR after this one.

Ok.

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-1241)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 33201 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3638-t1241-kvm-centos7.zip
Smoke tests completed. 83 look OK, 0 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File

@andrijapanicsb

Copy link
Copy Markdown
Contributor

3 x Approvals, regression tests went fine.

Merging

@andrijapanicsb
andrijapanicsb merged commit d4b537e into apache:masterMar 13, 2020
}

final VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm, template, offering, owner, params);
s_logger.info(" Uefi params " + "UefiFlag: " + params.get(VirtualMachineProfile.Param.UefiFlag)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this potentially cause any exception? Should this be only logged when custom params are passed; otherwise it may always log as null/null confuse admin/users cc @pavanaravapalli@DaanHoogland@andrijapanicsb

}
}
}
if(getBootType() != null){ // export to get

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavanaravapalli lint issue - add space between if (...

}
}
if(getBootType() != null){ // export to get
if(getBootType() == ApiConstants.BootType.UEFI) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavanaravapalli cc @DaanHoogland@andrijapanicsb
There is no null check, write it as someEnum.equals(someVariable or Method()) - this will never throw NPE.

}
if(getBootType() != null){ // export to get
if(getBootType() == ApiConstants.BootType.UEFI) {
customparameterMap.put(getBootType().toString(), getBootMode().toString());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavanaravapalli cc @DaanHoogland@andrijapanicsb
What is one of the methods return null?

detailsCopy.remove("username");
detailsCopy.remove("password");

if(detailsCopy.containsKey(Host.HOST_UEFI_ENABLE)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavanaravapalli space between if (...

vmProfile.setServiceOffering(_serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()));
if (MapUtils.isNotEmpty(vmEntityVO.getDetails()) &&
vmEntityVO.getDetails().containsKey(VirtualMachineProfile.Param.UefiFlag.getName()) &&
"yes".equalsIgnoreCase(vmEntityVO.getDetails().get(VirtualMachineProfile.Param.UefiFlag.getName())))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavanaravapalli
Can you make this simpler - just put in the key in the details only when it's applicable, then you don't need to compare the uefi value at all.

guest.setBootType(GuestDef.BootType.UEFI);
guest.setBootMode(GuestDef.BootMode.LEGACY);
if (StringUtils.isNotBlank(customParams.get(GuestDef.BootType.UEFI.toString())) && "secure".equalsIgnoreCase(customParams.get(GuestDef.BootType.UEFI.toString()))) {
guest.setMachineType("q35");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pavanaravapalli cc @DaanHoogland@andrijapanicsb Unless there is a requirement of allowing customisation of UEFI (generally people use whatever libvirt gives), you can simplify this by addressing the change in the libvirt xml. See my changes around support EFI for arm64/raspberrypi (for example https://github.com/apache/cloudstack/pull/3644/files#diff-042ba018afca0d690feae46e22f73301R128)

@pavanaravapallipavanaravapalliMar 19, 2020

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhtyd

UEFI Secure boot does not work with default libvirt xml changes and "pc" as machine type.

There are few other mandatory changes to be handled in case of secure boot guest xml, the same have been captured in the design doc. please have a look in the wiki doc shared with this PR description.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@pavanaravapalli please have a look at @rhtyd 's concerns and at #3978 as this PR seems to cause issue. We'll need to fix before release or revert!
cc @davidjumani @rhtyd @andrijapanicsb

@DaanHoogland

Copy link
Copy Markdown
Contributor

cc @nathanejohnson@kiwiflyer , hate to escalate but please see my prior comment.

@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

@pavanaravapalli please have a look at @rhtyd 's concerns and at #3978 as this PR seems to cause issue. We'll need to fix before release or revert!
cc @davidjumani @rhtyd @andrijapanicsb

@DaanHoogland
I will check for the exception #3978 cause and update.
For addressing @rhtyd concern i need some more time as i am occupied with other activities.

@yadvr

Copy link
Copy Markdown
Member

@pavanaravapalli could est. when would you be able to do this, preferably before 4.14 RC1?

@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

@pavanaravapalli could est. when would you be able to do this, preferably before 4.14 RC1?

@rhtyd it may take time to address all the review comments provided. I am hoping to give fix for NPE #3978 soon. And i need some one to test it as i don't have VMware setup with me present.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@pavanaravapalli I can take care of the test required to validate that #3978 is solved. Please add your update A.S.A.P.

@DaanHooglandDaanHoogland mentioned this pull request Mar 23, 2020
5 tasks
@DaanHoogland

Copy link
Copy Markdown
Contributor

@pavanaravapalli please add your improvements and suggestions as PR to #3983.

@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

@pavanaravapalli please add your improvements and suggestions as PR to #3983.

Raised PR #3985 for the fix . @DaanHoogland please verify the fix and approve it.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@pavanaravapalli please review #4088 we need to fix this to be able to release.

@sureshanaparti

Copy link
Copy Markdown
Contributor

@pavanaravapalli Can you update the actual UEFI functionality (with boot mode & type) supported for VMware and KVM, in CloudStack, with this PR changes.

@pavanaravapalli

Copy link
Copy Markdown
ContributorAuthor

@pavanaravapalli Can you update the actual UEFI functionality (with boot mode & type) supported for VMware and KVM, in CloudStack, with this PR changes.

Updated Description with info.

@pavanaravapalli

pavanaravapalli commented May 18, 2020

Copy link
Copy Markdown
ContributorAuthor

@pavanaravapalli please review #4088 we need to fix this to be able to release.

Verified code for #4089 , looks good to me. I have not encountered this issue while testing UEFI changes.

yadvr added a commit to shapeblue/cloudstack that referenced this pull request May 19, 2020
…ypervisor KVM,VMware. enabled boot modes [Legacy,Secure] support for UEFI boot with known caveats. (apache#3638)"
This reverts commit d4b537e.
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
@slavkapslavkap mentioned this pull request Feb 5, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

14 participants

@pavanaravapalli@nathanejohnson@nvazquez@ustcweizhou@yadvr@blueorangutan@andrijapanicsb@radu-todirica@DaanHoogland@harikrishna-patnala@sureshanaparti@jayapalu@PaulAngus@svenvogel