VMware Cloud Community
BaskervilleByte
Contributor
Contributor
Jump to solution

How can I rename a device object within esxcli.storage.core.device object...

Hi all,

I have accidentally renamed one of my ESXCLI device objects by using .setconfig.invoke($array)

The $array accidentally contained two values which contained the reference device name along with its IsSharedClusterwide value

I have since corrected this, however unfortunately one of my disk objects now has the following value:

Device : @{Device=<naa.ref>; IsSharedClusterWide=true}

How can I select this one disk object within the esxcli array and correct the device name?

Many thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Strange, are you sure that is actually representing an actual LUN and not some pseudo device?

Did you check in the Web Client under Devices if the original LUN is present or not?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
11 Replies
LucD
Leadership
Leadership
Jump to solution

Does that device show up when you do?

$esxcli.storage.core.device.list.Invoke() | where{$_.DisplayName -match '@{'}


If you have the canonicalname of the LUN, you could try something like this

$canonicalname = 'naa.60003ff44dc75adc9e0192ec73661234'

$esxcli.storage.core.device.set.Invoke(@{device=$canonicalname;name='<newname>'})


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BaskervilleByte
Contributor
Contributor
Jump to solution

Hi LucD,

Many thanks for your reply

Unfortunately it is the canonicalname of the LUN that has been changed, not the displayname

the device value now contains the cononicalname along with the issharedclusterwide value as I did not specify the singular value from the array object

so now I have for this particular disk:

Device          :  @{Device=eui.123456789; IsSharedClusterWide=true}

I have created two new array objects called $Wrong = '@{Device=eui.123456789; IsSharedClusterWide=true' and $Right = 'Device=eui.123456789'

But I cannot see how I reference this object in the esxcli output to then change it immediately after if that makes sense?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Can you share the output of device.list for that specific LUN?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BaskervilleByte
Contributor
Contributor
Jump to solution

Hi LucD,

Below is a snapshot of the affected LUN,

err.jpg

As you can see, Device is unfortunately now incorrect, containing the two object array entry

Thanks

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Strange, are you sure that is actually representing an actual LUN and not some pseudo device?

Did you check in the Web Client under Devices if the original LUN is present or not?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BaskervilleByte
Contributor
Contributor
Jump to solution

No, it does not show up in vcenter and indeed it does seem to be some kind of pseudo device as the disk device type = 'No device type' and it has no associated LUN value

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Does it disappear when you do

$esxcli.storage.core.device.purge.Invoke()


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BaskervilleByte
Contributor
Contributor
Jump to solution

Hi,

I ran the command which ended with true but unfortunately the disk device is still there

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Strange.
I have no clue how you were able to create that entry.
I can't seem to reproduce it.

Since that entry is not visible in the Web Client, I wonder if it is something in the $esxcli object itself.
Have you tried stopping/starting your PowerShell session?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
BaskervilleByte
Contributor
Contributor
Jump to solution

Hi LucD,

Yes I have started a new PS console a few times now and run the script where it stops after changing the first device and it is working as expected

Indeed very strange how these odd occurrences happened when I accidentally applied an array object with two values although like you say, the affected storage LUNS are not actual disk devices so I will investigate with our storage guys to try to establish what these actually are

Do you know of any articles which fully cover powercli/esxcli and configuring storage devices as most of what I have found is relatively sparse?

Thank you again so much for your invaluable assistance!

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The commands you run via Get-EsxCli are exactly the same as the esxcli commands you would run on an ESXi console.

Consult the documentation for the esxcli command, see ESXi 7.0 ESXCLI Command Reference


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos