Pages

Sunday, December 2, 2012

Querying vCenter Linked Mode with the vSphere API

One question I'm asked now and then is how to retrieve the list of Linked Mode vCenter Servers from the vSphere API.  Unfortunately, the Linked Mode configuration is not provided through the published vSphere SDK.

VMware products that are aware of Linked Mode, such as the vSphere Client, use an undocumented API method called QueryServiceEndpointList.  We can leverage the same API method to discover Linked Mode vCenter server instances for use in custom automation tools.

Wednesday, November 21, 2012

Best Practices for Faster vSphere SDK Scripts

The VMware vSphere API is one of the more powerful vendor SDKs available in the Virtualization Ecosystem.  As adoption of VMware vSphere has grown over the years, so has the size of Virtual Infrastructure environments.  In many larger enterprises, the increasing number of VirtualMachines and HostSystems is driving the architectural requirement to deploy multiple vCenter Servers.

In response, the necessity for automation tooling has grown just as quickly.  Automation to create daily reports, perform bulk operations, and aggregate data from large, distributed Virtual Infrastructure environments is a common requirement for managing the increasing virtual sprawl.

In a Virtual Infrastructure comprised of thousands of objects, even a simple script to list all VirtualMachines and their associated HostSystem and Datastores can result in very slow runtime execution.  Developing automation with the following, simple best practices can take orders of magnitude off your vSphere API tool's runtime.

Thursday, November 8, 2012

Automate Adding ESXi Hosts to vCenter With SSL Thumbprint

Recently, I was asked how to automate adding ESXi hosts to vCenter with a custom Perl script.  For security purposes, vSphere vCenter requires SSL verification of the ESXi SSL certificate thumbprint.  The automation challenge is generating the SHA1 digest for the ESXi host certificate, so it can then be passed as a parameter to AddHost_Task() method.

There are two solutions for getting the SSL thumbprint before adding an ESXi host to vCenter's inventory.

Monday, November 5, 2012

Installing the vSphere SDK for Perl on OS X

Since the first Intel based Macbook Pro was introduced, Apple OS X has been my preferred platform for work and play.  While VMware Fusion makes it particularly easy to run VMware toolkits and utilities, I still prefer native versions.  I started working with the VMware vSphere SDK for Perl years ago, developing against and natively running the SDK tools on my various Mac systems ever since.

Installing the VMware vSphere SDK for Perl is actually a straightforward process.  The installation steps outlined here were tested using the vSphere SDK for Perl 5.1 and OS X Mountain Lion, but the process should work just as well on older versions of both the SDK and OS X.

Thursday, October 25, 2012

Fix Perl CPAN on OS X Mountain Lion

I regularly develop automation tools with the VMware SDK for Perl on my Macbook Pro.  However, with the latest versions of OS X, including Mountain Lion, I've found the default install of CPAN is unable to download modules after automatically generating a list of mirror sites.

The issue is the result of a bad list of mirror sites generated by CPAN's automatic configuration.

Monday, October 15, 2012

Fix vCO's SSH Plugin 'InternalError: Auth fail' Issue

For those of you using the VMware Orchestrator SSH plugin, you may have encountered the following error when invoking the Run SSH command library workflow:
[2012-10-15 16:40:08.400] [I] Connecting with password
[2012-10-15 16:40:08.439] [I] Unable to execute command InternalError: Auth fail (Workflow:Run SSH command / Execute SSH Command (item6)#14) (Workflow:Run SSH command / Execute SSH Command (item6)#31) 
Of course, when using a standard SSH client such as putty or ssh, there are no issues connecting with the same username and password credential set.

The authentication failure is the result of SSH configurations that disable password authentication in favor of keyboard-interactive or public key authentication options.  Unfortunately, vCO's current version of the SSH plugin only supports password and public key authentication.