Hi everybody,
we have a little script which detaches a lun/datastore from one or more hosts in a cluster. that works fine but we want to expand this now with the command 'esxcli storage core device detached remove' that the lun ID will also deleted from the host (to prevent a PDL).
i've tried to do this with the help of this documentation: VMware vSphere 6.5 Documentation Library
commands for detaching:
$hostesxcli.storage.core.device.set.Invoke(@{device='naa.60080e5000243010000005ff5b2123ab';state='off'})
-> device has now state off and isn't visible anymore in vcenter
$hostesxcli.storage.core.device.detached.list.invoke()
-> showing me the detached lun on host
$hostesxcli.storage.core.device.detached.remove.Invoke(@{device='naa.60080e5000243010000005ff5b2123ab'})
-> removes the lun ID from host
--> here is the problem! after this removing the lun is now visible again in vcenter after a HBA rescan. when i see the details for this lun with command:
$hostesxcli.storage.core.device.list.invoke(@{device='naa.60080e5000243010000005ff5b2123ab'})
the state is now 'on' again.
in this state i wouldn't delete the lun in our san environment because i think this will be causes a PDL.
could you help me pls or explain me the correct commands?
Thanks in advance!