-
Notifications
You must be signed in to change notification settings - Fork 179
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
Libvirt: Add CVM Nested Virtualization feature #3519
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ | |
get_environment_context, | ||
get_node_context, | ||
) | ||
from .features import SecurityProfile, SecurityProfileSettings | ||
from .features import CVMNestedVirtualization, SecurityProfile, SecurityProfileSettings | ||
from .platform_interface import IBaseLibvirtPlatform | ||
from .schema import ( | ||
FIRMWARE_TYPE_BIOS, | ||
|
@@ -93,6 +93,7 @@ class BaseLibvirtPlatform(Platform, IBaseLibvirtPlatform): | |
CONFIG_FILE_MARKER = "lisa-libvirt-platform" | ||
|
||
_supported_features: List[Type[Feature]] = [ | ||
CVMNestedVirtualization, | ||
SerialConsole, | ||
StartStop, | ||
SecurityProfile, | ||
|
@@ -350,9 +351,11 @@ def _create_node_capabilities( | |
node_capabilities.network_interface.nic_count = 1 | ||
node_capabilities.gpu_count = 0 | ||
security_profile_setting = SecurityProfileSettings() | ||
cvm_nested_virtualization = CVMNestedVirtualization.create_setting() | ||
node_capabilities.features = search_space.SetSpace[schema.FeatureSettings]( | ||
is_allow_set=True, | ||
items=[ | ||
cvm_nested_virtualization, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add this feature only when the guest is a CVM guest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The node is configured after this step, so I don't think a check can be added at this exact point to check guest vm type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What means "guest" here? If it means the vm image, it cannot be checked here. If it means the host supports CVM or not, it should be set here. If it's not easy to know the host support CVM or not, a switch can be added in schema to control from the runbook. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, I mean the VM that is being created by this platform.
I guess I was a bit confused about what the feature But if it is used to indicate whether a host supports CVM or not, then it shouldn't be added as a requirement for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A feature means the capability of the platform, what kind of VM is capable to create. It doesn't consider if the image is CVM or not, but only consider if the host is capable to create a CVM. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Platform or node? At the end of the day, a feature is a property of a node right? We access it with
Libvirt platform is not capable of creating nodes that are in turn capable of creating CVMs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for clarifying! In that case, we don't need this PR. The testcase requirement is incorrect. We will fix that. |
||
schema.FeatureSettings.create(SerialConsole.name()), | ||
security_profile_setting, | ||
], | ||
|
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.
Instead of returning the settings right away, can we have a check on
host_node
if it supports nested cvm ?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.
We will have to pass the host node sku from runbook in that case.
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.
Is that something a feature is supposed to do? I would imagine the code that adds this feature to a node should do those checks (if at all).
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.
From this ref: https://github.com/microsoft/lisa/blob/main/lisa/sut_orchestrator/azure/features.py#L2746, I understand the return from this function would say if the actual feature (here in this case Nested CVM) is supported or not. Not all the
host_node
s support nested CVM.We could also do it as you suggested, but the checks to support feature should be necessary.
A check like https://github.com/microsoft/lisa/blob/main/microsoft/testsuites/cvm/cvm_azure_host.py#L78 would suffice.
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.
Ref:
lisa/lisa/sut_orchestrator/libvirt/platform.py
Line 353 in ceac54d
We can add a check that would add the setting to node_capabilities.features when it's not NONE, but then we need a validation logic in the feature.
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.
Also, for checking whether the host node supports nested CVM or not, we already have verify_azure_vm_snp_enablement test as part of host functional test job, can't we use the existing testcase to validate? To add the validation in the feature, we will have to add the same logic here again.
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.
You can see how Azure platform handles this and do something similar. I see Azure platform also returning
Optional[schema.FeatureSettings]
.ref: https://github.com/microsoft/lisa/blob/main/lisa/sut_orchestrator/azure/features.py#L2740
I'm fine with Anirudh's suggestion to have the check before adding the feature to supported list.
Testcase and Features are different entities altogether. We cannot use testcase as check if a feature is supported or not.