|
OpenNebula Cloud API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennebula.client.PoolElement
org.opennebula.client.vm.VirtualMachine
public class VirtualMachine
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 |
allocateFromTemplate(Client client,
int templateId)
Allocates a new VM in OpenNebula from a registered Template. |
static OneResponse |
allocateFromTemplate(Client client,
int templateId,
java.lang.String newName)
Allocates a new VM in OpenNebula from a registered Template. |
static OneResponse |
allocateFromTemplate(Client client,
Template template)
Allocates a new VM in OpenNebula from a registered Template. |
OneResponse |
cancel()
Cancels the running VM. |
OneResponse |
chgrp(int gid)
Changes the group |
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 |
deploy(int hostId)
Initiates the instance of the VM on the target host. |
OneResponse |
finalizeVM()
Deletes the VM from the pool and database. |
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)
Performs a live migration of the virtual machine to the target host (hid). |
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 |
release()
Releases a virtual machine from hold state. |
OneResponse |
restart()
Forces a re-deployment of a VM in UNKNOWN or BOOT state. |
OneResponse |
resubmit()
Resubmits a VM to PENDING state. |
OneResponse |
resume()
Resumes the execution of a saved VM. |
OneResponse |
savedisk(int diskId,
java.lang.String imageName)
Sets the specified vm's disk to be saved in a new image when the VirtualMachine shutdowns. |
OneResponse |
shutdown()
Shuts down the already deployed VM. |
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. |
Methods inherited from class org.opennebula.client.PoolElement |
---|
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 |
---|
public VirtualMachine(int id, Client client)
id
- The virtual machine Id (vid).client
- XML-RPC Client.protected VirtualMachine(org.w3c.dom.Node xmlElement, Client client)
PoolElement
Method Detail |
---|
public static OneResponse allocate(Client client, java.lang.String description)
client
- XML-RPC Client.description
- A string containing the template of the vm.
public static OneResponse allocateFromTemplate(Client client, int templateId, java.lang.String newName)
client
- XML-RPC Client.templateId
- The source Template's IDnewName
- Name for the new VM, replaces the Template's one.
Can be null.
public static OneResponse allocateFromTemplate(Client client, int templateId)
client
- XML-RPC Client.templateId
- The source Template's ID
public static OneResponse allocateFromTemplate(Client client, Template template)
client
- XML-RPC Client.template
- The source Template.
public static OneResponse info(Client client, int id)
client
- XML-RPC Client.id
- The virtual machine id (vid) of the target instance.
public static OneResponse chown(Client client, int id, int uid, int gid)
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.
public OneResponse info()
info(Client, int)
public OneResponse deploy(int hostId)
hostId
- The host id (hid) of the target host where
the VM will be instantiated.
protected OneResponse action(java.lang.String action)
action
- The action name to be performed, can be:public OneResponse migrate(int hostId, boolean live)
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.
public OneResponse savedisk(int diskId, java.lang.String imageName)
diskId
- ID of the disk to be saved.imageName
- Name of the new Image that will be created.
public OneResponse chown(int uid, int gid)
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.
public OneResponse chown(int uid)
uid
- The new owner user ID.
public OneResponse chgrp(int gid)
gid
- The new group ID.
public OneResponse shutdown()
public OneResponse cancel()
public OneResponse hold()
public OneResponse release()
public OneResponse stop()
public OneResponse suspend()
public OneResponse resume()
public OneResponse finalizeVM()
public OneResponse restart()
public OneResponse resubmit()
public OneResponse migrate(int hostId)
migrate(int, boolean)
with live set to false.
hostId
- The target host id (hid) where we want to migrate
the vm.
public OneResponse liveMigrate(int hostId)
migrate(int, boolean)
with live set to true.
hostId
- The target host id (hid) where we want to migrate
the vm.
public int state()
PoolElement
state
in class PoolElement
public java.lang.String stateStr()
public int lcmState()
public java.lang.String lcmStateStr()
public java.lang.String status()
|
OpenNebula Cloud API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |