Skip to content

Conversation

@StepBee
Copy link
Contributor

@StepBee StepBee commented Sep 13, 2025

Description

This PR fixes reading the libvirt/qemu group name from the libvirtd qemu config file including spaces and quotes,
which is used during the deployment of Host Security Keys.
This PR fixes #11144

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?

Tested renewal of Host Security Keys on Ubuntu 24.04 hosts and stopping and starting VMs afterwards.

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

@boring-cyborg
Copy link

boring-cyborg bot commented Sep 13, 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:

@codecov
Copy link

codecov bot commented Sep 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.17%. Comparing base (6d16ac2) to head (b50a959).
⚠️ Report is 8 commits behind head on 4.20.

Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #11632   +/-   ##
=========================================
  Coverage     16.17%   16.17%           
- Complexity    13296    13299    +3     
=========================================
  Files          5656     5656           
  Lines        498144   498151    +7     
  Branches      60437    60441    +4     
=========================================
+ Hits          80584    80587    +3     
- Misses       408590   408592    +2     
- Partials       8970     8972    +2     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.03% <ø> (+<0.01%) ⬆️

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.

@weizhouapache
Copy link
Member

@StepBee
cool, can you share the cases you have tested ?

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@StepBee
Copy link
Contributor Author

StepBee commented Sep 13, 2025

@StepBee cool, can you share the cases you have tested ?

Sure @weizhouapache , i tested the following cases

group=kvm
group = kvm
group="kvm"
group = "kvm"

@weizhouapache weizhouapache added this to the 4.20.2 milestone Sep 13, 2025
@weizhouapache weizhouapache self-assigned this Sep 13, 2025
@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 14991

@weizhouapache
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@weizhouapache
Copy link
Member

@blueorangutan test ubuntu24 kvm-ubuntu24

@blueorangutan
Copy link

@weizhouapache a [SL] Trillian-Jenkins test job (ubuntu24 mgmt + kvm-ubuntu24) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-14327)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 54958 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11632-t14327-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@blueorangutan
Copy link

[SF] Trillian test result (tid-14328)
Environment: kvm-ubuntu24 (x2), zone: Advanced Networking with Mgmt server u24
Total time taken: 55371 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11632-t14328-kvm-ubuntu24.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

lgtm

verified OK with different settings

@vishesh92 vishesh92 requested a review from Copilot September 15, 2025 06:25
Copy link
Contributor

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 fixes a bug in the Host Security Keys renewal process where QEMU group name parsing from the libvirtd configuration file was failing due to improper handling of spaces and quotes. The fix ensures VMs can start properly after Host Security Keys renewal.

  • Updated QEMU group name extraction logic to handle spaces and quotes in configuration values
  • Fixed regex pattern to match group configuration lines with optional whitespace
  • Improved AWK parsing to correctly extract the group name value

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

lgtm. tested different variations in the conf and qemu group is getting extracted correctly after the changes.

@weizhouapache
Copy link
Member

@StepBee
the commands worked in our testing

however, @Copilot suggested to use the following , which looks more easy

QEMU_GROUP=$(sed -n 's/^group\s*=//p' /etc/libvirt/qemu.conf | tr -d '"' | tr -d ' ' | tail -n1)

also, do we consider single quote in the value, for example group = 'root' ?

@vishesh92
Copy link
Member

@StepBee the commands worked in our testing

however, @Copilot suggested to use the following , which looks more easy

QEMU_GROUP=$(sed -n 's/^group\s*=//p' /etc/libvirt/qemu.conf | tr -d '"' | tr -d ' ' | tail -n1)

also, do we consider single quote in the value, for example group = 'root' ?

I agree with @weizhouapache. IMO we should consider single quotes as well in the configuration.

Simplify and correct qemu group extraction from configfile

Co-authored-by: Wei Zhou <[email protected]>
@StepBee
Copy link
Contributor Author

StepBee commented Sep 15, 2025

@StepBee the commands worked in our testing
however, @Copilot suggested to use the following , which looks more easy

QEMU_GROUP=$(sed -n 's/^group\s*=//p' /etc/libvirt/qemu.conf | tr -d '"' | tr -d ' ' | tail -n1)

also, do we consider single quote in the value, for example group = 'root' ?

I agree with @weizhouapache. IMO we should consider single quotes as well in the configuration.

@StepBee the commands worked in our testing
however, @Copilot suggested to use the following , which looks more easy

QEMU_GROUP=$(sed -n 's/^group\s*=//p' /etc/libvirt/qemu.conf | tr -d '"' | tr -d ' ' | tail -n1)

also, do we consider single quote in the value, for example group = 'root' ?

I agree with @weizhouapache. IMO we should consider single quotes as well in the configuration.

Thank you @vishesh92 @weizhouapache i agree, the awk was not required and it's good to catch single quote as well during this fix.

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

retest the commands with more values, looks good

thanks @StepBee for the update

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15004

@weizhouapache
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@weizhouapache
Copy link
Member

@blueorangutan test ubuntu24 kvm-ubuntu24

@blueorangutan
Copy link

@weizhouapache a [SL] Trillian-Jenkins test job (ubuntu24 mgmt + kvm-ubuntu24) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-14342)

@weizhouapache
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@weizhouapache
Copy link
Member

Merging based on approvals and manual tests

@weizhouapache weizhouapache merged commit 0cbebbd into apache:4.20 Sep 15, 2025
26 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 15, 2025

Awesome work, congrats on your first merged pull request!

@blueorangutan
Copy link

[SF] Trillian test result (tid-14343)
Environment: kvm-ubuntu24 (x2), zone: Advanced Networking with Mgmt server u24
Total time taken: 57682 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11632-t14343-kvm-ubuntu24.zip
Smoke tests completed. 140 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL Failure 423.87 test_vpc_redundant.py

@blueorangutan
Copy link

[SF] Trillian test result (tid-14344)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 61609 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11632-t14344-kvm-ol8.zip
Smoke tests completed. 140 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_redundant_VPC_default_routes Failure 446.18 test_vpc_redundant.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No VMs start after Renew Host Security Keys on newer Ubuntu and newer libvirt

4 participants