18.08.2013 Views

Virtual Disk API Programming Guide - Documentation - VMware

Virtual Disk API Programming Guide - Documentation - VMware

Virtual Disk API Programming Guide - Documentation - VMware

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Virtual</strong> <strong>Disk</strong> <strong>Programming</strong> <strong>Guide</strong><br />

Communicating With the Server<br />

In a typical vSphere deployment with many ESXi hosts, an instance of vCenter Server manages the ESXi hosts,<br />

and can move virtual machines from host to host (vMotion) to balance load and possibly save electricity by<br />

powering off an ESXi host. <strong>VMware</strong> therefore recommends that backup applications communicate with the<br />

vCenter Server instead of with individual ESXi hosts.<br />

The vCenter Server provides location transparency for vSphere Web Services developers. The vCenter Server<br />

tracks virtual machines as they move (through vMotion) from one ESXi host to another, and vCenter Server<br />

directs SDK operations to the ESXi host that currently runs a virtual machine. Using the vSphere Web Services<br />

<strong>API</strong>, it is possible to back up all the virtual disks associated with a virtual machine.<br />

The handling of the vCenter or an individual ESXi host is essentially equivalent when using the vSphere SDK.<br />

With vCenter management, there is no need to contact individual ESXi hosts directly. The remainder of this<br />

chapter uses the term vSphere to indicate either a vCenter Server or an ESXi host.<br />

To reduce the resources used by vSphere, <strong>VMware</strong> recommends that the number of connections (or Sessions)<br />

be minimized. It is in the best interests of any program that communicates with vSphere to create one Session<br />

and share it with all elements of the program that need to exchange information with vSphere. This means that<br />

if your program supports multiple threads, your program should multiplex the use of connection objects by<br />

use of access control locks (mutex and the like).<br />

It is also important that all vSphere SDK operations proceed from one instance of the “Session” object that your<br />

application requests after logging into vSphere. Using the vSphere <strong>API</strong> your application can create objects that<br />

are “Session specific” and therefore would not be known to other portions of your application that might use<br />

a different Session.<br />

Information Containers as Managed Objects<br />

<strong>VMware</strong> documentation introduces you to the concept of the managed object and its handle, called a managed<br />

object reference (moRef). You might be tempted to get configuration and status information of managed<br />

objects using a piecemeal approach. This has the severe disadvantage of creating a lot of chatter over the server<br />

connection, so it is very slow. A mechanism has been created to provide status information efficiently: the<br />

PropertyCollector, discussed in “PropertyCollector Data” on page 59.<br />

More About Managed Objects<br />

The documentation for the vSphere <strong>API</strong> and object model introduces a large number of managed objects.<br />

There are five basic types of managed objects that describe the organization of a server. Other managed objects<br />

can be considered as details expanding on these five basic types:<br />

Folder<br />

Datacenter<br />

ComputeResource<br />

ResourcePool<br />

<strong>Virtual</strong>Machine<br />

It is a characteristic of all managed objects that they have a moRef to the managed object that serves as the<br />

parent to the managed object. This parent moRef allows you to reconstruct the object hierarchy exposed by the<br />

vSphere SDK. In general the hierarchy is a tree‐like structure along the lines of:<br />

Root Folder > Datacenter > ComputeResource > ResourcePool > <strong>Virtual</strong>Machine<br />

There are variations on this theme, depending on whether you connect to vCenter or directly to an ESXi host,<br />

but the overall organization is like the structure above. Each managed object also has a Name property.<br />

The virtual machine that you want to back up, and the snapshot you take of it (the extensible managed object<br />

<strong>Virtual</strong>MachineSnapshot) are both designated by their moRef.<br />

58 <strong>VMware</strong>, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!