Monthly Archives: December 2013

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

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.

Posted in vSphere API | Tagged , | 1 Response

Parsing XML in Python: A Quick Working Sample

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.

Posted in Software Development | Tagged , , | Leave a comment

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

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:

Posted in Virtualization | Tagged , , | Leave a comment

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

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.

Posted in Virtualization | Tagged , | Leave a comment

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

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.

Posted in Virtualization | Tagged , | 5 Responses

Run esxcli Command in a Web Browser: Another ESXi Hack

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.

Posted in Virtualization | Tagged , , | 2 Responses

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

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.

Posted in Virtualization, vSphere API | Tagged , , , | Leave a comment

Hidden esxcli Command Output Formats You Probably Don’t Know

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.

Posted in Virtualization | Tagged , , | 1 Response

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

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.

Posted in Virtualization | Tagged , , , | 8 Responses

    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.