All,
Using Luc's detach function here: http://www.lucd.info/2011/11/25/lun-juggling-in-vsphere-5/
When I try ot detach one of my unmounted lun's by name it says it cannot find the object. Any help?
Does the CanonicalName you pass to the function appear in
Get-ScsiLun -VMHost YourEsxHostName | Select CanonicalName
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Canonical LUN is actually showing the NAA id's instead of the name when i run that command
And did you pass one of those NAA id's to the function ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc,
Is the canonical name the NAA id and not the actual datastore name? I was passing the actual name of the datastore as opposed ot NAA id is this not correct?
Yes, in the function I filter out the LUN involved by ways of the LUN-id (that happens in the Where-clause).
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah so canonical name is the datastore name or the naa id? In theory i should be abel to do it by the datastore name right?
IE can i use this:
detach-disk -vmhost esx -CanonicalName datastore_name
or do I have to do this?
detach-disk -vmhost
$esx -CanonicalName naa.23049817123094871234901823
The 2nd line
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah i modiefied your function the other day to do NAA because i didn't realize that canonical is same as NAA id and it worked without this line: $lunUuid
= (Get
-ScsiLun
-VmHost
$VMHost
|
where
{$_.CanonicalName
-eq $
CanonicalName
}).ExtensionData.Uuid
What is the purpose of the above line if it works without it?
function
Detach-Disk{
param(
[
VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl]$VMHost,
[
string]$naa
)
$storSys = Get-View $VMHost.Extensiondata.ConfigManager.StorageSystem
$storSys.DetachScsiLun($naa)
}
The DetachScsiLun method I use in the function requires a UUID as a parameter.
It's possible that for some types of storage this NAA is the same as the UUID, but on the storage where I tested my function, it wasn't.
Hence the Where-clause construction to get the correct UUID, starting from the CanonicalName
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah understood, as always thanks for the help! Now to begin my mass detach of 100 luns from 50 systems lol