Archive

Archive for December, 2013

VMware Open Sourced Python Binding for vSphere API: What Limit Does It Solve

December 24th, 2013 1 comment

As reported in the community, there were quite excitement about the open source of the pyVmomi, the Python equivalent of vijava API. It was heatedly debated whether to open source the API even when I was working at VMware years ago. One camp of people thought it should be open sourced and even supported as Web Service SDKs; while the other group didn’t think it’s mature and would cause a lot of trouble in so doing. So it didn’t go anywhere in the past few years.

Categories: vSphere API Tags: ,

Parsing XML in Python: A Quick Working Sample

December 22nd, 2013 No comments

In my recent consulting projects, I used Python on various projects including the VMware pyVmomi () for managing vSphere. Because XML is ubiqutous these days, I had to use XML for configuration, passing information, etc. Parsing XML is a very basic part of using XML. The following sample code can achieve the same thing (print out may be different) as the C# sample that parses XML I wrote before.

Categories: Software Development Tags: , ,

Why Renaming Datastore Not Working With Command Line and How to Fix it

December 16th, 2013 No comments

I just got into a very interesting problem recently – the vim-cmd does not work as expected when used for renaming a datastore in vSphere.

What is the problem exactly?

The following command, for example, should change the name of a datastore from datastore1 (which is the default datastore name) to doublecloudDS.

# vim-cmd hostsvc/datastore/rename datastore1 doubecloudDS

After the command is executed, there is no error message reported. But the datastore name remains the same as shown in either the vSphere Client or using the following command:

Categories: Virtualization Tags: , ,

Run esxcli Command in A Browser: Hidden But Probably Better Hack

December 12th, 2013 No comments

My article “Run esxcli Command in a Web Browser: Another ESXi Hack” got quite some interests from the community. Although it works, I am not quite satisfied with the fact that the real esxcfg-info.cgi is disabled to run the esxcli.cgi.

Categories: Virtualization Tags: ,

Setting Up vSphere Web Client SDK: A Few Mistakes to Avoid

December 10th, 2013 5 comments

With the vSphere Web Client, VMware has really made the system complicated and slower. The extension mechanism is more flexible, but forces developers to use more libraries/frameworks/languages, therefore represents a much deeper learning curve than before with the Web based plugins. Installing and configuring the development environment itself could be intimidating for some developers. That is why I wanted to avoid it as long as possible, until I got a consulting project that may involve developing plugin for the Web Client.

Run esxcli Command in a Web Browser: Another ESXi Hack

December 8th, 2013 2 comments

In my recent consulting projects, I really got into a lot of scripting either command lines or Python with ESXi management. As I mentioned the hidden HTML formatter in esxcli command, you may have speculated what could the usage. The answer is simple: Web. But it’s not quite clear how it can be used. That’s where my curiosity started.

Categories: Virtualization Tags: , ,

Lab Automation Made Easy for Training and Testing with VMware Tools for Nested ESXi

December 4th, 2013 No comments

For those who run ESXi on a virtual machine, it’s a great news that VMware has released VMware Tools for nested ESXi as a fling in VMware Labs. Why? With the VMware Tools, you can get guest OS (really the ESXi here) information, like the IP address directly. It may sounds trivial as you can see the IP address from the virtual machine console of a virtualized ESXi. But for automation, it’s pretty hacky to get it programatically. Some people may wonder, “why not run commands via SSH?” It’s true that it’s easy to get the IP by running esxcli command, but you have to get IP first before running the command. With the VMware Tools, you can easily get the IP from vSphere Java API as would with any other normal virtual machines. Even more, you can also run commands like vim-cmd/esxcli in the virtual ESXi via APIs.

Hidden esxcli Command Output Formats You Probably Don’t Know

December 3rd, 2013 No comments

Besides the vim-cmd command I covered earlier, there is another powerful set of commands in ESXi – esxcli. As you can find from the help of the command, it covers 10 namespaces and drills down several layers down. The typical operations with the namespaces are get, set, and list. If you are familiar with REST API, you can think of the bottom level namespaces are resources.

Categories: Virtualization Tags: , ,

Powerful Hacks With ESXi vim-cmd Command, Together With Shell Commands

December 1st, 2013 10 comments

If you have read my previous article on the vim-cmd, you may have realized how handy it is, especially when it comes to manage virtual machines. There is however a pretty challenging problem to use it – for most commands for a virtual machine, it requires vmid which is an integer that uniquely identifies the virtual machine in the context of an ESXi server. It’s like primary key in SQL database to locate a record (virtual machine instance) in a table (virtual machine type). For people who are familiar with vSphere APIs, the vmid is the same as the value of ManagedObjectReference value of a virtual machine in ESXi. Because most administrators who use commands are not necessarily familiar with vSphere API, it doesn’t help much.

Categories: Virtualization Tags: , , ,