Archive

Archive for the ‘Virtualization’ Category

Why Hyperic Chose VI Java API for vSphere Integration?

August 11th, 2010 No comments

VMware SpringSource released Hyperic 4.4 last week. According to Charles Lee, co-founder of Hyperic, one key feature is “enhanced management of VMware virtualized environments through integration with VMware vCenter.” I am glad vSphere(VI) Java API (a.k.a. vijava) has contributed to the success of the product.

Here is part of Charles’s blog Hyperic Broadens vSphere Support through vCenter APIs in Version 4.4 explaining the rationale behind the choice:

How to Promote a Virtual Machine’s Disks?

August 10th, 2010 No comments

What does a promotion mean for a virtual machine’s disks? When you get a promotion, you may have more salary, a better title, bigger office space, etc. For sure a virtual disk cannot earn salary and doesn’t care about title, but it can occupy bigger space in datastore.

In my previous blog, I discussed how to create linked virtual machines using vSphere API. These linked virtual machines share a common disk as base, therefore the total disk consumption is significantly reduced. When a virtual disk is promoted, it gets its own “office” other than sharing it with others.

The vSphere API to promote virtual disks is promoteDisks_Task defined with VirtualMachine type. It has a tricky parameter called “unlink” (type: boolean) . According to the API reference:

1. If the unlink parameter is true, any disk backing which is shared shared by multiple virtual machines is copied so that this virtual machine has its own unshared version. Copied files always end up in the virtual machine’s home directory.

2. Any disk backing which is not shared between multiple virtual machines and is not associated with a snapshot is consolidated with its child backing.

Now when should you use true or false? “If the unlink parameter is true, the net effect of this operation is improved read performance, at the cost of disk space. If the unlink parameter is false the net effect is improved read performance at the cost of inhibiting future sharing.”

Here is the sample code that illustrates the usage of the API:

Vertically Complete Systems: Next Big Trend?

August 9th, 2010 2 comments

IBM recently announced its re-organization around its software and hardware business units. The previously separate business units were merged together as one – the Systems and Software Group led by the former software chief Steve Mills.

You may recall that IBM did not have a dedicated software group until Lou Gerstner created one 15 years ago to centralize all the software businesses into one business unit. This unit has been IBM’s most profitable business. Before that, IBM offered all the software as add-ons to the systems like 390 and AS/400.

Now can we expect IBM to offer hardware systems as add-ons to their software solutions?

Although companies constantly re-organize to streamline their business execution, this reorganization did indicate a big trend is happening in the IT industry. Computer vendors are striving to own vertically-complete stacks: from hardware all the way up to business applications.

Who Created That VM: Java Version of the Winning Script of VMware Contest

August 3rd, 2010 2 comments

As you recall from my previous blog on the Script-O-Mania contest, Alan Renouf won the first prize with his Who Created That VM script written in PowerCLI. The script leverages implicitly several vSphere APIs, so I think it would be cool to have a Java version. At least we can illustrate how to use these related vSphere APIs.

The following is a sample I rewote using VI Java API for the same purpose except that Alan’s script shows full display name of a user while this Java version shows user name (see the following diagram). Although longer, the Java version can run on any OS, not just Windows.

Categories: vSphere API Tags: ,

How to Create Linked Virtual Machines with vSphere API?

August 2nd, 2010 15 comments

More often than not, you may have several virtual machines based on same software stacks running on the same host. Although they are very much the same, they take as much space as multitude of what one virtual machine takes.

Since vSphere 4.0, things are different. You can significantly reduce the storage usage by a new feature called linked virtual machines. The idea is simple: sharing a common virtual disk among the similar virtual machines. The shared virtual disk serves as a base. On top of that, each virtual machine has its own delta disk. When a guest operating system writes to disk, the data persists to the delta disk. When it reads from disk, the delta disk is checked first before trying the base disk.

As a result, you only need to save one copy of the base disk no matter how many virtual machines you have (up to 8 virtual machines in a linked virtual machine group). One limitation is that you cannot use it with HA cluster.

How to create linked virtual machines? You have two approaches: clone a virtual machine either from a snapshot, or from its current running state.

What’s Deprecated in vSphere 4.1 API?

July 27th, 2010 No comments

In vSphere 4.1, several properties and types have been deprecated. The following table from vSphere Web Services SDK 4.1 release note lists each deprecated API element and its replacement.

Name of deprecated type, method, or property As of vSphere API 4.1, use instead…
Methods
PropertyCollector.CheckForUpdates PropertyCollector.WaitForUpdatesEx
PropertyCollector.RetrieveProperties PropertyCollector.RetrievePropertiesEx
PropertyCollector.WaitForUpdates PropertyCollector.WaitForUpdatesEx
VirtualMachine.AcquireMksTicket VirtualMachine.AcquireTicket
Data Objects
VirtualMachineMksTicket VirtualMachineTicket
Data Object Properties
Categories: vSphere API Tags: ,

Complete List of Managed Object Types in VMware vSphere API

July 19th, 2010 No comments

The following tables list all the managed object types in VI 3.5, vSphere 4 and 4.1. A short description is provided for each type explaining its major responsibilities.

Note that the managed object types are added in an incremental way. The types in older versions are still supported in newer versions. The complete types in a verion include ones in the correpsonding table plus all the ones in all older version tables.

Hope this post gives you a high level overview of functionalities of the vSphere APIs. Check out other blogs such as best practices (1-5, 6-10) on how to use them in general. And don’t forget my book which introduces them extensively with many read to use samples.

Table 1 Managed Object Types in VI 3.5

Released: vSphere Java API 2.1 Beta for vSphere 4.1

July 16th, 2010 16 comments

Following the vSphere 4.1 release, I am pleased to announce the release of the vSphere(VI) Java API 2.1 beta that fully supports the vSphere 4.1. The 2.1 beta has been ready for limited access for months by VMware internal teams, and partners/customers who participated vSphere 4.1 beta program.

Categories: vSphere API Tags:

What’s New in vSphere 4.1 API?

July 15th, 2010 No comments

VMware announced GA of vSphere 4.1 product this Tuesday. Here is the official what’s new in vSphere 4.1. Many bloggers already covered different aspects of the product itself: VMware vSphere 4.1: Advancing the Platform for Cloud ComputingUseful vSphere 4.1 knowledgebase articlesvSphere 4.1 releasedRelease: VMware vSphere 4.1, etc. I don’t repeat these here, but focus on the new APIs in 4.1 release.

In general, the APIs are the programatic “view” of features. Understanding the features helps a lot on understanding the APIs. So I strongly encourage you to read new features of the product itself. Note that not all the new features especially the performance and scalability features are explicitly reflected in API signatures.

vSphere API 4.1 introduces 7 new managed object types:

vSphere 4.1 adds 23 new methods to 10 existing managed object types:

Categories: vSphere API Tags: ,

VMware Wants to Hear from You about vShere Java API

July 2nd, 2010 No comments

VMware launches an official survey on the open source vSphere(VI) Java API. Please let the company know your take on the open source project, and what you want, for example, formal developer support, etc.

The survey includes 16 simple questions and should take no more than 3 minutes to finish. All the collected information is confidential.

Note that the survey result decides what to come next. Please make sure your voice heard by taking the survey here.

Categories: vSphere API Tags:

vSphere Java API 2.1 Beta Is Ready For Limited Access

June 28th, 2010 No comments

I have finished vSphere(VI) Java API 2.1 beta last week. The major feature is to support next version of vSphere. The company legal also approved the contribution to the open source project after product release.

Because VMware hasn’t released the next version of product yet, I cannot release the code to general public for the moment. API and product are much like the view and model in MVC: from the new APIs you can guess what new features are in the coming product.

Categories: vSphere API Tags: ,

How to Extend vSphere Java API?

June 21st, 2010 7 comments

I got a request a while back for extending the vSphere Java API. The idea is that the API itself is pretty basic and not high level enough for some applications. For example, if you want to add a virtual NIC to a virtual machine, there is no explicit method for doing this. Fair enough.

Now, how to achieve this?

Three possible approaches

  1. Change the structure of the API. For every managed object type, we have two types: one with implementation, and the other inheriting the first one but really empty. The user can replace the first second one with extra methods as extensions. This approach is smart, but will cause confusion in the future. For instance, we will have many different implementations for the sample types.
  2. Use composition. You can create a new type that contains an instance of a managed object. How to expose the methods of the managed object? You can either manually add them to the containing type, or expose the instance of the managed object so that others can call its methods.
  3. Use inheritance. You can create a new type that inherits a managed object type. Once you get an instance of a normal managed object, you can pass into the constructor of extended managed object type. You can use the extended type anywhere a normal type is expected. Let’s pick VirtualMachine as an example,
Categories: vSphere API Tags: ,

How to Notify All the Active vSphere Users?

June 16th, 2010 No comments

As system administrators, you may have used the feature that sends a message to all users. It’s very helpful when you want to change something that might affect others, or ask for particular attention from new users who log in later.

It’s simply 3 steps as described vSphere Client Help:

  1. From the Home page of the vSphere Client, click Sessions.
  2. Type the message in the Message of the day box.
  3. Click Change.

The message is sent to all the currently login users, and until the message is changed, any new users see the message upon logining to the vCenter.

Now, how to do with the API?

Categories: vSphere API Tags: ,

Web-Based Datastore Browser in vSphere

June 14th, 2010 2 comments

Most of us are familiar with MOB, the Web based managed object browser.I’ve discussed the little known secret of it, and built a tiny yet powerful API on top of it.

There is yet another useful tool in vSphere you can leverage: Web based datastore browser. This tool allows you to use a standard Web browser to browse the datastores. You can access it using the following URL:

Really Easy Way to Find out What’s New in vSphere API

June 1st, 2010 1 comment

I am probably one of a few persons who read the VMware vSphere API reference extensively because of my book. When I read it, I normally quickly click the Managed Object Types link in navigation pane on the left side, and then choose one type for the details on the right side.

Categories: vSphere API Tags:

Continuous Deployment With Virtualization and Cloud: An Idea for Startups

May 28th, 2010 2 comments

If you have a new hire, do you want him/her to push code into production system on the very first day? You may be OK with this sometimes. What if it’s a trading system with real money involved? More often than not, you come up with a different answer.

On Wednesday night, I attended a seminar organized by SDForum SAM SIG at LinkedIn headquarter. Pascal-Louis Perez and David Fortunato from Kaching.com engineering team gave a great talk on how they streamlined their software development process to the extent that they normally release 20 times a day to their production system. It’s quite a safe process that it’s OK for a new hire to push code on day one.

VMware SDK Support Program: It’s Available to Everyone

May 25th, 2010 2 comments

Many people know VMware offers support on products, but not many know VMware actually started to support SDKs. I occasionally got questions on the SDK support. So I think a blog should help here.

A little history first. VMware used to provide support to partners who are part of Technical Alliance Program (TAP), but not to others including customer. VMware partners can also propose integration projects which may get people like me to provide architectual guidance. After SpringSource coming on board, Marty Messer took over the support program and expanded it to everyone as a paid service recently.

What You Can Buy?

The paid support is available in two levels:

Categories: vSphere API Tags: ,

VMware vSphere Fault Model and Common Faults

May 24th, 2010 No comments

A fault is like an exception in Java or another modern programming language. It’s a data structure that holds information about an exceptional situation. Most of the faults are raised by the server; you can normally determine the cause from their fault names.

Close to 300 fault types are defined in the vSphere API. Let’s look at the top level hierarchy shown as follows.

 

The supertype for all faults is MethodFault. It is extended by InvalidCollectorVersion, InvalidProperty, RuntimeFault, and VimFault. The first two faults are not further extended to any other fault types.

Categories: vSphere API Tags: ,

Innovation, Openness, Community: Celebrating 2nd Anniversary of vSphere Java API

May 21st, 2010 No comments

It’s been two years since the first release of VI Java API on May 22, 2008. As of today, this VMware sponsored open source API has been downloaded more than 8,200 times including 1,000+ direct access to the source code from SVN. More importantly, the API has been widely adopted by VMware Community including partners and customers in their products and operation environment. I was amazed to hear success stories from companies which use this API to manage 10,000 servers.

Besides Java, people also started to use JVM languages such as Jython and Groovy to leverage the API. I think that is the direction for the API to be used by system administrators who look for an alternative to vSphere PowerCLI which is a great product with no choice but on Windows only.

How Was It Started?

The API was started because of my personal experience while helping VMware strategic partners. I found the Web Services SDK hard to use, and related samples hard to follow because of the procedural nature of Web Services. So I started to think how to solve the problem. During March and April 2008, I wrote code every night on my old Compaq notebook after helping my kid to sleep at night.

Categories: vSphere API Tags:

Two More Jython Samples Managing VMware vSphere

May 18th, 2010 2 comments

Yesterday I posted an article introducing the virtual appliance Timo created last week. I am sure some of you have given it a try. I hope you liked it. If you haven’t done so, you can download it from Timo’s post.

The virtual appliance ships with only two samples. Definitely not enough. That is why the community needs to work together so that we can match the functionalities of vSphere PowerCLI.

The following are two samples by David Rousseau who is an independent consultant living in Paris. Thanks for his permission to publish his code here. He owns the copyright of the code. If you want to use it, you can contact him or leave a message in this post.

  1. jython_rest.py: This code shows how to use the tiny Client REST API I created. Check out this article for more details of the API itself.
  2. jython_test.py: list all the hosts, resource pools, virtual machines and vApps that are found at the server.

To help you understand the code, I added a little comment before each file.