VMware Cloud Community
henber
Contributor
Contributor
Jump to solution

Set LVM/EnableResignature = 1 with PowerCLI on ESX 4.1

Hello, because the way the handling of Snapshot LUNs has changed dramatically in ESX/ESXi 4.x we are looking in a way to set the LVM/EnableResignature parameter to 1 on our hosts through a script. We have done this on earlier versions of ESX but now we can no longer call this setting because of the change in ESX 4.x.

I am not going to explain why we want to do this because it would take to much time. But I would appreciate if someone had a sollution to do this, because now I go to the first host in the cluster and manually set the LVM/EnableResignature = 1 through the serviceconsole with esxcfg-advcfg -s 1 /LVM/EnableResignature, then the script filters the hosts and selects the first one by name and does a resignature on the datastores.

Can someone help me with this if it is possible. We are do not want to call putty from our script to do this.

BR

Henrik

1 Solution

Accepted Solutions
avlieshout
VMware Employee
VMware Employee
Jump to solution

Henrik,

Luc's version declares $optarray as a vmware.vim.optionvalue[] array

This way you could add multiple optionvalue items to the array and change them alltogether with just one call to the UpdateOptions method.

Interesting stuff.

-


Arnim van Lieshout

Blogging: http://www.van-lieshout.com

Twitter: http://www.twitter.com/avlieshout

If you find this information useful, please award points for "correct" or "helpful".

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
15 Replies
LucD
Leadership
Leadership
Jump to solution

Did you try the script I gave in ?

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can use the next PowerCLI oneliner to set the LVM.EnableResignature to 1 on all your hosts:

Get-VMHost | Set-VmHostAdvancedConfiguration -Name LVM.EnableResignature -Value 1

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
henber
Contributor
Contributor
Jump to solution

Hello LucD and RvdNieuwendijk, thank you for the quick answers but it didnt help. Should they work on ESX 4.1?

LucD I have tried your script but get the error:

Exception calling "UpdateOptions" with "1" argument(s): "A specified parameter was not correct.

"

At C:\EnableResignature.ps1:8 char:25

+ $optmgr.UpdateOptions <<<< ($optarray)

+ CategoryInfo : NotSpecified: (Smiley Happy [], MethodInvocationException

+ FullyQualifiedErrorId : DotNetMethodException

And RvdNieuwendijk with your tip I get the following error:

:\> Get-VMHost | Set-VMHostAdvancedConfiguration -Name LVM.EnableResignature -Value 1

Set-VMHostAdvancedConfiguration : 2010-12-01 09:36:58 Set-VMHostAdvancedConfiguration 2A37E361-9D30-4AEF-B79B-E44437806CB6 A specified parame

ter was not correct.

At line:1 char:45

+ Get-VMHost | Set-VMHostAdvancedConfiguration <<<< -Name LVM.EnableResignature -Value 1

+ CategoryInfo : NotSpecified: (Smiley Happy , InvalidArgumentException

+ FullyQualifiedErrorId : Client20_MoServiceImpl_Invoke_ViError,VMware.VimAutomation.VimAutomation.Commands.Host.SetVMHostAdvancedConfiguration

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You're right, this option is gone in ESX 4.x.

That means that you will have to use the esxcfg- commands

See .

Or have a look at this thread where the ResignatureUnresolvedVmfsVolume_Task method was used.

See Mike's script in that thread.

____________

Blog: LucD notes

Twitter: lucd22


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

henber
Contributor
Contributor
Jump to solution

Thanks again for the answer,

A colleague of mine (who I love right now btw Smiley Happy ) had a quick look at the script you pointed to earlier and made a few changes to it because of the errors it gave.

Your earlier script

Get-Cluster -Name <cluster-name> | Get-VMHost -State "Connected" | %{

$esx = Get-View $_.ID

$optmgrMoRef = $esx.configManager.advancedOption

$optmgr = Get-View $optmgrMoRef

$optarray = $optmgr.QueryOptions("LVM.Enableresignature")

$optarray[0].Value = 1

$optmgr.UpdateOptions($optarray)

}

And it gave the error that it could not apply the value of 1 on ESX 4.x hosts.

This script will work to enable/disable EnableResignature on ESX 4.x hosts.

$option = New-Object VMware.Vim.Optionvalue -Property @{

Key = "LVM.EnableResignature"

Value = 1

}

$esx = Get-View (Get-VMHost hostname).ID

$optmgr = Get-View $esx.configManager.advancedOption

$optarray = $option

$optmgr.UpdateOptions($optarray)

Thanks again for your help earlier.

BR

Henrik

0 Kudos
avlieshout
VMware Employee
VMware Employee
Jump to solution

Thank you guys!

Just what I was looking for myself.

Luc's script gave the error because he didn't specify a long value btw.

-


Arnim van Lieshout

Blogging: http://www.van-lieshout.com

Twitter: http://www.twitter.com/avlieshout

If you find this information useful, please award points for "correct" or "helpful".

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
avlieshout
VMware Employee
VMware Employee
Jump to solution

Henrik,

Luc's version declares $optarray as a vmware.vim.optionvalue[] array

This way you could add multiple optionvalue items to the array and change them alltogether with just one call to the UpdateOptions method.

Interesting stuff.

-


Arnim van Lieshout

Blogging: http://www.van-lieshout.com

Twitter: http://www.twitter.com/avlieshout

If you find this information useful, please award points for "correct" or "helpful".

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
0 Kudos
henber
Contributor
Contributor
Jump to solution

Thank you for the input. Yes the script my colleague made points to a singe ESX just because that was the function we wanted it to change. But I tested LucD´s script for a entire cluster and just added a value and it worked like a charm.

Thanks for the info.

Br

Henrik

0 Kudos
goAtsy
Contributor
Contributor
Jump to solution

Hello,

I have put together a function (attached) that works ok in the powershell pipeline. It's only for configuring resignature and as of now only takes VMHosts by type, not by name.

Example usage:

Get-VMHost "a", "b" | Set-VMHostResignature -Value 1

$MyHosts = Get-VMHost

Set-VMHostResignature -VMHost $MyHosts -Value 0

Depending on the version of PowerCLI it looks like you might have to change the typename of the VMHost parameter:

0 Kudos
mikelleen
Contributor
Contributor
Jump to solution

Can anyone help me with this error I am getting when trying to update ESX v5 to enable resignature?

PS C:\Documents and Settings\xxxxxxx> $esx = Get-View (Get-VMHost $TargetVMCenterHost).ID
PS C:\Documents and Settings\xxxxxxx> echo $esx


Runtime             : VMware.Vim.HostRuntimeInfo
Summary             : VMware.Vim.HostListSummary
Hardware            : VMware.Vim.HostHardwareInfo
Capability          : VMware.Vim.HostCapability
LicensableResource  : VMware.Vim.HostLicensableResourceInfo
ConfigManager       : VMware.Vim.HostConfigManager
Config              : VMware.Vim.HostConfigInfo
Vm                  : {VirtualMachine-vm-348, VirtualMachine-vm-350, VirtualMachine-vm-1253, VirtualMachine-vm-389}
Datastore           : {Datastore-datastore-327, Datastore-datastore-328, Datastore-datastore-329, Datastore-datastore-331...}
Network             : {Network-network-21}
DatastoreBrowser    : HostDatastoreBrowser-datastoreBrowser-host-1243
SystemResources     : VMware.Vim.HostSystemResourceInfo
LinkedView          :
Parent              : ClusterComputeResource-domain-c321
CustomValue         : {}
OverallStatus       : green
ConfigStatus        : green
ConfigIssue         : {}
EffectiveRole       : {-1}
Permission          : {}
Name                : nutravm1.nutracorp.com
DisabledMethod      : {ExitMaintenanceMode_Task, PowerUpHostFromStandBy_Task, ReconnectHost_Task, ReconfigureHostForDAS_Task}
RecentTask          : {}
DeclaredAlarmState  : {alarm-1.host-1243, alarm-110.host-1243, alarm-13.host-1243, alarm-14.host-1243...}
TriggeredAlarmState : {}
AlarmActionsEnabled : True
Tag                 : {}
Value               : {}
AvailableField      : {}
MoRef               : HostSystem-host-1243
Client              : VMware.Vim.VimClient

PS C:\Documents and Settings\xxxxxxx> $optmgr = Get-View $esx.configManager.advancedOption
PS C:\Documents and Settings\xxxxxxx> $optarray = $option
PS C:\Documents and Settings\xxxxxxx> echo $optarray

Key
---
LVM.EnableResignature


PS C:\Documents and Settings\xxxxxxx> $optmgr.UpdateOptions($optarray)
Exception calling "UpdateOptions" with "1" argument(s): "A specified parameter was not correct.
"
At line:1 char:22
+ $optmgr.UpdateOptions <<<< ($optarray)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

PS C:\Documents and Settings\xxxxxxx>

0 Kudos
titaniumlegs
Enthusiast
Enthusiast
Jump to solution

I know, old thread, but...

By the way, you shouldn't have to resignature on all hosts that share a datastore.  Once the first host resignatures, the rest should just mount the datastore(s) right up on rescan.

In fact, we recommend NOT leaving LVM.EnableResig on all the time because there are times when there is a better answer than resignaturing.  Once you resignature, there's no way to go back (unless you're a VMware internal guru who knows VMFS inside and out like maybe Mostafa).

Share and enjoy! Peter If this helped you, please award points! Or beer. Or jump tickets.
johnwilk
Contributor
Contributor
Jump to solution

Hi Robert,

On ESX4i, due to SRM setting the LVM.Resignature value to 1 when failing over and not resetting it to 0, I have had probelms with datastores being renamed as snapshots when a rescan is performed.

I have been using the following to get the values:

$VMHosts = Get-VMHost

$VMHosts | Get-VMHostAdvancedConfiguration -Name LVM.EnableResignature

This gives:

Name                           Value
----                           -----
LVM.EnableResignature          0
LVM.EnableResignature          0
LVM.EnableResignature          0

but I can't seem to obtain which host returns a value of 1. Do you know how I can output the vmhost name with the value?

Any help much appreciated.

John

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try it like this

Get-VMHost | 
Select Name, 
    @{N="LVM.EnableResignature";E={(Get-VMHostAdvancedConfiguration -VMHost $_ -Name LVM.EnableResignature)["LVM.EnableResignature"]}}


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

0 Kudos
johnwilk
Contributor
Contributor
Jump to solution

Rescued once again.....Many Thanks

0 Kudos
GaryGhotra
Contributor
Contributor
Jump to solution

Thanks for script, worked like butter...

0 Kudos