org.paulneve.wlab.virtualisation
Interface VirtualisationAccess

All Known Implementing Classes:
VirtualisationAccessHyperVImpl

public interface VirtualisationAccess

Interface for accessing the virtualisation backend.

Author:
Paul Neve

Method Summary
 java.lang.String cloneVM(java.lang.String nameOfParent, java.lang.String nameOfClone)
          Sends a request to clone a VM.
 void deleteSnapshot(java.lang.String name, int index)
          Delete snapshot from VM
 void deleteVM(java.lang.String name)
          Sends a request to delete a VM.
 int getNumberOfCurrentlyRunningVMs()
          Does precisely what it says.
 java.lang.String getVMIP(java.lang.String name)
          Gets the IP address(es) of a VM.
 java.lang.String getVMStatus(java.lang.String name)
          Gets a VM status.
 boolean isAlive(java.lang.String name)
          Determines whether a VM is "alive" or not.
 java.util.ArrayList<java.lang.String> listVMs()
          Does precisely what it says.
 int numberOfSnapshots(java.lang.String name)
          Returns number of snapshots that VM /name/ has.
 void revertToSnapshot(java.lang.String name, int index)
          Reverts VM /name/ to snapshot /index/, where the first snapshot (usually the start point of the stage) is 0
 void snapshotVm(java.lang.String name)
          Takes a snapshot of VM
 void startVM(java.lang.String name)
          Sends a request to start a VM from either a stopped or suspended state.
 void suspendVM(java.lang.String name)
          Sends a request to suspend a VM that is currently running.
 void turnOffVM(java.lang.String name)
          "Hard" power down a VM, i.e.
 

Method Detail

startVM

void startVM(java.lang.String name)
Sends a request to start a VM from either a stopped or suspended state.

Parameters:
name - Name of the VM to start.

suspendVM

void suspendVM(java.lang.String name)
Sends a request to suspend a VM that is currently running.

Parameters:
name - Name of the VM to suspend.

turnOffVM

void turnOffVM(java.lang.String name)
"Hard" power down a VM, i.e. turns it off immediately

Parameters:
name - Name of the VM to turn off.

deleteVM

void deleteVM(java.lang.String name)
Sends a request to delete a VM.

Parameters:
name - Name of the VM to delete

cloneVM

java.lang.String cloneVM(java.lang.String nameOfParent,
                         java.lang.String nameOfClone)
Sends a request to clone a VM.

Parameters:
nameOfParent - string, name of parent VM to clone
nameOfClone - string, name of the new clone
Returns:
return nameOfClone, unless unsuccesful, in which case null

listVMs

java.util.ArrayList<java.lang.String> listVMs()
Does precisely what it says.

Returns:
An arraylist of strings, with the names of the VMs available on the backend.

getVMStatus

java.lang.String getVMStatus(java.lang.String name)
Gets a VM status. Returned statuses should be one of "Started" "Stopped" "Suspended" "Changing state" "Unknown"

Parameters:
name - Name of VM to return status of
Returns:
One of the specified status strings.

getVMIP

java.lang.String getVMIP(java.lang.String name)
Gets the IP address(es) of a VM. Depending on your virtualisation layer, you might want to make use of org.paulneve.wlab.utilitiesMacToIP to derive the IP from the virtual network card's MAC address, if the virtualisation layer cannot get you an IP via a more direct route.

The IP addresses returned should be relative to the WLab server, i.e. ones which can be routed to from the WLab server. External access will use Jumpgate to route through via a single exposed external port/IP.

Parameters:
name - Name of VM
Returns:
a string, containing IP addresses in form XXX.XXX.XXX.XXX, separated with commas, no spaces.

snapshotVm

void snapshotVm(java.lang.String name)
Takes a snapshot of VM

Parameters:
name - string, i.e. name of VM to create a snapshot for

revertToSnapshot

void revertToSnapshot(java.lang.String name,
                      int index)
Reverts VM /name/ to snapshot /index/, where the first snapshot (usually the start point of the stage) is 0

Parameters:
name - name of VM
index - integer, snapshot number to rever to

numberOfSnapshots

int numberOfSnapshots(java.lang.String name)
Returns number of snapshots that VM /name/ has.

Parameters:
name - string, name of VM to get data for

deleteSnapshot

void deleteSnapshot(java.lang.String name,
                    int index)
Delete snapshot from VM

Parameters:
name - name of VM to delete snapshot on
index - index of snapshot to delete - 0 is first, usually the base snapshot for start of stage

getNumberOfCurrentlyRunningVMs

int getNumberOfCurrentlyRunningVMs()
Does precisely what it says.

Returns:
The answer to life the universe, and everything. Oh, no, actually this just returns the number of currently running VMs. You'd never have guessed that really.

isAlive

boolean isAlive(java.lang.String name)
Determines whether a VM is "alive" or not. This is different to it's status at the virtualisation back end. A VM that is alive should (in theory) be ready to connect to via VNC. A VM that merely has a status of "started" might still be in the boot process.

Parameters:
name - name of VM to check.
Returns:
true or false, i.e. true if it's "alive"