org.jenkinsci.plugins.vsphere.tools
Class VSphere

java.lang.Object
  extended by org.jenkinsci.plugins.vsphere.tools.VSphere

public class VSphere
extends Object


Method Summary
static VSphere connect(String server, String user, String pw)
          Initiates Connection to vSphere Server
static VSphere connect(String server, String user, String pw, String cluster, String resourcePool)
           
 void destroyVm(String name, boolean failOnNoExist)
          Detroys the VM in vSphere
 com.vmware.vim25.ManagedObjectReference findSnapshotInTree(com.vmware.vim25.VirtualMachineSnapshotTree[] snapTree, String snapName)
           
 String getIp(com.vmware.vim25.mo.VirtualMachine vm)
          Shortcut
 com.vmware.vim25.mo.VirtualMachine getVmByName(String vmName)
           
 void markAsTemplate(String vmName, String snapName, String desc, boolean force)
           
 com.vmware.vim25.mo.VirtualMachine markAsVm(String name)
           
 void revertToSnapshot(String vmName, String snapName)
           
 com.vmware.vim25.mo.VirtualMachine shallowCloneVm(String cloneName, String template, boolean powerOn, boolean linkedClone)
          Creates a new VM from a given template with a given name.
 void startVm(String name)
           
 void takeSnapshot(String name, String snapshot, String description)
           
static String vSphereOutput(String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

connect

public static VSphere connect(String server,
                              String user,
                              String pw)
                       throws VSphereException
Initiates Connection to vSphere Server

Throws:
VSphereException

connect

public static VSphere connect(String server,
                              String user,
                              String pw,
                              String cluster,
                              String resourcePool)
                       throws VSphereException
Throws:
VSphereException

vSphereOutput

public static String vSphereOutput(String msg)

shallowCloneVm

public com.vmware.vim25.mo.VirtualMachine shallowCloneVm(String cloneName,
                                                         String template,
                                                         boolean powerOn,
                                                         boolean linkedClone)
                                                  throws VSphereException
Creates a new VM from a given template with a given name.

Parameters:
cloneName - - name of VM to be created
template - - vsphere template name to clone
verboseOutput - - true for extra output to logs
Returns:
- Virtual Machine object of the new VM
Throws:
Exception
VSphereException

startVm

public void startVm(String name)
             throws VSphereException
Parameters:
name - - Name of VM to start
Throws:
VSphereException

findSnapshotInTree

public com.vmware.vim25.ManagedObjectReference findSnapshotInTree(com.vmware.vim25.VirtualMachineSnapshotTree[] snapTree,
                                                                  String snapName)

revertToSnapshot

public void revertToSnapshot(String vmName,
                             String snapName)

takeSnapshot

public void takeSnapshot(String name,
                         String snapshot,
                         String description)
                  throws VSphereException
Throws:
VSphereException

markAsTemplate

public void markAsTemplate(String vmName,
                           String snapName,
                           String desc,
                           boolean force)
                    throws VSphereException
Throws:
VSphereException

markAsVm

public com.vmware.vim25.mo.VirtualMachine markAsVm(String name)
                                            throws VSphereException
Throws:
VSphereException

getIp

public String getIp(com.vmware.vim25.mo.VirtualMachine vm)
             throws VSphereException
Shortcut

Parameters:
name - - VirtualMachine name of which IP is returned
Returns:
- String containing IP address
Throws:
VSphereException

getVmByName

public com.vmware.vim25.mo.VirtualMachine getVmByName(String vmName)
                                               throws com.vmware.vim25.InvalidProperty,
                                                      com.vmware.vim25.RuntimeFault,
                                                      RemoteException,
                                                      MalformedURLException
Parameters:
vmName - - name of VM object to retrieve
Returns:
- VirtualMachine object
Throws:
com.vmware.vim25.InvalidProperty
com.vmware.vim25.RuntimeFault
RemoteException
MalformedURLException
VSphereException

destroyVm

public void destroyVm(String name,
                      boolean failOnNoExist)
               throws VSphereException
Detroys the VM in vSphere

Parameters:
vm - - VM object to destroy
Throws:
VSphereException


Copyright © 2004-2013. All Rights Reserved.