Skip to content

KVM: allow cluster-wide storage pools for VM deployment from volumes - #14362

Draft
weizhouapache wants to merge 1 commit into
apache:mainfrom
weizhouapache:24-allow-vm-deployment-from-volume-on-cluster-wide
Draft

weizhouapache wants to merge 1 commit into
apache:mainfrom
weizhouapache:24-allow-vm-deployment-from-volume-on-cluster-wide

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

Description

Allow both ZONE and CLUSTER scoped storage pools for VM deployment from existing volumes and snapshots. Previously only ZONE-scoped pools were accepted, restricting deployment flexibility for cluster-wide storage configurations like NFS and RBD pools.

Update validation in UserVmManagerImpl to accept CLUSTER scope alongside ZONE scope, and update error messages accordingly.

Update test_vm_lifecycle_with_snapshot_or_volume.py smoke tests to:

  • Accept both ZONE and CLUSTER scoped storage pools
  • Add RBD-specific handling for snapshot lifecycle (snapshots cannot outlive source volumes on RBD with snapshot.backup.to.secondary=false)
  • Skip unsupported test scenarios on RBD backends
  • Fix VM creation to use service configs instead of hardcoded values
  • Add reconnect logic to SSH client initialization
  • Remove unused uuid import

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?

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

Allow both ZONE and CLUSTER scoped storage pools for VM deployment from
existing volumes and snapshots. Previously only ZONE-scoped pools were
accepted, restricting deployment flexibility for cluster-wide storage
configurations like NFS and RBD pools.

Update validation in UserVmManagerImpl to accept CLUSTER scope alongside
ZONE scope, and update error messages accordingly.

Update test_vm_lifecycle_with_snapshot_or_volume.py smoke tests to:
- Accept both ZONE and CLUSTER scoped storage pools
- Add RBD-specific handling for snapshot lifecycle (snapshots cannot
  outlive source volumes on RBD with snapshot.backup.to.secondary=false)
- Skip unsupported test scenarios on RBD backends
- Fix VM creation to use service configs instead of hardcoded values
- Add reconnect logic to SSH client initialization
- Remove unused uuid import
@weizhouapache

Copy link
Copy Markdown
Member Author

@slavkap
Good job on #10503, which adds the option to deploy a VM with an existing volume or snapshot.

I noticed that you restrict the available options to zone-wide primary storage. Did you encounter any issues when testing with cluster-wide storage pools?

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 19.90%. Comparing base (17294ca) to head (ab03d6a).

Files with missing lines Patch % Lines
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14362      +/-   ##
============================================
- Coverage     19.91%   19.90%   -0.01%     
+ Complexity    20198    20196       -2     
============================================
  Files          6373     6373              
  Lines        577234   577235       +1     
  Branches      70696    70697       +1     
============================================
- Hits         114945   114925      -20     
- Misses       449724   449747      +23     
+ Partials      12565    12563       -2     
Flag Coverage Δ
uitests 3.70% <ø> (ø)
unittests 21.18% <66.66%> (-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.

@weizhouapache
weizhouapache requested a lite review from Copilot October 8, 2026 12:28
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open findings
What changed in this PR

Expands VM deployment-from-volume support to include CLUSTER-scoped primary storage pools (in addition to ZONE), and aligns smoke tests to work across shared-storage backends like NFS and RBD.

Changes:

  • Allow CLUSTER scope in UserVmManagerImpl volume datastore validation and update related unit-test assertions.
  • Update VM lifecycle smoke tests to accept ZONE/CLUSTER pools, add RBD-specific skips/behavior, and improve SSH reconnect behavior.
File Description
test/​integration/​smoke/​test_vm_lifecycle_with_snapshot_or_volume.py Broadens pool selection to include cluster-scoped NFS/RBD, adds RBD snapshot lifecycle constraints, and adjusts VM creation/SSH behavior in smoke tests.
server/​src/​test/​java/​com/​cloud/​vm/​UserVmManagerImplTest.java Updates expected validation error message to reflect acceptance of CLUSTER-scoped pools.
server/​src/​main/​java/​com/​cloud/​vm/​UserVmManagerImpl.java Updates volume datastore scope validation to accept CLUSTER in addition to ZONE for deploy-from-volume.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment on lines +7014 to +7016
|| (!ScopeType.ZONE.equals(volume.getDataStore().getScope().getScopeType())
&& !ScopeType.CLUSTER.equals(volume.getDataStore().getScope().getScopeType())))) {
throw new InvalidParameterValueException("Deployment of virtual machine is supported only for Zone-wide or Cluster-wide storage pools");
parent volume destroys the snapshot too - it can no longer be
used to deploy a new volume/VM afterward.
'''
return self.storage_pool.type == 'RBD'
Comment on lines +91 to +106
# Prefer a zone-wide pool, but also accept a cluster-scope NFS/RBD pool.
storage_pools_response = list_storage_pools(cls.apiclient,
zoneid=cls.zone.id,
scope="ZONE")

if not storage_pools_response:
cluster_storage_pools = list_storage_pools(cls.apiclient,
zoneid=cls.zone.id,
scope="CLUSTER") or []
storage_pools_response = [
pool for pool in cluster_storage_pools
if getattr(pool, "type", None) in ("NetworkFilesystem", "RBD")
]

if storage_pools_response:
cls.zone_wide_storage = storage_pools_response[0]
cls.storage_pool = storage_pools_response[0]
Comment on lines +198 to 205
self.services['small'],
accountid=self.account.name,
domainid=self.account.domainid,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=template.id,
mode="basic",
mode=self.services['mode'],
)
@blueorangutan

Copy link
Copy Markdown

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

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

Labels

component:integration-test Python Warning... Python code Ahead!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants