måndag, augusti 04, 2008

Patching VMware ESX 3.0.1, with VMware ESX patches

One way to do this of many.. :)
This patching procedure asumes no Virtual Center just standalone ESX w NAS (NFS)

First download and install Patch ESX-5874303

VMware ESX Server 3.0.1, Patch ESX-5874303: Update to the esxupdate Utility
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=5874303

# /usr/sbin/esxupdate -v 10 -noreboot -r file:/mnt/ESXPatches/ESX-5874303


Then create list of extracted patches within /mnt/ESXPatches/

#!/bin/sh
#
# Create list of patchid's in /mnt/patches to patchesList.txt
cd /mnt/ESXPatches
rm patchesList.txt
ls -l | grep '^d' | awk '{ print $9 }' > patchesList.txt
echo DONE
echo /mnt/ESXPatches/patchesList.txt created


Now we are ready to install every patch that been downloaded and installed

patchESX.pl
#!/usr/bin/perl
# patchESX.pl -- auto update esx perl script
# by Vincent Vlieghe
# Version 6/03/2007
# Edited by Niklas Eriksson
use LWP::Simple;
$patchlist = get 'file:///mnt/ESXPatches/patchesList.txt';
@array = split(/\n/, $patchlist);
foreach $item (@array)
{
print $item;
$item = trim($item);
$cmdQuery = "/usr/sbin/esxupdate query | grep $item";
if(system($cmdQuery) == 0)
{
print "\n$item is already installed - skipping\n";
}
else
{
print "\n$item is not yet installed - installing\n";
$cmdUpdate = "/usr/sbin/esxupdate -v 10 -n -r file:///mnt/ESXPatches/$item update";
system($cmdUpdate);
}
}
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}

Now we can verify installed software and REBOOT our server!!!

[root@esx1 bin]# /usr/sbin/esxupdate -l query
Installed software bundles:
------ Name ------ --- Install Date --- --- Summary ---
3.0.1-32039 18:14:49 10/11/07 Full 3.0.1 release of VMware ESX Server
ESX-2158032 12:12:28 10/12/07 Add LFENCE for RWO on AMD K8 before RevF
ESX-1410076 12:15:33 10/12/07 BSOD 0x109 during 64-bit Windows install
ESX-1006511 12:16:10 10/12/07 Fixing TX hang in 80003ES2LAN Controller
ESX-9986131 12:16:54 10/12/07 Updated openssh, python, and openssl
ESX-8173580 12:18:11 10/12/07 Fix COS Oops running Dell OM5 w/ QLogic
ESX-6921838 12:20:38 10/12/07 hot removal of a virtual disk thru SDK
ESX-2066306 12:21:08 10/12/07 Patch for VM crashes and possible freeze
...