Skip to content

CLVM: remove inactive libvirt pool on storage pool delete and stop autostartign CLVM pools - #14379

Open
Pearl1594 wants to merge 2 commits into
mainfrom
clvm-delete-storage
Open

Pearl1594 wants to merge 2 commits into
mainfrom
clvm-delete-storage

Conversation

@Pearl1594

@Pearl1594 Pearl1594 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes: #14204
CLVM/CLVM_NG pools are deliberately kept inactive in libvirt, because LVM is driven directly with vgs/lvs. ClvmStorageAdaptor had no deleteStoragePool of its own, so it used the generic LibvirtStorageAdaptor version. That version calls destroy() on the pool, and libvirt rejects destroy() on an inactive pool. As a result, a CLVM pool could not be deleted, and enabling maintenance on it failed the same way.

With this fix, deleting the pool in CloudStack only removes the CloudStack record and the libvirt pool definition on each host. It does not touch the volume group or the shared storage behind it. The VG, the lvmlockd/sanlock lockspace are left as they are, as CloudStack does not set any of these up. It only checks that the VG exists when the pool is added.
Tearing them down is the operator's responsibility, for example vgchange --lockstop, vgremove, iSCSI logout and releasing the LUNs.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Added a CLVM_NG/ CLVM pool
Put it in maintenance
Deleted the pool - Observed that the records were marked removed in the DB and the virsh pool-list --all no longer showed the volume group.

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

Copilot AI balanced review requested due to automatic review settings October 9, 2026 20:48
@Pearl1594
Pearl1594 requested a review from nvazquez October 9, 2026 20:49
@Pearl1594 Pearl1594 added this to the 24.0 milestone Oct 9, 2026

Copilot AI 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.

🟡 Changes recommended

Error handling, resource cleanup, and an existing failing test must be addressed.

4 open findings
What changed in this PR

Fixes CLVM/CLVM_NG pool deletion by handling inactive libvirt pools correctly.

Changes:

  • Adds CLVM-specific pool deletion.
  • Disables libvirt autostart for CLVM pools.
File Description
ClvmStorageAdaptor.java Undefines CLVM pools without requiring activation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@@ -290,7 +326,6 @@ private StoragePool createCLVMStoragePool(Connect conn, String uuid, String host
try {
StoragePool pool = conn.storagePoolDefineXML(poolDef.toString(), 0);
logger.info("Created libvirt pool definition for CLVM/CLVM_NG VG: {} (pool will remain inactive)", volgroupName);
}
}

private boolean undefineInactiveClvmPool(Connect conn, String uuid) throws LibvirtException {
@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.37500% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.22%. Comparing base (68cff97) to head (4ecc286).

Files with missing lines Patch % Lines
...oud/hypervisor/kvm/storage/ClvmStorageAdaptor.java 84.37% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #14379   +/-   ##
=========================================
  Coverage     20.21%   20.22%           
- Complexity    20750    20759    +9     
=========================================
  Files          6426     6426           
  Lines        580181   580212   +31     
  Branches      71033    71038    +5     
=========================================
+ Hits         117287   117333   +46     
+ Misses       450180   450159   -21     
- Partials      12714    12720    +6     
Flag Coverage Δ
uitests 3.69% <ø> (ø)
unittests 21.51% <84.37%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 20:57

Copilot AI 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.

🟡 Changes recommended

Active-pool deletion can deactivate the backing VG, while upgraded pools may retain their existing autostart flag.

4 open findings
2 resolved since last review

🧠 Review effort: Balanced

@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 25.19%
Branch coverage 19.42%

Grade Scale

Grade Line Coverage Meaning
🟢 A ≥ 80% Excellent - this code sleeps well at night 😴
🟡 B 60-79% Good - almost there, don't stop now 😉
🟠 C 40-59% Acceptable - your code is wearing a seatbelt, but no airbags 😬
🔴 D 20-39% Marginal - boldly shipping where no test has gone before 🖖
⛔ F < 20% Failing - tests? what tests? 🔥

Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run

This branch has not been deployed

No deployments
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.

Not able to delete CLVM_NG primary storage (Failed to delete storage pool on host)

2 participants