How To: Bulk upgrade VM hardware to v7

Posted: April 6, 2011 in How-to, VMware

The following scripts were written to bulk upgrade VMware virtual machines’ hardware from v4 to v7.

After the upgrade of a specific virtual machine, the first NIC adapter is also changed to use the new VMXNET3 adapter. And finally some of the changes are done to the virtual machine configuration to gain maximum performance (disable VM logging, set unlimited CPU and memory reservations)

Download the script collection from here.

The script collection includes three scripts.

1) vBulkUpgDirector.pl – (Normal Perl script) The main script. This coordinates other sub-scripts, catches the errors from the sub-scripts and throw to STDOUT. The script ‘forks’ 10 child processes to do 10 vm upgrades parallelly which greatly reduce the time to finish the full upgrade process.
2) vBulkUpgManager.pl – (vSphere Perl SDK script) A sub-script which creates the list of UUIDs
3) vBulkUpgEngineer.pl – (vSphere Perl SDK script) A sub-script which actually does the job. All upgrade related processes happen here.

vBulkDirector.pl is written to talk to vCenter and make a UUID list for vms under specific folder. Go through the main configuration parameters in vBulkDirector.pl script and make the necessary changes first. And finally run vBulkDirector.pl

############# User configurable variables ####

# vCenter server
my $v_auth_server = ‘<your_vcenter_host>’;
# Username
my $v_auth_username = ‘<vcenter_username>’;
# Password
my $v_auth_passwd = ‘<user_password>’;
# Under which directory the scripts located
my $v_script_base = ‘”<where_are_this_script_located>”‘;
# Under which directory you want to have logs
my $v_log_base = ‘”<where_you_want_to_have_logs>”‘;
# Under which folder your vms located
my $v_manager_args_folder = ‘<vcenter_folder>’;

Acknowledgment: Some of the sub-routines were originally written by William Lam.

Leave a comment