org.ow2.jasmine.vmm.api
Interface VirtualMachineMXBean

All Superinterfaces:
ManagedResourceMXBean

public interface VirtualMachineMXBean
extends ManagedResourceMXBean

Management interface of a virtual machine. The ObjectName for identifying a VirtualMachineMXBean follows the following template:

org.ow2.jasmine.vmm.api:type=VirtualMachine,name=<pathname>,uuid=<uuid>

The notifications that can be emitted by a HostMXBean are as follows


Nested Class Summary
static class VirtualMachineMXBean.PowerState
          Different states of a virtual machine.
 
Method Summary
 boolean canLiveMigrateToHost(HostMXBean targetHost)
          Returns true if the VM can be migrated to the given host using live migration
 VirtualMachineMXBean cloneVM(java.lang.String vmName, VMCustomizationSpec custSpec, boolean sync)
          Clones the VM
 void destroy()
          Destroy the VM
 java.lang.String getConsole()
          Returns the console of the virtual machine (if supported by the driver and exposed by the virtual machine)
 boolean[][] getCPUAffinity()
          Returns the CPU affinity for each VCPU of the virtual machine The affinity is represented by a matrix indexed by the VCPU number (first array dimension) and by the physical CPU number (second array dimension).
 float getCPULoad()
          Returns the CPU load of the VM
 java.lang.String getGuestIpAddress()
          Returns the IP addresses of the guest operating system running within the VM.
 HostMXBean getHostMBean()
          Returns the host this VM resides on
 float[] getLoadPerVCPU()
          Returns the load per virtual CPU of the VM
 java.lang.String getMacAddress()
          Returns the MAC addresses of all network interfaces associated with this VM
 long getMemorySizeMB()
          Returns the memory size in MBytes of the virtual machine
 long getMemoryUsedMB()
          Returns the amount of memory (in MBytes) used by the virtual machine
 java.lang.String getNameLabel()
          Returns the name of the virtual machine
 int getNumVCPUs()
          Returns the number of virtual CPUs assigned to the virtual machine
 ResourceUsage getResourceUsage()
          Return the current resource usage (CPU, memory, network, disk I/O) for this VM
 int getSchedulingCap()
          Returns the scheduling cap assigned to the VM
 int getSchedulingWeight()
          Returns the scheduling weight assigned to the VM
 java.util.Date getStartTime()
          Returns the start time of the virtual machine
 VirtualMachineMXBean.PowerState getState()
          Returns the power state of the VM
 java.lang.String getUserData(java.lang.String key)
          Returns user data associated with the specified key
 java.lang.String getUuid()
          Returns the Uuid of the virtual machine
 VirtualMachineImageMXBean makeTemplate(java.lang.String name, java.lang.String description, java.util.Map<java.lang.String,java.lang.String> metadata)
          Creates a new VM image out of this virtual machine This operation is allowed only if the VM is not running
 void migrate(HostMXBean targetHost, boolean live)
          Migrate the VM to a target host.
 void pause()
          Pause the VM
 void reboot()
          Reboot the VM
 void resume()
          Resume the VM
 void setCPUAffinity(boolean[][] affinity)
          Sets the CPU affinity for each VCPU of the virtual machine The affinity is represented by a matrix indexed by the VCPU number (first array dimension) and by the physical CPU number (second array dimension).
 void setMemorySizeMB(long size)
          Attempts to change the memory sie of the virtual machine
 void setNumVCPUs(int numVCPUs)
          Changes the number of virtual CPUs assigned to the virtual machine
 void setSchedulingCap(int schedulingCap)
          Sets the scheduling cap assigned to the VM
 void setSchedulingWeight(int schedulingWeight)
          Sets the scheduling cap assigned to the VM
 void shutdown()
          Shutdown the VM
 void start()
          Start the VM
 void suspend()
          Suspend the VM
 void unpause()
          Unpause the VM
 
Methods inherited from interface org.ow2.jasmine.vmm.api.ManagedResourceMXBean
getObjectName, getPath
 

Method Detail

getUuid

java.lang.String getUuid()
                         throws VMMException
Returns the Uuid of the virtual machine

Returns:
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getHostMBean

HostMXBean getHostMBean()
                        throws VMMException
Returns the host this VM resides on

Returns:
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getNameLabel

java.lang.String getNameLabel()
                              throws VMMException
Returns the name of the virtual machine

Returns:
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getMacAddress

java.lang.String getMacAddress()
                               throws VMMException
Returns the MAC addresses of all network interfaces associated with this VM

Returns:
MAC addresses in xx:xx:xx:xx:xx:xx format
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getGuestIpAddress

java.lang.String getGuestIpAddress()
                                   throws VMMException
Returns the IP addresses of the guest operating system running within the VM.

Returns:
IP addresses or null if the manager is unable to determine the IP addresses
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getLoadPerVCPU

float[] getLoadPerVCPU()
                       throws VMMException
Returns the load per virtual CPU of the VM

Returns:
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getCPULoad

float getCPULoad()
                 throws VMMException
Returns the CPU load of the VM

Returns:
Throws:
javax.management.InstanceNotFoundException
VMMException

getStartTime

java.util.Date getStartTime()
                            throws VMMException
Returns the start time of the virtual machine

Returns:
Throws:
javax.management.InstanceNotFoundException
VMMException

getMemorySizeMB

long getMemorySizeMB()
                     throws VMMException
Returns the memory size in MBytes of the virtual machine

Returns:
Throws:
javax.management.InstanceNotFoundException
VMMException

setMemorySizeMB

void setMemorySizeMB(long size)
                     throws VMMException
Attempts to change the memory sie of the virtual machine

Parameters:
size - target size
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getMemoryUsedMB

long getMemoryUsedMB()
                     throws VMMException
Returns the amount of memory (in MBytes) used by the virtual machine

Returns:
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getResourceUsage

ResourceUsage getResourceUsage()
                               throws VMMException
Return the current resource usage (CPU, memory, network, disk I/O) for this VM

Returns:
a ResourceUsage object representing the resource usage of this VM
Throws:
VMMException

getNumVCPUs

int getNumVCPUs()
                throws VMMException
Returns the number of virtual CPUs assigned to the virtual machine

Returns:
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

setNumVCPUs

void setNumVCPUs(int numVCPUs)
                 throws VMMException
Changes the number of virtual CPUs assigned to the virtual machine

Parameters:
numVCPUs -
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getSchedulingCap

int getSchedulingCap()
                     throws VMMException
Returns the scheduling cap assigned to the VM

Returns:
current scheduling cap
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

setSchedulingCap

void setSchedulingCap(int schedulingCap)
                      throws VMMException
Sets the scheduling cap assigned to the VM

Parameters:
schedulingCap - new cap
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getSchedulingWeight

int getSchedulingWeight()
                        throws VMMException
Returns the scheduling weight assigned to the VM

Returns:
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

setSchedulingWeight

void setSchedulingWeight(int schedulingWeight)
                         throws VMMException
Sets the scheduling cap assigned to the VM

Parameters:
schedulingWeight - new weight
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

getCPUAffinity

boolean[][] getCPUAffinity()
                           throws VMMException
Returns the CPU affinity for each VCPU of the virtual machine The affinity is represented by a matrix indexed by the VCPU number (first array dimension) and by the physical CPU number (second array dimension). A true value for element [i][j] signifies that VCPU i can be mapped to the physical CPU j of the underlying host

Returns:
the CPU affinity for all VCPUs of the virtual machine
Throws:
VMMException

setCPUAffinity

void setCPUAffinity(boolean[][] affinity)
                    throws VMMException
Sets the CPU affinity for each VCPU of the virtual machine The affinity is represented by a matrix indexed by the VCPU number (first array dimension) and by the physical CPU number (second array dimension). A true value for element [i][j] signifies that VCPU i can be mapped to the physical CPU j of the underlying host. Note that a particular virtualization system might not be able to enforce this CPU affinity or only partially.

Parameters:
affinity - the CPU affinity
Throws:
VMMException

getState

VirtualMachineMXBean.PowerState getState()
                                         throws VMMException
Returns the power state of the VM

Returns:
current power state
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

suspend

void suspend()
             throws VMMException,
                    BadVMPowerStateException
Suspend the VM

Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
BadVMPowerStateException - thrown if the VM is not in the appropriate state
VMMException

resume

void resume()
            throws VMMException,
                   BadVMPowerStateException
Resume the VM

Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
BadVMPowerStateException - thrown if the VM is not in the appropriate state
VMMException

shutdown

void shutdown()
              throws VMMException,
                     BadVMPowerStateException
Shutdown the VM

Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
BadVMPowerStateException - thrown if the VM is not in the appropriate state
VMMException

start

void start()
           throws VMMException,
                  BadVMPowerStateException
Start the VM

Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
BadVMPowerStateException - thrown if the VM is not in the appropriate state
VMMException

pause

void pause()
           throws VMMException,
                  BadVMPowerStateException
Pause the VM

Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
BadVMPowerStateException - thrown if the VM is not in the appropriate state
VMMException

unpause

void unpause()
             throws VMMException,
                    BadVMPowerStateException
Unpause the VM

Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
BadVMPowerStateException - thrown if the VM is not in the appropriate state
VMMException

reboot

void reboot()
            throws VMMException,
                   BadVMPowerStateException
Reboot the VM

Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
BadVMPowerStateException - thrown if the VM is not in the appropriate state
VMMException

destroy

void destroy()
             throws VMMException
Destroy the VM

Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
VMMException

canLiveMigrateToHost

boolean canLiveMigrateToHost(HostMXBean targetHost)
                             throws VMMException
Returns true if the VM can be migrated to the given host using live migration

Parameters:
targetHost - host on which the VM migration is tested
Throws:
VMMException

migrate

void migrate(HostMXBean targetHost,
             boolean live)
             throws IllegalOperationException,
                    VMMException
Migrate the VM to a target host. Note that the target host must belong to the same server pool as the VM's current host.

Parameters:
targetHost - target host of the migration
live - if true a live migration will be attempted
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
IllegalOperationException - thrown if the migration cannot be performed
VMMException

getUserData

java.lang.String getUserData(java.lang.String key)
                             throws VMMException
Returns user data associated with the specified key

Parameters:
key - of the user data to return
Returns:
user data for the specified key
Throws:
VMMException

getConsole

java.lang.String getConsole()
                            throws VMMException
Returns the console of the virtual machine (if supported by the driver and exposed by the virtual machine)

Returns:
console of the virtual machine or null if none available
Throws:
VMMException

cloneVM

VirtualMachineMXBean cloneVM(java.lang.String vmName,
                             VMCustomizationSpec custSpec,
                             boolean sync)
                             throws InsufficientResourcesException,
                                    VMMException
Clones the VM

Parameters:
vmName - name to be given to the new VM
custSpec - optional customization parameters
sync - if true, the operation is synchronous
Returns:
the management interface of the cloned VM if sync is true, null otherwise
Throws:
javax.management.InstanceNotFoundException - thrown if the specified MXBean does not exist
InsufficientResourcesException - raised if not enough resources are available to clone the VM
VMMException

makeTemplate

VirtualMachineImageMXBean makeTemplate(java.lang.String name,
                                       java.lang.String description,
                                       java.util.Map<java.lang.String,java.lang.String> metadata)
                                       throws InsufficientResourcesException,
                                              IllegalOperationException,
                                              BadVMPowerStateException,
                                              VMMException
Creates a new VM image out of this virtual machine This operation is allowed only if the VM is not running

Parameters:
name - name of the image
description - description of the image
metadata - metadata to associate with the image
Returns:
the created virtual image
Throws:
InsufficientResourcesException - raised if there is not enough storage capacity for the new image
IllegalOperationException - raised if the virtual machine is not connected to this VirtualMachineImageStore
BadVMPowerStateException - raised if the VM is running
VMMException - raised if a runtime error occurs


Copyright © 2010 OW2 Consortium. All Rights Reserved.