vCenter Mobile Access (vCMA) tools upgrade

I recently went through and upgraded the VMware Tools on all of my virtual machines.  The only one I couldn’t get to work was my vCenter Mobile Access machine.  After some searching, I finally found this article on the VMware Communities site.  It took awhile to find, so I wanted to post the details here (so at least I can find them in the future).  Here is the source article with two takes on how to complete this task: http://communities.vmware.com/thread/216029?tstart=15

And here is a copy of the instructions for future reference:

  1. Shutdown the VCMA guest and add a “client” CD ROM to the VCMA appliance and power-on
  2. Snapshot the vCMA machine so you can undo if there are any problems!
  3. Create a directory for mount point
  4. mkdir /mnt/cdrom
  5. Select “VM->Guest->Install/Upgrade VMware Tools” from the console menu
  6. Copy the VMwareTools to the /tmp directory
  7. cp /mnt/cdrom/VMwareTools-4*.gz /tmp
  8. On the vCMA server console install the The World-Wide Web library for Perl.
  9. yum install perl-libwww-perl
  10. Extract the contents of the VMwareTools-4.0.0-164009.tar.gz file in the /tmp directory.
  11. tar zxf /tmp/VMwareTools-4.0.0-164009.tar.gz
  12. Uninstall the previous version of VMware Tools using the uninstaller from the latest version. The uninstall script wasn’t left from the initial install.
  13. /tmp/vmware-tools-distrib/bin/vmware-uninstall-tools.pl
  14. Install the latest version accepting the defaults.
  15. /tmp/vmware-tools-distrib/vmware-install.pl
  16. Reboot the vCMA server.
  17. shutdown -r now
  18. If everything works correctly remove the snapshot.
Posted in Virtualization | Leave a comment

Enabling vSwitch Cisco Discovery Protocol (CDP)

I recently attended the VMware vSphere Troubleshooting course.  It was a very good course and I’d recommend it to anyone responsible for day-to-day maintenance of a virtual infrastructure.  During the course we discussed the vMA (vSphere Management Assistant) and looked at some of the vSwitch configuration options you could set.  One option stood out to me…the CDP Mode of a standard vSwitch.  I knew my vSwitch had the ability to read CDP information, but the class text suggested it could announce its configuration.  Once I had a few minutes to get back into my lab I decided to deploy the vMA and test this configuration.

Downloading and deploying the vMA was rather straight forward.  Once the OVF template was deployed and powered on, a wizard walks you through all of the remaining configuration.  Once the vMA is only, login with the vi-admin user account.  The first step to enabling CDP requires that the host or vCenter be added to the vMA.  I decided to go with each host…so I added it like so:

sudo vifp addserver esxhostname.domain.name
vifpinit esxhostname.domain.name

To verify the existing CDP mode you can type the following command (the name of the vSwitch is case sensitive):

vicfg-vswitch -b vSwitch0

By default a vSwitch will have a CDP mode of listen, but it is very easy to change to both

vicfg-vswitch -B both vSwitch0

The physical switch now shows the following:

show cdp neighbor
Device ID:       esxhostname.domain.name
Local Intrfce:   Gig 1/3
Capability:      Switch
Platform:        VMware ES
Port ID:         vmnic0
Posted in Virtualization | 1 Comment

Linux P2V with VMware Converter Stand Alone

Over the years I have seen thousands of Windows Servers and completed hundreds of Windows P2Vs.  I only have dozens of Linux Servers and have yet to attempt a Linux P2V – until now!

To beign I found an older model physical server.  This physical server had a Dell PERC RAID controller with two RAID-1 volumes.  I installed RedHat Enterprise 4.5 using only the first RAID-1 set and accepting the default partitioning options.  Once the install was complete I added the second drive as the /data mount.  This wasn’t necessary; I just wanted to verify that additional disks would be available for cloning.

mkfs.ext3 /dev/sdb2
mkdir /data
mount /dev/sdb2 /data
vi /etc/fstab

Once the fstab was open in VI, I added the following line at the end of file:

/dev/sdb2  /data  ext3  defaults  1 2

Instructions for adding this second disk as the /data mount were obtained here: http://www.cyberciti.biz/faq/linux-disk-format/

This actual P2V process was completed using the free VMware Converter Standalone.

  1. Specify the machine source.  I’ve allowed root login over SSH, which isn’t a best security practice, but was requested by the converter utility.  Supported Linux distributions are listed on the first screen but include:
    1. Red Hat Enterprise Linux 2.1, 3.0, 4.0, 5.0
    2. Red Hat Linux Advanced Server 2.1
    3. SUSE Linux Enterprise Server 8, 9, 10
    4. Ubuntu Linux 5.x, 6.x, 7.x, 8.x
  2. Specify the vCenter or ESX/ESXi host name, user name and password.
  3. Select a host (if needed), enter information about the VM name, datastore, and hardware version.
  4. A “View/Edit Options” screen appears that allows you to reconfigure the virtual hardware.  In my ‘data to copy’ heading I see all of my volumes with their current size – and am provided the ability to shrink/grow them as needed.  I have also removed CPU/Memory to ‘right-size’ the VM configuration.
  5. The final option on the “View/Edit Options” page asks for the “Helper VM Network” information.  My first attempt to complete this P2V failed because of an invalid configuration on this step.  My test network did not have DHCP available — it turns out that the converter process boots the target VM from an ISO image to assist in the process.  This last step is where the temporary IP information is assigned to the target virtual machine for the cloning process.
  6. Here is a screenshot of the ‘helper’ VM while the cloning operation is going on:
  7. The successful log below gives a better summary of what actually happens:
  8. Once the virtual machine is powered on, a wizard starts to help you with the hardware changes.  In my build I had to press a key to begin and the first screen I saw was really straight forward:
Posted in Virtualization | Leave a comment

P2V Post Migration Cleanup

I’ve been doing a lot of P2V migrations over the last few months and wanted to share a couple of lessons learned. Our environment uses McAfee ePO to centrally manage our desktops and servers. We noticed that after a P2V migration the agent would no longer be able to communicate with the ePO server. After doing some searching we located several registry keys that contain Agent keys unique to a specific piece of hardware. If we delete these keys and restart the framework service clients are again able to communicate. Additionally, I look through the device manager and remove old devices — such as network cards that are no longer installed. Since these steps are repetitive, and I have a large quantity of P2V’s, I created this simple batch file to help me out:


@echo off
echo This tool fixes keys after a major hardware change - such as a P2V migration

if %PROCESSOR_ARCHITECTURE% == x86 reg delete "HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\Keys" /v binap /f
if %PROCESSOR_ARCHITECTURE% == x86 reg delete "HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\Keys" /v binas /f
if %PROCESSOR_ARCHITECTURE% == x86 reg delete "HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\Keys" /v binrs /f
if %PROCESSOR_ARCHITECTURE% == x86 reg delete "HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent\Keys" /v binsp /f

if %PROCESSOR_ARCHITECTURE% == AMD64 reg delete "HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent\Keys" /v binap /f
if %PROCESSOR_ARCHITECTURE% == AMD64 reg delete "HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent\Keys" /v binas /f
if %PROCESSOR_ARCHITECTURE% == AMD64 reg delete "HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent\Keys" /v binrs /f
if %PROCESSOR_ARCHITECTURE% == AMD64 reg delete "HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent\Keys" /v binsp /f

net stop McAfeeFramework
net start McAfeeFramework

if %PROCESSOR_ARCHITECTURE% == x86 "%ProgramFiles%\McAfee\Common Framework\CmdAgent.exe" -s -p
if %PROCESSOR_ARCHITECTURE% == AMD64 "%ProgramFiles(x86)%\McAfee\Common Framework\CmdAgent.exe" -s -p

reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v CPQTEAM /f

set devmgr_show_nonpresent_devices=1
start devmgmt.msc

To make things even easier, I have placed this script in an ISO image on my desktop. I can easily connect this ISO to the VM and access utilities even if my network connection is not connected.

Other utilities I keep in this ISO image are:

Posted in Scripting, Virtualization | Leave a comment

A quick way to find virtual machines with incorrect names

A few days back I saw a twitter post from @maishsk which linked to this article:

http://technodrone.blogspot.com/2010/04/how-to-speed-up-your-powercli-queries.html

The article got me thinking about the difference between Get-VM and Get-View and I wanted to apply it to a script I’ve been using for a little while.  This is a pretty simple script that finds my virtual machines that have incorrect names — the host name inside the VM doesn’t match the name of the VM in the vCenter console.

Using the Get-VM cmdlet takes 148.7862461 seconds to find all of my virtual machines (excluding the templates):

$getvms = (Measure-Command {get-vm  | where { $_.Guest.HostName -ne $NULL -AND $_.Guest.HostName -notmatch $_.Name } | select-object name, {$_.Guest.HostName}}).TotalSeconds

Using the Get-View VirtualMachines cmdlet with a filter to exclude templates only takes 11.6853342 seconds:

$getviewf = (Measure-Command {get-view -viewtype virtualmachine -Filter @{"Config.Template"="false"}  | where { $_.Guest.HostName -ne $NULL -AND $_.Guest.HostName -notmatch $_.Name } | select-object name, {$_.Guest.HostName}}).TotalSeconds

While either script does a better job than trying to compare these settings manually, this Get-View method shows a very significant savings!  Thanks for the suggestion @maishsk!

Just in case you only want the query to show VM’s with incorrect names, here you go:

get-view -viewtype virtualmachine -Filter @{"Config.Template"="false"} | where { $_.Guest.HostName -ne $NULL -AND $_.Guest.HostName -notmatch $_.Name } | select-object name, {$_.Guest.HostName}
Posted in Scripting, Virtualization | Leave a comment