Secret of vApp Template in vSphere

My colleagues and I had a discussion regarding the vApp template. After virtual machine template for virtual machine, you would expect vApp template for vApp and manage it in a similar way from the vSphere Client. But you cannot.

Most of us know that from vSphere Client, you have context menu item allowing you to convert a virtual machine to a template easily with a click. However you cannot find a similar menu item with a vApp. You can choose to convert a virtual machine inside a vApp, but then the converted template will jump out of the vApp container.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

Can we have vApp template? The answer is we can, but in a different way.

To fully understand what’s happening, let’s look into vSphere API which will shed some insights about this. To most people’s surprise, vApp (VirtualApp) is a sub type of ResourcePool, not VirtualMachine although it behaves somewhat like a virtual machine in that you can power on and off a vApp as would a virtual machine. This is a good example in which knowing API gives you insights on how the system is constructed under the hook. That is why system administrators want to learn about API, especially object model, even though not developing code.

The difference of a virtual machine and a virtual machine template is that a virtual machine is not associated with a ResourcePool object. That is why you need to specify a resource pool when turning a template to a virtual machine, as shown in the following method:

public void markAsVirtualMachine(ResourcePool pool, HostSystem host)

Note that the first pool parameter is a required parameter and cannot be null as the second one. Given a vApp itself is a ResourcePool, you cannot remove its association with a ResourcePool object, or destroy itself.

Now, how can we have a template for vApp? In fact, it’s pretty easy. You would use OVF as the template.

From vSphere Client, you can get to the “Export OVF Template” dialog box, shown below, from File->Export->Export OVF Template. It allows you to export a vApp to your local machine in OVF.

It’s also easy to deploy an OVF package to vApp with “Deploy OVF Template” dialog box as follows from File->Deploy OVF Template menu path. You can specify either from a local file or from a URL pointing to an OVF package. Unlike the other direction, you will have to go through several more steps here including accepting end user license agreement.

You can of course export and deploy (import) OVF packages with vSphere API. Check out this blog for more details and samples.

This entry was posted in Virtualization, vSphere API and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted February 3, 2013 at 12:49 am | Permalink

    “Secret of vApp Template in vSphere |” definitely causes me ponder a somewhat extra.
    I personally treasured every individual part of this post.
    Thanks a lot -Thalia

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


    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.