Skip to content

Allow snapshots of CKS node and Shared FileSystem VM volumes - #14901

Open
bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:cks-snapshot-guard
Open

bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:cks-snapshot-guard

Conversation

@bhouse-nexthop

Copy link
Copy Markdown
Collaborator

Description

Fixes #14900

Volume snapshots and snapshot policies are refused for CKS node volumes built from the SYSTEM-type system VM template (the CKS default), with "Creating snapshot against System VM volumes is not supported". Shared FileSystem VM root volumes are refused the same way.

The guard in VolumeApiServiceImpl.isOperationSupported and SnapshotManagerImpl.createPolicy was:

SYSTEM && (userVm == null || !CKS_NODE.equals(type) || !SHAREDFSVM.equals(type))

No VM is both types, so it was always true. #9208 added the SHAREDFSVM term to exempt Shared FileSystem VMs as well, as it did in the deploy check in UserVmManagerImpl (!CKS_NODE.equals(vmType) && !SHAREDFSVM.equals(vmType)), but with || it removed the CKS exemption instead. This changes || to && in both places.

Volume from a SYSTEM template, attached to Before After
CKS node refused allowed
Shared FileSystem VM refused allowed
other user VM refused refused
system VM, router, or detached refused refused

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?

  • Unit tests for both guards: CKS node and Shared FileSystem VM allowed, other user VM and no VM refused, USER template allowed. VolumeApiServiceImplTest and SnapshotManagerImplTest: 192 passed. Without the fix the 4 "allowed" tests fail.
  • Not tested yet: a snapshot of a live CKS node volume on a lab.

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

  • Volumes of system VMs and routers still have no user VM row, so they are still refused.
  • A volume created from a snapshot of a CKS node root volume keeps the SYSTEM template id, so its own snapshots are refused unless it is attached to a CKS node. That is unchanged and not handled here.

The guard that refuses snapshots of volumes built from a SYSTEM template
checked "!CKS_NODE || !SHAREDFSVM". No VM is both, so the check was
always true and volumes of CKS nodes and Shared FileSystem VMs were
refused, both for snapshots and for snapshot policies. Use && as the
deploy check in UserVmManagerImpl does.

Signed-off-by: Brad House <bhouse@nexthop.ai>
@codecov

codecov Bot commented Nov 29, 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 18.33%. Comparing base (a8735b2) to head (07faa5c).

Files with missing lines Patch % Lines
...om/cloud/storage/snapshot/SnapshotManagerImpl.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14901      +/-   ##
============================================
- Coverage     18.34%   18.33%   -0.01%     
- Complexity    16671    16675       +4     
============================================
  Files          5939     5939              
  Lines        537817   537817              
  Branches      65938    65938              
============================================
- Hits          98640    98634       -6     
- Misses       427954   427957       +3     
- Partials      11223    11226       +3     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.43% <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.

@bhouse-nexthop

Copy link
Copy Markdown
Collaborator Author

Tested on a KVM lab running a main (24.0) build, first without this change and then with it. Primary storage is Ceph RBD. The CKS cluster is Kubernetes 1.33.1 on the default (SYSTEM-type) system VM template, 1 control and 1 worker node. The same cluster was kept across the upgrade.

Check Without the change With the change
Snapshot of the control node's ROOT volume refused, error 4350 "Creating snapshot against System VM volumes is not supported" BackedUp; snapshot_store_ref is on primary storage, and rbd snap ls on the volume's image lists it
Snapshot policy on the worker's ROOT volume refused, same error created
Snapshot of the secondary storage VM's ROOT volume (control) refused refused, same error

All checks gave the expected result: 7 of 7 without the change, 9 of 9 with it. The snapshot, the policy and the cluster were deleted afterwards.

Not tested: Shared FileSystem VM volumes (unit tests only), and a snapshot of a volume created from a CKS node snapshot.

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.

1 participant