Skip to content

Allow maintenance mode for a disabled primary storage pool - #14935

Open
jmsperu wants to merge 1 commit into
apache:mainfrom
jmsperu:fix-14793-maintenance-disabled-pool
Open

jmsperu wants to merge 1 commit into
apache:mainfrom
jmsperu:fix-14793-maintenance-disabled-pool

Conversation

@jmsperu

@jmsperu jmsperu commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR allows a primary storage pool that is in Disabled state to be put into maintenance mode, and returns it to Disabled when maintenance is cancelled.

Today enableStorageMaintenance is refused for a disabled pool ("is not ready for migration, as the status is:Disabled"), so an operator who has disabled a pool to stop new allocations must enable it again, and so reopen it for allocation, before maintenance can start.

Changes:

  • StorageManagerImpl.preparePrimaryStorageForMaintenance accepts Disabled in addition to Up and ErrorInMaintenance, and records in the pool details (disabledBeforeMaintenance) that the pool was disabled. The same is done for the children of a datastore cluster.
  • PrimaryDataStoreHelper.cancelMaintain returns the pool to Disabled when that detail is present and removes it; otherwise the pool goes to Up as before. All storage provider lifecycles go through this helper, so no provider change is needed.
  • UI: the "Enable maintenance mode" action is shown for pools in Disabled state.

Fixes #14793

Types of changes

  • Enhancement (improves an existing feature and functionality)

How Has This Been Tested?

Unit tests added for both paths (PrimaryDataStoreHelperTest, StorageManagerImplTest).

Manual test on a KVM lab with a second NFS primary storage pool holding one running VM (change backported to 4.22.1.1):

Case Result
Without the change: disable, then enable maintenance refused (error 431, status is Disabled)
Pool Up: maintenance, cancel Maintenance (VM stopped), then Up (VM started again)
Pool Disabled: maintenance accepted, Maintenance, VM stopped
Cancel maintenance on that pool pool returns to Disabled, detail removed, VM started again
Enable the pool Up
Pool Up again: maintenance, cancel Up (no stale record)

In every case the VM's volume stayed on the same pool: maintenance stops the VMs and cancel starts them again, volumes are not migrated.

A disabled primary storage pool could not be put in maintenance: the API
accepted only pools in Up or ErrorInMaintenance and the UI hid the action.
Disabling a pool first is the usual step before taking it out of service.

The Disabled state is now accepted. The pool is marked with a detail when
maintenance starts, and cancelling the maintenance returns it to Disabled
instead of enabling it.

Fixes apache#14793
@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.57143% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.07%. Comparing base (578ca52) to head (22c76a8).

Files with missing lines Patch % Lines
...ain/java/com/cloud/storage/StorageManagerImpl.java 66.66% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              main   #14935       +/-   ##
============================================
+ Coverage     3.86%   21.07%   +17.21%     
- Complexity       0    21283    +21283     
============================================
  Files          494     6058     +5564     
  Lines        42890   549864   +506974     
  Branches      8142    73537    +65395     
============================================
+ Hits          1657   115887   +114230     
- Misses       41001   420351   +379350     
- Partials       232    13626    +13394     
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests 22.53% <78.57%> (?)

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.

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.

storage pool maintenance

1 participant