Product Announcements

Acessing Virtual Machine Advanced Settings

By William Lam, Sr. Technical Marketing Engineer

From time to time I get questions on how to access the advanced settings for a virtual machine and how to go about searching for the settings using the VM’s .vmx configuration file. Though the advanced settings are stored in the .vmx configuration file, they can also be accessed and viewed using the vSphere Client.

Adv-setting-1

These advanced settings are stored as a key/value pair and is primarily used by VMware to add additional information or configurations to a specific VM. These settings are persistent throughout the life of the VM, even when you clone the VM, the settings are also copied. One example of where this is used, is with VMware’s vShield product. Advanced settings are used in vShield Manager and vShield App VM to help identify their role and actions within the vShield solution.

If you wish to list all the advanced settings for a VM, you can easily automate this with the help of the vSphere API. As part of the VM’s configuration, there is a property in the vSphere API called extraConfig, which is an array that contains the key/value pair settings.

Here is an example of listing the advanced settings for a VM using the vSphere SDK for Perl script called vmAdvSettings.pl:

$ ./vmAdvSettings.pl –server vcenter50-3 –username root –vmname MyVM –operation list

Key: ethernet0.filter0.param0   Value: vshield-dvfilter-module
Key: ethernet0.filter0.param1   Value: uuid=5019b662-a14c-8166-9ce3-61f362de05a3.000
Key: evcCompatibilityMode       Value: FALSE
Key: guestCPUID.0       Value: 0000000b756e65476c65746e49656e69
Key: guestCPUID.1       Value: 000106a400010800809822010febfbff
Key: guestCPUID.80000001        Value: 00000000000000000000000128100800
Key: hostCPUID.0        Value: 0000000b756e65476c65746e49656e69
Key: hostCPUID.1        Value: 000106a400010800809822210febfbff
Key: hostCPUID.80000001 Value: 00000000000000000000000128100800
Key: hpet0.present      Value: true
Key: migrate.hostLogState       Value: none
Key: migrate.migrationId        Value: 0
Key: nvram      Value: MyVM.nvram
Key: replay.supported   Value: false
Key: scsi0.pciSlotNumber        Value: 16
Key: snapshot.action    Value: keep
Key: uuid.action        Value: create
Key: virtualHW.productCompatibility     Value: hosted
Key: vmci0.pciSlotNumber        Value: 32
Key: vmotion.checkpointFBSize   Value: 4194304
Key: vmware.tools.installstate  Value: none
Key: vmware.tools.internalversion       Value: 2147483647
Key: vmware.tools.lastInstallStatus     Value: unknown
Key: vmware.tools.requiredversion       Value: 8384

You can also query a specific advanced setting if you already know the key. Here is an example by specifying –key parameter:

$ ./vmAdvSettings.pl –server vcenter50-3 –username root –vmname MyVM –operation list –key ethernet0.filter0.param1

Key: ethernet0.filter0.param1   Value: uuid=5019b662-a14c-8166-9ce3-61f362de05a3.000

Here is an example of listing the advanced settings for a VM using PowerCLI:

Note: The functions used in this PowerCLI example can be found here and should be added to your session first.

Get-VM MyVM | Get-VMAdvancedConfiguration

Key                                                   Value
—                                                   —–
ethernet0.filter0.param0                              vshield-dvfilter-module
ethernet0.filter0.param1                       uuid=5019b662-a14c-8166-9ce3-61f362de05a3.000
guestCPUID.0                                          0000000568747541444d416369746e65
guestCPUID.1                                          00100f230000080080802001078bfbff
guestCPUID.80000001                                   00100f231000036f000001e9ebd3fbff
userCPUID.0                                           0000000568747541444d416369746e65
userCPUID.1                                           00100f230004080080802001078bfbff
userCPUID.80000001                                    00100f231000036f000001e9ebd3fbff
evcCompatibilityMode                                  false                           
config.readOnly                                       false                           
replay.filename
unity.wasCapable                                      false                           
checkpoint.vmState                              
replay.allowFT                                        false             &#0
160;             

vshield.vmtype                                        Manager                         
vshield.vmversion                                     5.0                             
pciBridge5.present                                    true                            
vshield.vmbuild                                       473791                          
a57d4b11.vswp
scsi0:1.ctkEnabled                                    true                                                        
vmware.tools.internalversion                          8384                            
vmware.tools.requiredversion                          8384                            
vmware.tools.installstate                             none                            
vmware.tools.lastInstallStatus                        unknown                         
migrate.hostLogState                                  none                            
migrate.migrationId                                   0  

You can also query a specific advanced setting using the PowerCLI functions if you already know the key. Here is an example by specifying -key parameter:

Get-VM MyVM | Get-VMAdvancedConfiguration -Key “ethernet0.filter0.param1”

Key                                    Value
—                                    —–
ethernet0.filter0.param1               uuid=5019b662-a14c-8166-9ce3-61f362de05a3.000

As I mentioned earlier, VMware is the primary consumer of the advanced settings, but did you know, it is also available for everyone to use? It is just as easy to query for the settings as it is to add your own custom key/value pair by using the vSphere API UpdateOptions method.

Here is an example of using the vSphere SDK for Perl script:

./vmAdvSettings.pl –server vcenter50-3 –username root –vmname MyVM –operation update –key asset.tag –value ABC123

Reconfiguring “MyVM” with advanced setting: “asset.tag = ABC123” …
Successfully updated advanced setting for “MyVM”!

Here is an example of using PowerCLI:

Get-VM MyVM | Set-VMAdvancedConfiguration -Key “asset.tag” -value ABC123

Set Advanced configuration for MyVM: asset.tag = ABC123

If you are using vCenter Server, there is also a feature called Custom Attributes which provides a similar mechanism to add custom fields but is applicable to both a VM and/or ESX(i) host. These custom fields also persist throughout the life of a VM and ESX(i) host, but the only difference is these settings are stored in the vCenter database and not with the actual VM or ESX(i) objects. You can view these custom fields in the VM and ESX(i) column tabs in your vCenter Server.

Screen Shot 2012-03-05 at 3.55.56 PM

It is recommended that you use the custom attributes as a way to centrally manage and create custom fields for your VM and ESX(i) hosts. This allows for the data to be centralized in your vCenter Server and you do not need to worry about individual VM configurations.

Additional Resources:

  • vSphere SDK for Perl script to help create/automate VM custom attributes.
  • PowerCLI can be used to automate custom attributes as seen here.

Get notification of new blog postings and more by following lamw on Twitter:  @lamw