Error: The operation is not allowed in current state when deleting orphaned Rancher volume
search cancel

Error: The operation is not allowed in current state when deleting orphaned Rancher volume

book

Article ID: 449033

calendar_today

Updated On:

Products

VMware Cloud Native Runtimes VMware vCenter Server 8.0 VMware vCenter Server

Issue/Introduction

  • Attempting to manually delete a virtual disk using the govc disk.rm command fails with the following error: Error: The operation is not allowed in the current state
  • The target disk is a First Class Disk (FCD) utilized as a Cloud Native Storage (CNS) Persistent Volume within a Rancher cluster.
  • The virtual disk is orphaned from the Rancher cluster and is not found within the vCenter CNS database.
  • Note: This article is strictly scoped to Rancher environments where the virtual disk is orphaned and the sole purpose of the operation is to permanently remove the orphaned disk.
  • Reviewing the vpxd.log confirms the API fault due to an active attachment: error vpxd[...] Disk with ID = #### is attached vim.vslm.vcenter.VStorageObjectManager.deleteVStorageObject: :vim.fault.InvalidState

Environment

  • VMware Cloud Native Runtimes (VMware Cloud Native Runtimes)
  • VMware vCenter Server (VMware vCenter Server)

Cause

The deletion command fails because the First Class Disk (FCD) is actively mounted to a Rancher worker node in the vCenter inventory. The vCenter VStorageObjectManager explicitly locks storage objects from manual deletion while an active attachment state exists to prevent data corruption, despite the volume being orphaned and untracked by the CNS database.

Resolution

  1. Navigate to the vSphere Client and identify the specific Rancher worker node VM that the orphaned virtual disk is currently attached to.
  2. Manually detach the orphaned virtual disk from the worker node by executing the following command: govc disk.detach -vm <worker-node-vm-name> ####
  3. Once the attachment state clears and the VStorageObjectManager lock releases, execute the deletion command again to successfully remove the virtual disk: govc disk.rm -k -dc=<dc> -ds=<ds> ####