Skip to content

Completed config option to allow nested virtualization #10812

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bradywilkin
Copy link

Description

This PR...

I introduced a new global configuration option, AllowNestedVMAccess, within the IPAddressManagerImpl.java file. This setting is then referenced in LibVirtComputingResource when determining whether the virtualized firewall can be bridged. If the configuration key is enabled, the system returns true for canBridgeFirewall without running security_group.py. As discussed in the issue itself we first wanted to get a functional basic version completed- later on this should include modifications to the script in secuirty_group.py to allow other functionality to occur while still allowing nested VM access.

#10286

10286

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)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

I added a test in IPAddressManagerTest.java to ensure that the firewall can be bridged when this setting is enabled.

How did you try to break this feature and the system with this change?

Copy link

boring-cyborg bot commented May 4, 2025

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a global configuration option to allow nested virtualization by enabling nested VM access and bypassing security group checks for firewall bridging.

  • Introduces a new ConfigKey in IpAddressManagerImpl to control nested VM access.
  • Updates LibvirtComputingResource to skip security group verification if nested VM access is enabled.
  • Adds a test in IpAddressManagerTest to verify the new behavior.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
server/src/test/java/com/cloud/network/IpAddressManagerTest.java Adds a test to validate that enabling nested VM access allows firewall bridging.
server/src/main/java/com/cloud/network/IpAddressManagerImpl.java Introduces a new config key for nested VM access and its accessor method.
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java Modifies the firewall bridging logic to bypass security group checks when nested VM access is allowed.
Comments suppressed due to low confidence (1)

server/src/main/java/com/cloud/network/IpAddressManagerImpl.java:333

  • [nitpick] Consider renaming 'AllowNestedVMAccess' to 'ALLOW_NESTED_VM_ACCESS' for consistency with other static config key naming conventions.
public static final ConfigKey<Boolean> AllowNestedVMAccess = new ConfigKey<>("Advanced", Boolean.class, "allow.nested.vm.access",

Comment on lines +4849 to +4850
if (getAllowNestedVMAccess())
return true; // If nested VM is allowed, then we skip call to security group and allow bypassing firewall
Copy link
Preview

Copilot AI May 5, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding braces around the single-line if statement to enhance readability and reduce potential errors in future modifications.

Suggested change
if (getAllowNestedVMAccess())
return true; // If nested VM is allowed, then we skip call to security group and allow bypassing firewall
if (getAllowNestedVMAccess()) {
return true; // If nested VM is allowed, then we skip call to security group and allow bypassing firewall
}

Copilot uses AI. Check for mistakes.

Copy link

codecov bot commented May 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 4.00%. Comparing base (fd74895) to head (7821838).
Report is 4 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (fd74895) and HEAD (7821838). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (fd74895) HEAD (7821838)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #10812       +/-   ##
=============================================
- Coverage     16.40%    4.00%   -12.41%     
=============================================
  Files          5692      399     -5293     
  Lines        501962    32597   -469365     
  Branches      60791     5783    -55008     
=============================================
- Hits          82353     1305    -81048     
+ Misses       410455    31142   -379313     
+ Partials       9154      150     -9004     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -4846,6 +4846,8 @@ protected long getMemoryFreeInKBs(Domain dm) throws LibvirtException {
}

private boolean canBridgeFirewall(final String prvNic) {
Copy link
Member

Choose a reason for hiding this comment

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

the method in LibvirtComputingResource are executed on the kvm host (part of cloudstack-agent)
The host cannot access the database.
so, this won't work.

a feasible way is, adding a setting to agent.properties

Sign up for free to 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.

2 participants