public class VirtualMachine extends PoolElement
client, id, xml, xpath
Modifier | Constructor and Description |
---|---|
|
VirtualMachine(int id,
Client client)
Creates a new VM representation.
|
protected |
VirtualMachine(org.w3c.dom.Node xmlElement,
Client client) |
Modifier and Type | Method and Description |
---|---|
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.
|
OneResponse |
cancel()
Cancels the running VM.
|
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 |
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 |
reboot()
Reboots a running VM.
|
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 |
savedisk(int diskId,
java.lang.String imageName,
java.lang.String imageType)
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.
|
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
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 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 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)
client
- XML-RPC Client.id
- The VM id of the target VM.owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not changepublic static OneResponse chmod(Client client, int id, java.lang.String octet)
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640public static OneResponse chmod(Client client, int id, int octet)
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640public 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 savedisk(int diskId, java.lang.String imageName, java.lang.String imageType)
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 typepublic 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 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)
owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not changepublic OneResponse chmod(java.lang.String octet)
octet
- Permissions octed , e.g. 640public OneResponse chmod(int octet)
octet
- Permissions octed , e.g. 640public OneResponse shutdown()
public OneResponse reboot()
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()
Visit OpenNebula.org
Copyright 2002-2012 ©
OpenNebula Project Leads (OpenNebula.org).