com.vmware.apputils.vim
Class VMUtils

java.lang.Object
  extended by com.vmware.apputils.vim.VMUtils

public class VMUtils
extends java.lang.Object


Field Summary
 AppUtil cb
           
 
Constructor Summary
VMUtils(AppUtil argCB)
           
 
Method Summary
 void browseArrayList(java.util.ArrayList arrList)
           
 void browseMOR(com.vmware.vim.ManagedObjectReference MOR)
           
 com.vmware.vim.VirtualDeviceConfigSpec createVirtualDisk(java.lang.String volName, int diskCtlrKey, com.vmware.vim.ManagedObjectReference datastoreRef, int diskSizeMB)
           
 com.vmware.vim.VirtualMachineConfigSpec createVmConfigSpec(java.lang.String vmName, java.lang.String datastoreName, int diskSizeMB, com.vmware.vim.ManagedObjectReference computeResMor, com.vmware.vim.ManagedObjectReference hostMor)
           
 com.vmware.vim.ConfigTarget getConfigTargetForHost(com.vmware.vim.ManagedObjectReference computeResMor, com.vmware.vim.ManagedObjectReference hostMor)
          This method returns the ConfigTarget for a HostSystem
 com.vmware.vim.VirtualDevice[] getDefaultDevices(com.vmware.vim.ManagedObjectReference computeResMor, com.vmware.vim.ManagedObjectReference hostMor)
          The method returns the default devices from the HostSystem
 com.vmware.vim.ManagedObjectReference getHost(com.vmware.vim.ManagedObjectReference hostFolderMor, java.lang.String hostname)
          This method returns a MoRef to the HostSystem with the supplied name under the supplied Folder.
 com.vmware.vim.ManagedObjectReference getHostFolder(com.vmware.vim.ManagedObjectReference dcmor)
          This method returns the contents of the hostFolder property from the supplied Datacenter MoRef
 java.util.ArrayList getVMs(java.lang.String entity, java.lang.String datacenter, java.lang.String folder, java.lang.String pool, java.lang.String vmname, java.lang.String host, java.lang.String[][] filter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cb

public AppUtil cb
Constructor Detail

VMUtils

public VMUtils(AppUtil argCB)
Method Detail

getVMs

public java.util.ArrayList getVMs(java.lang.String entity,
                                  java.lang.String datacenter,
                                  java.lang.String folder,
                                  java.lang.String pool,
                                  java.lang.String vmname,
                                  java.lang.String host,
                                  java.lang.String[][] filter)
                           throws java.lang.Exception
Throws:
java.lang.Exception

getHostFolder

public com.vmware.vim.ManagedObjectReference getHostFolder(com.vmware.vim.ManagedObjectReference dcmor)
                                                    throws java.lang.Exception
This method returns the contents of the hostFolder property from the supplied Datacenter MoRef

Parameters:
dcmor - MoRef to the Datacenter
Returns:
MoRef to a Folder returned by the hostFolder property or null if dcmor is NOT a MoRef to a Datacenter or if the hostFolder doesn't exist
Throws:
java.lang.Exception

getHost

public com.vmware.vim.ManagedObjectReference getHost(com.vmware.vim.ManagedObjectReference hostFolderMor,
                                                     java.lang.String hostname)
                                              throws java.lang.Exception
This method returns a MoRef to the HostSystem with the supplied name under the supplied Folder. If hostname is null, it returns the first HostSystem found under the supplied Folder

Parameters:
hostFolderMor - MoRef to the Folder to look in
hostname - Name of the HostSystem you are looking for
Returns:
MoRef to the HostSystem or null if not found
Throws:
java.lang.Exception

browseMOR

public void browseMOR(com.vmware.vim.ManagedObjectReference MOR)

browseArrayList

public void browseArrayList(java.util.ArrayList arrList)

createVmConfigSpec

public com.vmware.vim.VirtualMachineConfigSpec createVmConfigSpec(java.lang.String vmName,
                                                                  java.lang.String datastoreName,
                                                                  int diskSizeMB,
                                                                  com.vmware.vim.ManagedObjectReference computeResMor,
                                                                  com.vmware.vim.ManagedObjectReference hostMor)
                                                           throws java.lang.Exception
Throws:
java.lang.Exception

getConfigTargetForHost

public com.vmware.vim.ConfigTarget getConfigTargetForHost(com.vmware.vim.ManagedObjectReference computeResMor,
                                                          com.vmware.vim.ManagedObjectReference hostMor)
                                                   throws java.lang.Exception
This method returns the ConfigTarget for a HostSystem

Parameters:
computeResMor - A MoRef to the ComputeResource used by the HostSystem
hostMor - A MoRef to the HostSystem
Returns:
Instance of ConfigTarget for the supplied HostSystem/ComputeResource
Throws:
java.lang.Exception - When no ConfigTarget can be found

getDefaultDevices

public com.vmware.vim.VirtualDevice[] getDefaultDevices(com.vmware.vim.ManagedObjectReference computeResMor,
                                                        com.vmware.vim.ManagedObjectReference hostMor)
                                                 throws java.lang.Exception
The method returns the default devices from the HostSystem

Parameters:
computeResMor - A MoRef to the ComputeResource used by the HostSystem
hostMor - A MoRef to the HostSystem
Returns:
Array of VirtualDevice containing the default devices for the HostSystem
Throws:
java.lang.Exception

createVirtualDisk

public com.vmware.vim.VirtualDeviceConfigSpec createVirtualDisk(java.lang.String volName,
                                                                int diskCtlrKey,
                                                                com.vmware.vim.ManagedObjectReference datastoreRef,
                                                                int diskSizeMB)