Repository navigation
Cannot cancel maintenance mode of a primary storage v4.21 #11764
Copy link
Copy link
Description
problem
Zone-wide storage:
If there are virtual machines on specific primary storage and that storage is set to Maintenance mode it is not possible to cancel the maintenance mode if the agents in the zone were restarted.
Cluster-wide storage pool:
If there are virtual machines on such pool, and the pool is set to maintenance and after that if we try to cancel the maintenance mode it's not possible
versions
4.21
Zone-wide primary storage - StorPool and NFS
Cluster-wide primary storage - NFS
The steps to reproduce the bug
All VMs are created with service offering that have storage tags. I haven't tested it without tags
Zone-wide pool:
- deploy a VM
- enable maintenance mode of the storage pool
- force reconnect all host in the zone from the UI (or restart the cloudstack-agent service)
- cancle maintenance mode of the storage pool
Cluster-wide
- deploy a VM
- enable maintenance mode
- cancle maintenance mode
2025-09-30 14:09:42,578 DEBUG [o.a.c.s.a.ClusterScopeStoragePoolAllocator] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Found pools [[]] that match with tags [[nfs-c
luster2]].
2025-09-30 14:09:42,578 DEBUG [o.a.c.s.a.ClusterScopeStoragePoolAllocator] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) No storage pools available for [shared] volum
e allocation.
2025-09-30 14:09:42,578 DEBUG [o.a.c.s.a.ClusterScopeStoragePoolAllocator] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Using volume allocation algorithm random to r
eorder pools.
2025-09-30 14:09:42,578 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Trying to find suitable pools to allocate volume [Vo
lume {"id":562,"instanceId":380,"name":"ROOT-380","uuid":"bb7f3c0b-19f8-4be1-a6ce-bf29cff9a0ff","volumeType":"ROOT"}] necessary to deploy VM [VM instance {"id":380,"instanceName":"i-2-380-VM","state":"Startin
g","type":"User","uuid":"f4f66160-a169-4b4a-8729-df528c516c33"}], using StoragePoolAllocator: [ZoneWideStoragePoolAllocator].
2025-09-30 14:09:42,580 DEBUG [o.a.c.s.a.ZoneWideStoragePoolAllocator] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Could not find any zone wide storage pool that ma
tched with any of the following tags [[nfs-cluster2]].
2025-09-30 14:09:42,581 DEBUG [o.a.c.s.a.ZoneWideStoragePoolAllocator] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) ZoneWideStoragePoolAllocator is returning [0] sui
table storage pools [[]].
2025-09-30 14:09:42,581 DEBUG [o.a.c.s.a.ZoneWideStoragePoolAllocator] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Using volume allocation algorithm random to reord
er pools.
2025-09-30 14:09:42,581 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) No suitable pools found for volume [Volume {"id":562
,"instanceId":380,"name":"ROOT-380","uuid":"bb7f3c0b-19f8-4be1-a6ce-bf29cff9a0ff","volumeType":"ROOT"}] used by VM [VM instance {"id":380,"instanceName":"i-2-380-VM","state":"Starting","type":"User","uuid":"f
4f66160-a169-4b4a-8729-df528c516c33"}] under cluster: [3].
2025-09-30 14:09:42,581 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) No suitable pools found
2025-09-30 14:09:42,581 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) No suitable storagePools found under this Cluster: C
luster {id: "3", name: "Cluster-A-2", uuid: "bd8f0dce-1699-4879-8804-04713a1a87ee"}
2025-09-30 14:09:42,583 DEBUG [c.c.d.DeploymentPlanningManagerImpl] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Could not find suitable Deployment Destination for t
his VM under any clusters, returning.
2025-09-30 14:09:42,584 DEBUG [c.c.d.FirstFitPlanner] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Searching resources only under specified Pod: HostPod {"id":1,"nam
e":"Pod-A","uuid":"f1cb86a7-ea4f-4211-a104-dd501578d7e4"}
2025-09-30 14:09:42,584 DEBUG [c.c.d.FirstFitPlanner] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Listing clusters in order of aggregate capacity, that have (at lea
st one host with) enough CPU and RAM capacity under this Pod: 1
2025-09-30 14:09:42,585 DEBUG [c.c.d.FirstFitPlanner] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) CapacityType: CPU is used for Cluster ordering
2025-09-30 14:09:42,586 DEBUG [c.c.d.FirstFitPlanner] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Removing from the clusterId list these clusters from avoid set: [1
, 3]
2025-09-30 14:09:42,587 DEBUG [c.c.d.FirstFitPlanner] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) No clusters found after removing disabled clusters and clusters in
avoid list, returning.
2025-09-30 14:09:42,594 DEBUG [c.c.c.CapacityManagerImpl] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) VM instance {"id":380,"instanceName":"i-2-380-VM","state":"Sto
pped","type":"User","uuid":"f4f66160-a169-4b4a-8729-df528c516c33"} state transited from [Starting] to [Stopped] with event [OperationFailed]. VM's original host: Host {"id":7,"name":"cs-dev-kvm-3-4","type":"R
outing","uuid":"e078cdb7-8819-43b2-a2c9-262788ad6099"}, new host: null, host before state transition: null
2025-09-30 14:09:42,598 ERROR [c.c.v.VmWorkJobHandlerProxy] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Invocation exception, caused by: com.cloud.exception.Insuffi
cientServerCapacityException: Unable to create a deployment for VM instance {"id":380,"instanceName":"i-2-380-VM","state":"Starting","type":"User","uuid":"f4f66160-a169-4b4a-8729-df528c516c33"}Scope=interface com.cloud.dc.DataCenter; id=1
2025-09-30 14:09:42,599 INFO [c.c.v.VmWorkJobHandlerProxy] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445, ctx-59178917]) (logid:51ee9166) Rethrow exception com.cloud.exception.InsufficientServerCapa
cityException: Unable to create a deployment for VM instance {"id":380,"instanceName":"i-2-380-VM","state":"Starting","type":"User","uuid":"f4f66160-a169-4b4a-8729-df528c516c33"}Scope=interface com.cloud.dc.D
ataCenter; id=1
2025-09-30 14:09:42,599 DEBUG [c.c.v.VmWorkJobDispatcher] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445]) (logid:51ee9166) Done with run of VM work job: com.cloud.vm.VmWorkStart for VM 380, job origi
n: 5444
2025-09-30 14:09:42,599 ERROR [c.c.v.VmWorkJobDispatcher] (Work-Job-Executor-15:[ctx-6b4bcd04, job-5444/job-5445]) (logid:51ee9166) Unable to complete AsyncJob {"accountId":2,"cmd":"com.cloud.vm.VmWorkStart",
"cmdInfo":"rO0ABXNyABhjb20uY2xvdWQudm0uVm1Xb3JrU3RhcnR9cMGsvxz73gIAC0oABGRjSWRMAAZhdm9pZHN0ADBMY29tL2Nsb3VkL2RlcGxveS9EZXBsb3ltZW50UGxhbm5lciRFeGNsdWRlTGlzdDtMAAljbHVzdGVySWR0ABBMamF2YS9sYW5nL0xvbmc7TAAGaG9zd
ElkcQB-AAJMAAtqb3VybmFsTmFtZXQAEkxqYXZhL2xhbmcvU3RyaW5nO0wAEXBoeXNpY2FsTmV0d29ya0lkcQB-AAJMAAdwbGFubmVycQB-AANMAAVwb2RJZHEAfgACTAAGcG9vbElkcQB-AAJMAAlyYXdQYXJhbXN0AA9MamF2YS91dGlsL01hcDtMAA1yZXNlcnZhdGlvbklkc
QB-AAN4cgATY29tLmNsb3VkLnZtLlZtV29ya5-ZtlbwJWdrAgAESgAJYWNjb3VudElkSgAGdXNlcklkSgAEdm1JZEwAC2hhbmRsZXJOYW1lcQB-AAN4cAAAAAAAAAACAAAAAAAAAAIAAAAAAAABfHQAGVZpcnR1YWxNYWNoaW5lTWFuYWdlckltcGwAAAAAAAAAAHBwcHBwcHBwc
HA","cmdVersion":0,"completeMsid":null,"created":"Tue Sep 30 14:09:41 UTC 2025","id":5445,"initMsid":2199191191555,"instanceId":null,"instanceType":null,"lastPolled":null,"lastUpdated":null,"processStatus":0,
"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":2,"uuid":"68e14887-3529-4f40-a73d-1960007af720"}, job origin: 5444 com.cloud.exception.InsufficientServerCapacityException: Unable t
o create a deployment for VM instance {"id":380,"instanceName":"i-2-380-VM","state":"Starting","type":"User","uuid":"f4f66160-a169-4b4a-8729-df528c516c33"}Scope=interface com.cloud.dc.DataCenter; id=1
at com.cloud.vm.VirtualMachineManagerImpl.orchestrateStart(VirtualMachineManagerImpl.java:1451)
What to do about it?
No response
Reactions are currently unavailable
Activity
nvazquez commentedon Sep 30, 2025
Hi @slavkap I could replicate it on 4.21 but not on main branch with NFS cluster-wide storage, was able to cancel maintenance mode properly.
@harikrishna-patnala @weizhouapache maybe worth checking also zone-wide NFS on main branch and 4.20
weizhouapache commentedon Sep 30, 2025
@nvazquez
Any error logs ?
nvazquez commentedon Sep 30, 2025
Hi @weizhouapache for 4.21:
slavkap commentedon Oct 1, 2025
thanks @nvazquez, for testing it! I will check it also on the main for the zone-wide
slavkap commentedon Oct 1, 2025
@nvazquez, I've upgraded my env. 4.21 with the main, and unfortunately got the same issue with cluster-wide pool too
weizhouapache commentedon Oct 1, 2025
it might be related to #9903
cc @sureshanaparti
PS: it worked in my testing on acs 4.20 and 4.21
nvazquez commentedon Oct 1, 2025
@slavkap @weizhouapache @harikrishna-patnala in my initial test on 4.21 I was not using storage tags and could replicate the issue. However, repeated the test using storage tags on the cluster-wide pools and service offering for the VM deployment and was able to cancel maintenance properly. Could it be an issue with tags looking for VM deployments after cancelling maintenance mode?
weizhouapache commentedon Oct 1, 2025
actually what make me confused is: why volumes are migrated during vm start when cancel storage maintenance, it does not make any sense.
In that scanario, the storage should be available for vm start/deployment, right ?
maybe we should mark the storage as Up at first, then start the vms which are stopped when enable storage maintenance.
nvazquez commentedon Oct 1, 2025
@weizhouapache yes it is strange, in some cases it migrated the volume but other cases the volume stayed on the pool in maintenance. However, to cancel the maintenance mode properly the pool in Up state should match the storage tag of the pool in maintenance in order to succeed, otherwise the VM deployment failed and couldn't cancel maintenance for the pool
slavkap commentedon Oct 1, 2025
@weizhouapache, in my case I have one NFS cluster-wide, 1 NFS zone-wide and 2 StorPool zone-wide pools, and the VMs are stopped. After that it cannot find pool with the matching tag to start the VM. The SQL query is looking for pools with status=Up and matching tags
I agree with this one ^^
weizhouapache commentedon Oct 1, 2025
@slavkap @nvazquez
I just found that the behavior on storpool pools is same as we agreed when cancel storage migration .....
cloudstack/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/StorPoolPrimaryDataStoreLifeCycle.java
Lines 238 to 245 in cd12fa5
created a draft PR: #11773
slavkap commentedon Oct 2, 2025
thanks, @weizhouapache, I think this should fix part of the issue. If the agent is restarted during pool maintenance, the cancel maintenance will still fail. I think here
cloudstack/server/src/main/java/com/cloud/storage/StoragePoolAutomationImpl.java
Line 366 in cd12fa5
we should include a check if there is a record in the storage_pool_host_ref DB table and if not to add such for the pool with the host
weizhouapache commentedon Oct 2, 2025
make sense.
added a commit :
https://github.com/apache/cloudstack/pull/11773/files#diff-2ae1a642d4b460abaeaed7f34f604fa1026e4c4232b0df899bfda216d9742186
weizhouapache commentedon Oct 8, 2025
fixed by #11773
[-]Cannot cancle maintenance mode of a primary storage v4.21[/-][+]Cannot cancel maintenance mode of a primary storage v4.21[/+]