Detaching a storage LUN from a ESXi host failed with "The resource '<<vml_id>>' is in use."
search cancel

Detaching a storage LUN from a ESXi host failed with "The resource '<<vml_id>>' is in use."

book

Article ID: 426983

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vCenter Server

Issue/Introduction

  • Detaching a storage LUN from ESXi host(s) fails with "The resource '<<vml_id>>' is in use."
  • When unpresenting or decommissioning a storage device from ESXi host(s), administrator needs to detach the device from all visible host(s) but some host fails with this error.
  • In vpxd.log, following error is found.
    YYYY-MM-DDTHH:MM:SS.mmmZ info vpxd[12340] [Originator@6876 sub=Default opID=<<opid>>] [VpxLRO] -- ERROR task-20303 -- storageSystem-30 -- vim.host.StorageSystem.detachScsiLun: vim.fault.ResourceInUse:
    --> Result:
    --> (vim.fault.ResourceInUse) {
    -->    faultCause = (vmodl.MethodFault) null,
    -->    faultMessage = <unset>,
    -->    type = "Can't Detach RDM LUN",
    -->    name = "<<vml_id>>"
    -->    msg = "Received SOAP response fault from [<SSL(), /vpxa>]: detachScsiLun
    --> Received SOAP response fault from [ /sdk>]: detachScsiLun
    --> The resource '<<vml_id>>' is in use."
    --> }
    --> Args:
    -->
    --> Arg lunUuid:
    --> "<<vml_id>>"
  • In hostd.log, following error is found.

    YYYY-MM-DDTHH:MM:SS.mmmZ info hostd[2102689] [Originator@6876 sub=Vimsvc.TaskManager opID=<<opid>> user=<<user_name>>] Task Completed : haTask-ha-host-vim.host.StorageSystem.detachScsiLun-86249828 Status error

    YYYY-MM-DDTHH:MM:SS.mmmZ info hostd[2102689] [Originator@6876 sub=Solo.Vmomi opID=<<opid>> user=<<user_name>>] Throw vim.fault.ResourceInUse
    YYYY-MM-DDTHH:MM:SS.mmmZ info hostd[2102689] [Originator@6876 sub=Solo.Vmomi opID=<<opid>> user=<<user_name>>] Result:
    --> (vim.fault.ResourceInUse) {
    -->    type = "Can't Detach RDM LUN",
    -->    name = "<<vml_id>>",
    -->    msg = "",
    --> }

Environment

VMware vSphere ESXi

VMware vSphere vCenter server

Cause

Some Virtual machine(s) still attaches the device (LUN) as a RDM device and when detaching the LUN, hostd (RDMManager) checks it is registered(VM attaches the device) or not and throws an error if it is registered in some VM(s).

Resolution

  • Find the virtual machine(s) which still attaches the device as RDM and remove that device from the VM(s). And try to detach the device again.
  • How to find the VM(s) which attaches the specific device (vml) as a RDM ?

    Following PowerCLI command shows us the virtual machine name and the disk number if the specified vml is attached to the VM.

    PS> Get-VM | Get-HardDisk -Disktype "RawPhysical","RawVirtual" | Where-Object {$_.DeviceName -eq "vml.<<vml_id>>"} | Format-Table -Property  Parent,DeviceName,Name -Autosize

    Parent        DeviceName       Name
    ------        ----------       ----
    <<VM_Name>>  vml.<<vml_id>>    Hard disk 3