govc: The operation is not allowed in the current state. error vpxd[53067] [VpxLRO] -- ERROR task-12367968 -- VStorageObjectManager -- vim.vslm.vcenter.VStorageObjectManager.deleteSnapshot: :vim.fault.InvalidState Result: (vim.fault.InvalidState) { msg = "The operation is not allowed in the current state." }
Invalid transition requested (VM_STATE_BRANCH_DISK -> VM_STATE_CONSOLIDATE_DISK_CHAIN): Invalid state
VMware vCenter Server
VMware vSphere ESXi
VMware vSphere Kubernetes Service
VMware vSphere CSI driver
This issue occurs due to concurrency conflicts where a third-party backup tool (e.g., Cohesity using the Velero plugin) is aggressively triggering `VolumeSnapshot` requests. In a VKS environment, the call chain is as follows:
To resolve this, you must stop the incoming snapshot requests to release the VM state lock before performing a manual cleanup.
Manual Cleanup Method:
Step 1: Identify and Stop Backup Workflows
kubectl get volumesnapshot -n <namespace>
kubectl delete volumesnapshot --all -n <namespace>
Step 2: Scale Down CSI Controllers.
To ensure no automated system triggers a snapshot during manual cleanup, scale down the CSI controllers in both the Guest and Supervisor clusters using the command below.kubectl scale deployment vsphere-csi-controller -n vmware-system-csi --replicas=0
Step 3: Perform Manual Cleanup.
With the controllers scaled down, retry the `govc` snapshot removal command:govc disk.snapshot.rm -dc <datacenter> -ds <datastore> <fcd-id> <snapshot-id>
Step 4: Restore Services.
Once the stale snapshots are removed, scale the controllers back up on both the Supervisor and Guest Cluster.kubectl scale deployment vsphere-csi-controller -n vmware-system-csi --replicas=1 (for Guest cluster) kubectl scale deployment vsphere-csi-controller -n vmware-system-csi --replicas=3 (for Supervisor cluster)