Monday, May 14, 2012

Updating HP ESXi image using vSphere Update Manager

When using HP servers, recommended practice is to use customized HP ESXi image for installation, which contains base VMware ESXi plus HP specific utilities, tools and drivers (similar goes for other server vendors, which all usually have their own customized ESXi installation images). The following post describes how to proceed with patching hosts running HP ESXi 5.x image, while the complete HP official document on HP ESXi deploying and patching can be found here - Deploying and updating VMware vSphere 5.0 on HP ProLiant Servers.

Host with installed HP ESXi image can be updated using vSphere Update Manager and default download repositories, but it is necessary to assure that HP-specific VIBs that are a part of the customized image are also regularly updated. This can be accomplished by adding HP VIB depot as one of the Download Sources in vSphere Update Manager, creating a baseline that contains HP updates and attaching this baseline to the hosts running HP ESXi image.

First, connect with vSphere Client to your vCenter, go to Home -> Solutions and Applications -> Update Manager (if you don't see this option, you probably need to install vSphere Update Manager plugin in your vSphere Client - check Plug-ins -> Manage Plug-ins on top of vSphere Client screen).

In order to add HP's patch repository, go to Configuration tab -> Download Settings -> Add Download Source and paste the following URL:  http://vibsdepot.hp.com/index.xml . You can validate this address, and when you make sure everything's OK in connecting to HP depot, select Apply below the list of Download Sources. Then choose Download Now in order to check the new patch repo for patches.

Next, we need to create a baseline with HP updates. Click on the Baselines and Groups tab, then select Create above the list of existing baselines. Name the new baseline, select Host Patch as the baseline type, Next, choose Dynamic and then Next again. 

Now it's necessary to define rules which patches need to match in order to be a part of the baseline. In the Patch Vendor column, select both "hp" and "Hewlett-Packard Company" and then you can click Next to the finish of the wizard.

After we created a baseline, we need to attach it to hosts. Go to Home -> Host and Clusters view and select a vCenter, datacenter, cluster or a single host to which you want to attach the baseline. Then go to the Update Manager tab, and choose Attach... in the upper right corner, select the newly created baseline and click Attach.

After attaching the baseline, each new Scan operation will result in hosts also being checked for compliance with the updates released for HP specific VIBs.

Sunday, May 13, 2012

Installing VMware Tools on Linux Guest OS

This post describes the general procedure for installing VMware Tools on Linux Guest OSs from the command line. It presumes that you are logged in as root to the VM.

First, right click the virtual machine from vSphere Client and choose VM -> Guest -> Install/Upgrade VMware Tools (equivalent on VMware Workstation / Player would be Virtual Machine -> Install VMware Tools..)

This results in .iso file with VMware Tools package being mounted on CD/DVD drive of the virtual machine.

Create a directory as a mount point for the CD/DVD drive:

mkdir /mnt/vmt

Mount the CD/DVD drive:

mount /dev/cdrom /mnt/vmt

If you do ls /mnt/vmt, you'll see that the installation .iso contains of one .tar.gz file with the packed installation. Since this is a read-only mount point, we need to extract this .tar.gz to a different directory that is writable.

First create the new directory:

mkdir /vmtools

Then unpack the contents of the installation .tar.gz file to the new directory:

tar xzf /mnt/vmt/VMwareTools-<xxxx>.tar.gz  -C /vmtools

(name of .tar.gz file can vary depending on the installed ESXi/Workstation/Player version).

Run the extracted installation file:

cd /vmtools/vmware-tools-distrib
./vmware-install.pl

Proceed to answer installation prompts.

Unlike on Windows, installation of VMware Tools on Linux Guest OSs does not require reboot. After the installation is finished, you can check the status of VMware Tools service by typing:

service vmware-tools status

or, if you're using RHEL or CentOS >=6.0 as the guest OS:

status vmware-tools

since these OSs use Upstart instead of legacy init for starting VMware Tools service since OS version 6.0.

After the installation is finished, perform cleanup:

umount /mnt/vmt (if not already done by the installer)
rmdir /mnt/vmt
rm -rf /vmtools

Saturday, May 12, 2012

VMware ESXi 5 CLI Commands Part 1


Since vSphere 5, the only hypervisor available in the VMware virtualization suite is ESXi. One of the main differences in ESXi compared to ESX is the lack of Service Console, which was basically stripped down RHEL used for communicating with VMkernel. As a result, CLI command syntax in ESXi siginificantly differs.


This post covers a few of the most important CLI commands in ESXi, while One of the future posts will cover esxcli, a new CLI framework that will in future completely replace legacy esxcfg-*/vicfg-* commands.


You can directly access command line in ESXi 5.x either through the console (so called ESXi Shell) or SSH, but you need to first enable it through vSphere Client (Configuration -> Security Profile -> Services -> ESXi shell / SSH -> Options -> Start) or console menu (F2 -> login as user with root privileges -> Troubleshooting Options -> Enable ESXi Shell / Enable SSH).



Show services on the host and their default state upon boot (on/off)


cat /etc/chkconfig.db




Restart all services on the host


/sbin/services.sh restart




Show config file of vCenter vpxa agent


cat /etc/vmware/vpxa/vpxa.cfg




Enter maintenance mode


vim-cmd hostsvc/maintenance_mode_enter




Virtual machine operations


vim-vmd solo/registervm <path to VM's .vmx file> - register VM on a host
vim-cmd vmsvc/getallvms - list all VMs registered on the host


* in the following commands replace <vmid> with virtual machine ID obtained by running the previous command


vim-cmd vmsvc/power.getstate <vmid> - show power state of a VM
vim-cmd vmsvc/power.shutdown  <vmid>  - shutdown a VM (shutdown guest)
vim-cmd vmsvc/power.reset  <vmid>  - reset a VM
vim-cmd vmsvc/power.off <vmid>  - power off a VM
vim-cmd vmsvc/power.on <vmid> - power on a VM
vim-cmd vmsvc/power.reboot <vmid> - reboot a VM
vim-cmd vmsvc/get.summary  <vmid>  - get summary information for a VM
vim-cmd vmsvc/unregister  <vmid>  - unregister a VM from a host