OpenNebula
Cloud API

org.opennebula.client.vm
Class VirtualMachine

java.lang.Object
  extended by org.opennebula.client.PoolElement
      extended by org.opennebula.client.vm.VirtualMachine

public class VirtualMachine
extends PoolElement

This class represents an OpenNebula VM. It also offers static XML-RPC call wrappers.


Field Summary
 
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
 
Constructor Summary
  VirtualMachine(int id, Client client)
          Creates a new VM representation.
protected VirtualMachine(org.w3c.dom.Node xmlElement, Client client)
           
 
Method Summary
protected  OneResponse action(java.lang.String action)
          Submits an action to be performed on the virtual machine.
static OneResponse allocate(Client client, java.lang.String description)
          Allocates a new VM in OpenNebula.
static OneResponse allocate(Client client, java.lang.String description, boolean onHold)
          Allocates a new VM in OpenNebula.
static OneResponse attachdisk(Client client, int id, java.lang.String diskTemplate)
          Deprecated. Replaced by diskAttach(org.opennebula.client.Client, int, java.lang.String)
 OneResponse attachdisk(java.lang.String diskTemplate)
          Deprecated. Replaced by diskAttach(String)
 OneResponse boot()
          Forces a re-deployment of a VM in UNKNOWN or BOOT states.
 OneResponse cancel()
          Deprecated. Replaced by hard shutdown shutdown(boolean)
 OneResponse chgrp(int gid)
          Changes the group
static OneResponse chmod(Client client, int id, int octet)
          Changes the permissions
static OneResponse chmod(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a)
          Changes the VM permissions
static OneResponse chmod(Client client, int id, java.lang.String octet)
          Changes the permissions
 OneResponse chmod(int octet)
          Changes the permissions
 OneResponse chmod(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a)
          Changes the VM permissions
 OneResponse chmod(java.lang.String octet)
          Changes the permissions
static OneResponse chown(Client client, int id, int uid, int gid)
          Changes the owner/group
 OneResponse chown(int uid)
          Changes the owner
 OneResponse chown(int uid, int gid)
          Changes the owner/group
 OneResponse delete()
          Deletes the VM from the pool and database.
 OneResponse delete(boolean recreate)
          Deletes the VM from the pool and database.
 OneResponse deploy(int hostId)
          Initiates the instance of the VM on the target host.
 OneResponse deploy(int hostId, boolean enforce)
          Initiates the instance of the VM on the target host.
static OneResponse detachdisk(Client client, int id, int diskId)
          Deprecated. Replaced by diskDetach(org.opennebula.client.Client, int, int)
 OneResponse detachdisk(int diskId)
          Deprecated. 
static OneResponse diskAttach(Client client, int id, java.lang.String diskTemplate)
          Attaches a disk to a running VM
 OneResponse diskAttach(java.lang.String diskTemplate)
          Attaches a disk to a running VM
static OneResponse diskDetach(Client client, int id, int diskId)
          Detaches a disk from a running VM
 OneResponse diskDetach(int diskId)
          Detaches a disk from a running VM
static OneResponse diskSnapshot(Client client, int id, int diskId, java.lang.String imageName, java.lang.String imageType, boolean hot)
          Sets the specified vm's disk to be saved in a new image.
 OneResponse diskSnapshot(int diskId, java.lang.String imageName)
          Sets the specified vm's disk to be saved in a new image when the VirtualMachine shuts down.
 OneResponse diskSnapshot(int diskId, java.lang.String imageName, boolean hot)
          Sets the specified vm's disk to be saved in a new image.
 OneResponse diskSnapshot(int diskId, java.lang.String imageName, java.lang.String imageType, boolean hot)
          Sets the specified vm's disk to be saved in a new image.
 OneResponse finalizeVM()
          Deprecated. Replaced by delete()
 OneResponse hold()
          Sets the VM to hold state.
 OneResponse info()
          Loads the xml representation of the virtual machine.
static OneResponse info(Client client, int id)
          Retrieves the information of the given VM.
 int lcmState()
          Returns the LCM state of the VirtualMachine (numeric value).
 java.lang.String lcmStateStr()
          Returns the LCM state of the VirtualMachine (string value).
 OneResponse liveMigrate(int hostId)
          Deprecated. Replaced by migrate(int, boolean, boolean)
 OneResponse migrate(int hostId)
          Migrates the virtual machine to the target host (hid).
 OneResponse migrate(int hostId, boolean live)
          Migrates the virtual machine to the target host (hid).
 OneResponse migrate(int hostId, boolean live, boolean enforce)
          Migrates the virtual machine to the target host (hid).
 OneResponse monitoring()
          Retrieves the monitoring information of the given VM, in XML
static OneResponse monitoring(Client client, int id)
          Retrieves the monitoring information of the given VM, in XML
static OneResponse nicAttach(Client client, int id, java.lang.String nicTemplate)
          Attaches a NIC to a running VM
 OneResponse nicAttach(java.lang.String nicTemplate)
          Attaches a NIC to a running VM
static OneResponse nicDetach(Client client, int id, int nicId)
          Detaches a NIC from a running VM
 OneResponse nicDetach(int nicId)
          Detaches a NIC from a running VM
 OneResponse poweroff()
          Powers off a running VM.
 OneResponse poweroff(boolean hard)
          Powers off a running VM.
 OneResponse reboot()
          Reboots a running VM.
 OneResponse reboot(boolean hard)
          Reboots a running VM.
 OneResponse recover(boolean success)
          Recovers a stuck VM.
static OneResponse recover(Client client, int id, boolean success)
          Recovers a stuck VM.
 OneResponse release()
          Releases a virtual machine from hold state.
static OneResponse rename(Client client, int id, java.lang.String name)
          Renames this VM
 OneResponse rename(java.lang.String name)
          Renames this VM
 OneResponse resched()
          Sets the re-scheduling flag for the VM
 OneResponse reset()
          Deprecated. Replaced by hard reboot reboot(boolean)
static OneResponse resize(Client client, int id, java.lang.String capacityTemplate, boolean enforce)
          Resizes the VM capacity
 OneResponse resize(java.lang.String capacityTemplate, boolean enforce)
          Resizes this VM's capacity
 OneResponse restart()
          Deprecated. Replaced by boot()
 OneResponse resubmit()
          Deprecated. Replaced by delete and recreate delete(boolean)
 OneResponse resume()
          Resumes the execution of a saved VM.
 OneResponse savedisk(int diskId, java.lang.String imageName)
          Deprecated. Replaced by diskSnapshot(int,String)
 OneResponse savedisk(int diskId, java.lang.String imageName, java.lang.String imageType)
          Deprecated. Replaced by diskSnapshot(int,String,String,boolean)
 OneResponse shutdown()
          Gracefully shuts down the already deployed VM.
 OneResponse shutdown(boolean hard)
          Shuts down the already deployed VM.
static OneResponse snapshotCreate(Client client, int id, java.lang.String name)
          Creates a new VM snapshot
 OneResponse snapshotCreate(java.lang.String name)
          Creates a new VM snapshot
static OneResponse snapshotDelete(Client client, int id, int snapId)
          Deletes a VM snapshot.
 OneResponse snapshotDelete(int snapId)
          Deletes a VM snapshot
static OneResponse snapshotRevert(Client client, int id, int snapId)
          Reverts to a snapshot
 OneResponse snapshotRevert(int snapId)
          Reverts to a snapshot
 int state()
          Performs an xpath evaluation for the "state" expression.
 java.lang.String stateStr()
          Returns the VM state of the VirtualMachine (string value).
 java.lang.String status()
          Returns the short status string for the VirtualMachine.
 OneResponse stop()
          Stops the virtual machine.
 OneResponse suspend()
          Suspends the virtual machine.
 OneResponse undeploy(boolean hard)
          Undeploy a running VM, it preserve its resources and disk modifications.
 OneResponse unresched()
          Unsets the re-scheduling flag for the VM
static OneResponse update(Client client, int id, java.lang.String new_template, boolean append)
          Replaces the user template contents for the given VM.
 OneResponse update(java.lang.String new_template)
          Replaces this VM's user template contents.
 OneResponse update(java.lang.String new_template, boolean append)
          Replaces this VM's user template contents.
 
Methods inherited from class org.opennebula.client.PoolElement
chmod, chmod, chmod, getId, getName, gid, id, processInfo, uid, xpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VirtualMachine

public VirtualMachine(int id,
                      Client client)
Creates a new VM representation.

Parameters:
id - The virtual machine Id (vid).
client - XML-RPC Client.

VirtualMachine

protected VirtualMachine(org.w3c.dom.Node xmlElement,
                         Client client)
See Also:
PoolElement
Method Detail

allocate

public static OneResponse allocate(Client client,
                                   java.lang.String description)
Allocates a new VM in OpenNebula.

Parameters:
client - XML-RPC Client.
description - A string containing the template of the vm.
Returns:
If successful the message contains the associated id generated for this VM.

allocate

public static OneResponse allocate(Client client,
                                   java.lang.String description,
                                   boolean onHold)
Allocates a new VM in OpenNebula.

Parameters:
client - XML-RPC Client.
description - A string containing the template of the vm.
onHold - False to create this VM in pending state, true on hold
Returns:
If successful the message contains the associated id generated for this VM.

update

public static OneResponse update(Client client,
                                 int id,
                                 java.lang.String new_template,
                                 boolean append)
Replaces the user template contents for the given VM.

Parameters:
client - XML-RPC Client.
id - The id of the target vm.
new_template - New template contents
append - True to append new attributes instead of replace the whole template
Returns:
If an error occurs the error message contains the reason.

resize

public static OneResponse resize(Client client,
                                 int id,
                                 java.lang.String capacityTemplate,
                                 boolean enforce)
Resizes the VM capacity

Parameters:
client - XML-RPC Client.
id - The id of the target vm.
capacityTemplate - Template containing the new capacity elements CPU, VCPU, MEMORY. If one of them is not present, or its value is 0, it will not be resized
enforce - If it is set to true, the host capacity will be checked. This will only affect oneadmin requests, regular users resize requests will always be enforced
Returns:
If an error occurs the error message contains the reason.

info

public static OneResponse info(Client client,
                               int id)
Retrieves the information of the given VM.

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
Returns:
If successful the message contains the string with the information returned by OpenNebula.

chown

public static OneResponse chown(Client client,
                                int id,
                                int uid,
                                int gid)
Changes the owner/group

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
uid - The new owner user ID. Set it to -1 to leave the current one.
gid - The new group ID. Set it to -1 to leave the current one.
Returns:
If an error occurs the error message contains the reason.

chmod

public static OneResponse chmod(Client client,
                                int id,
                                int owner_u,
                                int owner_m,
                                int owner_a,
                                int group_u,
                                int group_m,
                                int group_a,
                                int other_u,
                                int other_m,
                                int other_a)
Changes the VM permissions

Parameters:
client - XML-RPC Client.
id - The VM id of the target VM.
owner_u - 1 to allow, 0 deny, -1 do not change
owner_m - 1 to allow, 0 deny, -1 do not change
owner_a - 1 to allow, 0 deny, -1 do not change
group_u - 1 to allow, 0 deny, -1 do not change
group_m - 1 to allow, 0 deny, -1 do not change
group_a - 1 to allow, 0 deny, -1 do not change
other_u - 1 to allow, 0 deny, -1 do not change
other_m - 1 to allow, 0 deny, -1 do not change
other_a - 1 to allow, 0 deny, -1 do not change
Returns:
If an error occurs the error message contains the reason.

chmod

public static OneResponse chmod(Client client,
                                int id,
                                java.lang.String octet)
Changes the permissions

Parameters:
client - XML-RPC Client.
id - The id of the target object.
octet - Permissions octed , e.g. 640
Returns:
If an error occurs the error message contains the reason.

chmod

public static OneResponse chmod(Client client,
                                int id,
                                int octet)
Changes the permissions

Parameters:
client - XML-RPC Client.
id - The id of the target object.
octet - Permissions octed , e.g. 640
Returns:
If an error occurs the error message contains the reason.

monitoring

public static OneResponse monitoring(Client client,
                                     int id)
Retrieves the monitoring information of the given VM, in XML

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
Returns:
If successful the message contains the string with the monitoring information returned by OpenNebula.

diskAttach

public static OneResponse diskAttach(Client client,
                                     int id,
                                     java.lang.String diskTemplate)
Attaches a disk to a running VM

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
diskTemplate - Template containing the new DISK definition
Returns:
If an error occurs the error message contains the reason.

diskDetach

public static OneResponse diskDetach(Client client,
                                     int id,
                                     int diskId)
Detaches a disk from a running VM

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
diskId - The DISK_ID of the disk to detach
Returns:
If an error occurs the error message contains the reason.

diskSnapshot

public static OneResponse diskSnapshot(Client client,
                                       int id,
                                       int diskId,
                                       java.lang.String imageName,
                                       java.lang.String imageType,
                                       boolean hot)
Sets the specified vm's disk to be saved in a new image.

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
diskId - ID of the disk to be saved.
imageName - Name of the new Image that will be created.
imageType - Type of the new image. Set to empty string to use the default type
hot - True to save the disk immediately, false will perform the operation when the VM shuts down
Returns:
If an error occurs the error message contains the reason.

nicAttach

public static OneResponse nicAttach(Client client,
                                    int id,
                                    java.lang.String nicTemplate)
Attaches a NIC to a running VM

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
nicTemplate - Template containing the new NIC definition
Returns:
If an error occurs the error message contains the reason.

nicDetach

public static OneResponse nicDetach(Client client,
                                    int id,
                                    int nicId)
Detaches a NIC from a running VM

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
nicId - The NIC_ID of the NIC to detach
Returns:
If an error occurs the error message contains the reason.

rename

public static OneResponse rename(Client client,
                                 int id,
                                 java.lang.String name)
Renames this VM

Parameters:
client - XML-RPC Client.
id - The VM id of the target VM.
name - New name for the VM.
Returns:
If an error occurs the error message contains the reason.

snapshotCreate

public static OneResponse snapshotCreate(Client client,
                                         int id,
                                         java.lang.String name)
Creates a new VM snapshot

Parameters:
client - XML-RPC Client.
id - The VM id of the target VM.
name - Name for the snapshot.
Returns:
If an error occurs the error message contains the reason.

snapshotRevert

public static OneResponse snapshotRevert(Client client,
                                         int id,
                                         int snapId)
Reverts to a snapshot

Parameters:
client - XML-RPC Client.
id - The VM id of the target VM.
snapId - Id of the snapshot
Returns:
If an error occurs the error message contains the reason.

snapshotDelete

public static OneResponse snapshotDelete(Client client,
                                         int id,
                                         int snapId)
Deletes a VM snapshot.

Parameters:
client - XML-RPC Client.
id - The VM id of the target VM.
snapId - Id of the snapshot
Returns:
If an error occurs the error message contains the reason.

recover

public static OneResponse recover(Client client,
                                  int id,
                                  boolean success)
Recovers a stuck VM.

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
success - recover by succeeding the missing transaction if true.
Returns:
If an error occurs the error message contains the reason.

info

public OneResponse info()
Loads the xml representation of the virtual machine. The info is also stored internally.

See Also:
info(Client, int)

deploy

public OneResponse deploy(int hostId,
                          boolean enforce)
Initiates the instance of the VM on the target host.

Parameters:
hostId - The host id (hid) of the target host where the VM will be instantiated.
enforce - If it is set to true, the host capacity will be checked, and the deployment will fail if the host is overcommited. Defaults to false
Returns:
If an error occurs the error message contains the reason.

deploy

public OneResponse deploy(int hostId)
Initiates the instance of the VM on the target host.

Parameters:
hostId - The host id (hid) of the target host where the VM will be instantiated.
Returns:
If an error occurs the error message contains the reason.

action

protected OneResponse action(java.lang.String action)
Submits an action to be performed on the virtual machine.
It is recommended to use the helper methods instead:

Parameters:
action - The action name to be performed, can be:
"shutdown", "hold", "release", "stop", "shutdown-hard", "suspend", "resume", "boot", "delete", "delete-recreate", "reboot", "resched", "unresched", "reboot-hard", "poweroff", "undeploy", "undeploy-hard"
Returns:
If an error occurs the error message contains the reason.

migrate

public OneResponse migrate(int hostId,
                           boolean live,
                           boolean enforce)
Migrates the virtual machine to the target host (hid).

Parameters:
hostId - The target host id (hid) where we want to migrate the vm.
live - If true we are indicating that we want livemigration, otherwise false.
enforce - If it is set to true, the host capacity will be checked, and the deployment will fail if the host is overcommited. Defaults to false
Returns:
If an error occurs the error message contains the reason.

migrate

public OneResponse migrate(int hostId,
                           boolean live)
Migrates the virtual machine to the target host (hid).

Parameters:
hostId - The target host id (hid) where we want to migrate the vm.
live - If true the migration is done without downtime.
Returns:
If an error occurs the error message contains the reason.

migrate

public OneResponse migrate(int hostId)
Migrates the virtual machine to the target host (hid).

Parameters:
hostId - The target host id (hid) where we want to migrate the vm.
Returns:
If an error occurs the error message contains the reason.

chown

public OneResponse chown(int uid,
                         int gid)
Changes the owner/group

Parameters:
uid - The new owner user ID. Set it to -1 to leave the current one.
gid - The new group ID. Set it to -1 to leave the current one.
Returns:
If an error occurs the error message contains the reason.

chown

public OneResponse chown(int uid)
Changes the owner

Parameters:
uid - The new owner user ID.
Returns:
If an error occurs the error message contains the reason.

chgrp

public OneResponse chgrp(int gid)
Changes the group

Parameters:
gid - The new group ID.
Returns:
If an error occurs the error message contains the reason.

chmod

public OneResponse chmod(int owner_u,
                         int owner_m,
                         int owner_a,
                         int group_u,
                         int group_m,
                         int group_a,
                         int other_u,
                         int other_m,
                         int other_a)
Changes the VM permissions

Parameters:
owner_u - 1 to allow, 0 deny, -1 do not change
owner_m - 1 to allow, 0 deny, -1 do not change
owner_a - 1 to allow, 0 deny, -1 do not change
group_u - 1 to allow, 0 deny, -1 do not change
group_m - 1 to allow, 0 deny, -1 do not change
group_a - 1 to allow, 0 deny, -1 do not change
other_u - 1 to allow, 0 deny, -1 do not change
other_m - 1 to allow, 0 deny, -1 do not change
other_a - 1 to allow, 0 deny, -1 do not change
Returns:
If an error occurs the error message contains the reason.

chmod

public OneResponse chmod(java.lang.String octet)
Changes the permissions

Parameters:
octet - Permissions octed , e.g. 640
Returns:
If an error occurs the error message contains the reason.

chmod

public OneResponse chmod(int octet)
Changes the permissions

Parameters:
octet - Permissions octed , e.g. 640
Returns:
If an error occurs the error message contains the reason.

monitoring

public OneResponse monitoring()
Retrieves the monitoring information of the given VM, in XML

Returns:
If successful the message contains the string with the monitoring information returned by OpenNebula.

diskAttach

public OneResponse diskAttach(java.lang.String diskTemplate)
Attaches a disk to a running VM

Parameters:
diskTemplate - Template containing the new DISK definition
Returns:
If an error occurs the error message contains the reason.

diskDetach

public OneResponse diskDetach(int diskId)
Detaches a disk from a running VM

Parameters:
diskId - The DISK_ID of the disk to detach
Returns:
If an error occurs the error message contains the reason.

diskSnapshot

public OneResponse diskSnapshot(int diskId,
                                java.lang.String imageName,
                                java.lang.String imageType,
                                boolean hot)
Sets the specified vm's disk to be saved in a new image.

Parameters:
diskId - ID of the disk to be saved.
imageName - Name of the new Image that will be created.
imageType - Type of the new image. Set to empty string to use the default type
hot - True to save the disk immediately, false will perform the operation when the VM shuts down
Returns:
If an error occurs the error message contains the reason.

diskSnapshot

public OneResponse diskSnapshot(int diskId,
                                java.lang.String imageName)
Sets the specified vm's disk to be saved in a new image when the VirtualMachine shuts down.

Parameters:
diskId - ID of the disk to be saved.
imageName - Name of the new Image that will be created.
Returns:
If an error occurs the error message contains the reason.

diskSnapshot

public OneResponse diskSnapshot(int diskId,
                                java.lang.String imageName,
                                boolean hot)
Sets the specified vm's disk to be saved in a new image.

Parameters:
diskId - ID of the disk to be saved.
imageName - Name of the new Image that will be created.
hot - True to save the disk immediately, false will perform the operation when the VM shuts down
Returns:
If an error occurs the error message contains the reason.

nicAttach

public OneResponse nicAttach(java.lang.String nicTemplate)
Attaches a NIC to a running VM

Parameters:
nicTemplate - Template containing the new NIC definition
Returns:
If an error occurs the error message contains the reason.

nicDetach

public OneResponse nicDetach(int nicId)
Detaches a NIC from a running VM

Parameters:
nicId - The NIC_ID of the NIC to detach
Returns:
If an error occurs the error message contains the reason.

rename

public OneResponse rename(java.lang.String name)
Renames this VM

Parameters:
name - New name for the VM.
Returns:
If an error occurs the error message contains the reason.

update

public OneResponse update(java.lang.String new_template)
Replaces this VM's user template contents.

Parameters:
new_template - New template contents
Returns:
If an error occurs the error message contains the reason.

update

public OneResponse update(java.lang.String new_template,
                          boolean append)
Replaces this VM's user template contents.

Parameters:
new_template - New template contents
append - True to append new attributes instead of replace the whole template
Returns:
If an error occurs the error message contains the reason.

resize

public OneResponse resize(java.lang.String capacityTemplate,
                          boolean enforce)
Resizes this VM's capacity

Parameters:
capacityTemplate - Template containing the new capacity elements CPU, VCPU, MEMORY. If one of them is not present, or its value is 0, it will not be resized
enforce - If it is set to true, the host capacity will be checked. This will only affect oneadmin requests, regular users resize requests will always be enforced
Returns:
If an error occurs the error message contains the reason.

snapshotCreate

public OneResponse snapshotCreate(java.lang.String name)
Creates a new VM snapshot

Parameters:
name - Name for the snapshot.
Returns:
If an error occurs the error message contains the reason.

snapshotRevert

public OneResponse snapshotRevert(int snapId)
Reverts to a snapshot

Parameters:
snapId - Id of the snapshot
Returns:
If an error occurs the error message contains the reason.

snapshotDelete

public OneResponse snapshotDelete(int snapId)
Deletes a VM snapshot

Parameters:
snapId - Id of the snapshot
Returns:
If an error occurs the error message contains the reason.

recover

public OneResponse recover(boolean success)
Recovers a stuck VM.

Parameters:
success - recover by succeeding the missing transaction if true.
Returns:
If an error occurs the error message contains the reason.

shutdown

public OneResponse shutdown()
Gracefully shuts down the already deployed VM.

Returns:
If an error occurs the error message contains the reason.

shutdown

public OneResponse shutdown(boolean hard)
Shuts down the already deployed VM.

Parameters:
hard - True to perform a hard (no acpi) shutdown, false for a graceful shutdown
Returns:
If an error occurs the error message contains the reason.

undeploy

public OneResponse undeploy(boolean hard)
Undeploy a running VM, it preserve its resources and disk modifications.

Parameters:
hard - True to perform a hard (no acpi) shutdown, false for a graceful shutdown
Returns:
If an error occurs the error message contains the reason.

poweroff

public OneResponse poweroff()
Powers off a running VM.

Returns:
If an error occurs the error message contains the reason.

poweroff

public OneResponse poweroff(boolean hard)
Powers off a running VM.

Parameters:
hard - True to perform a hard (no acpi) shutdown, false for a graceful shutdown
Returns:
If an error occurs the error message contains the reason.

reboot

public OneResponse reboot()
Reboots a running VM.

Returns:
If an error occurs the error message contains the reason.

reboot

public OneResponse reboot(boolean hard)
Reboots a running VM.

Parameters:
hard - True to perform a hard (no acpi) reboot, false for a graceful reboot
Returns:
If an error occurs the error message contains the reason.

hold

public OneResponse hold()
Sets the VM to hold state. The VM will not be scheduled until it is released.

Returns:
If an error occurs the error message contains the reason.

release

public OneResponse release()
Releases a virtual machine from hold state.

Returns:
If an error occurs the error message contains the reason.

stop

public OneResponse stop()
Stops the virtual machine. The virtual machine state is transferred back to OpenNebula for a possible reschedule.

Returns:
If an error occurs the error message contains the reason.

suspend

public OneResponse suspend()
Suspends the virtual machine. The virtual machine state is left in the cluster node for resuming.

Returns:
If an error occurs the error message contains the reason.

resume

public OneResponse resume()
Resumes the execution of a saved VM.

Returns:
If an error occurs the error message contains the reason.

delete

public OneResponse delete()
Deletes the VM from the pool and database.

Returns:
If an error occurs the error message contains the reason.

delete

public OneResponse delete(boolean recreate)
Deletes the VM from the pool and database.

Parameters:
recreate - True to recreate the VM in the pending state.
Returns:
If an error occurs the error message contains the reason.

boot

public OneResponse boot()
Forces a re-deployment of a VM in UNKNOWN or BOOT states.

Returns:
If an error occurs the error message contains the reason.

resched

public OneResponse resched()
Sets the re-scheduling flag for the VM

Returns:
If an error occurs the error message contains the reason.

unresched

public OneResponse unresched()
Unsets the re-scheduling flag for the VM

Returns:
If an error occurs the error message contains the reason.

state

public int state()
Description copied from class: PoolElement
Performs an xpath evaluation for the "state" expression.

Overrides:
state in class PoolElement
Returns:
The value of the STATE element.

stateStr

public java.lang.String stateStr()
Returns the VM state of the VirtualMachine (string value).

Returns:
The VM state of the VirtualMachine (string value).

lcmState

public int lcmState()
Returns the LCM state of the VirtualMachine (numeric value).

Returns:
The LCM state of the VirtualMachine (numeric value).

lcmStateStr

public java.lang.String lcmStateStr()
Returns the LCM state of the VirtualMachine (string value).

Returns:
The LCM state of the VirtualMachine (string value).

status

public java.lang.String status()
Returns the short status string for the VirtualMachine.

Returns:
The short status string for the VirtualMachine.

attachdisk

@Deprecated
public static OneResponse attachdisk(Client client,
                                                int id,
                                                java.lang.String diskTemplate)
Deprecated. Replaced by diskAttach(org.opennebula.client.Client, int, java.lang.String)

Attaches a disk to a running VM

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
diskTemplate - Template containing the new DISK definition
Returns:
If an error occurs the error message contains the reason.

detachdisk

@Deprecated
public static OneResponse detachdisk(Client client,
                                                int id,
                                                int diskId)
Deprecated. Replaced by diskDetach(org.opennebula.client.Client, int, int)

Detaches a disk from a running VM

Parameters:
client - XML-RPC Client.
id - The virtual machine id (vid) of the target instance.
diskId - The DISK_ID of the disk to detach
Returns:
If an error occurs the error message contains the reason.

savedisk

@Deprecated
public OneResponse savedisk(int diskId,
                                       java.lang.String imageName)
Deprecated. Replaced by diskSnapshot(int,String)


savedisk

public OneResponse savedisk(int diskId,
                            java.lang.String imageName,
                            java.lang.String imageType)
Deprecated. Replaced by diskSnapshot(int,String,String,boolean)


attachdisk

@Deprecated
public OneResponse attachdisk(java.lang.String diskTemplate)
Deprecated. Replaced by diskAttach(String)


detachdisk

@Deprecated
public OneResponse detachdisk(int diskId)
Deprecated. 


cancel

@Deprecated
public OneResponse cancel()
Deprecated. Replaced by hard shutdown shutdown(boolean)

Cancels the running VM.

Returns:
If an error occurs the error message contains the reason.

reset

@Deprecated
public OneResponse reset()
Deprecated. Replaced by hard reboot reboot(boolean)

Resets a running VM.

Returns:
If an error occurs the error message contains the reason.

finalizeVM

@Deprecated
public OneResponse finalizeVM()
Deprecated. Replaced by delete()

Deletes the VM from the pool and database.

Returns:
If an error occurs the error message contains the reason.

resubmit

@Deprecated
public OneResponse resubmit()
Deprecated. Replaced by delete and recreate delete(boolean)

Resubmits a VM to PENDING state.

Returns:
If an error occurs the error message contains the reason.

restart

@Deprecated
public OneResponse restart()
Deprecated. Replaced by boot()

Forces a re-deployment of a VM in UNKNOWN or BOOT states.

Returns:
If an error occurs the error message contains the reason.

liveMigrate

@Deprecated
public OneResponse liveMigrate(int hostId)
Deprecated. Replaced by migrate(int, boolean, boolean)

Performs a live migration of the virtual machine to the target host (hid).
It does the same as migrate(int, boolean) with live set to true.

Parameters:
hostId - The target host id (hid) where we want to migrate the vm.
Returns:
If an error occurs the error message contains the reason.

OpenNebula
Cloud API

Visit OpenNebula.org
Copyright 2002-2013 © OpenNebula Project (OpenNebula.org), C12G Labs.