mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
Feature #1223: Add attach & detach methods to Java OCA
This commit is contained in:
parent
ce39dc516c
commit
04e1dd9d0c
@ -37,6 +37,8 @@ public class VirtualMachine extends PoolElement{
|
||||
private static final String CHOWN = METHOD_PREFIX + "chown";
|
||||
private static final String CHMOD = METHOD_PREFIX + "chmod";
|
||||
private static final String MONITORING = METHOD_PREFIX + "monitoring";
|
||||
private static final String ATTACH = METHOD_PREFIX + "attach";
|
||||
private static final String DETACH = METHOD_PREFIX + "detach";
|
||||
|
||||
private static final String[] VM_STATES =
|
||||
{
|
||||
@ -232,6 +234,34 @@ public class VirtualMachine extends PoolElement{
|
||||
return client.call(MONITORING, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a disk to a running VM
|
||||
*
|
||||
* @param client XML-RPC Client.
|
||||
* @param id The virtual machine id (vid) of the target instance.
|
||||
* @param diskTemplate Template containing the new DISK definition
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public static OneResponse attachdisk(Client client, int id,
|
||||
String diskTemplate)
|
||||
{
|
||||
return client.call(ATTACH, id, diskTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detaches a disk to a running VM
|
||||
*
|
||||
* @param client XML-RPC Client.
|
||||
* @param id The virtual machine id (vid) of the target instance.
|
||||
* @param diskId The DISK_ID of the disk to detach
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public static OneResponse detachdisk(Client client, int id,
|
||||
int diskId)
|
||||
{
|
||||
return client.call(DETACH, id, diskId);
|
||||
}
|
||||
|
||||
// =================================
|
||||
// Instanced object XML-RPC methods
|
||||
// =================================
|
||||
@ -422,6 +452,28 @@ public class VirtualMachine extends PoolElement{
|
||||
return monitoring(client, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches a disk to a running VM
|
||||
*
|
||||
* @param diskTemplate Template containing the new DISK definition
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse attachdisk(String diskTemplate)
|
||||
{
|
||||
return attachdisk(client, id, diskTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detaches a disk to a running VM
|
||||
*
|
||||
* @param diskId The DISK_ID of the disk to detach
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse detachdisk(int diskId)
|
||||
{
|
||||
return detachdisk(client, id, diskId);
|
||||
}
|
||||
|
||||
// =================================
|
||||
// Helpers
|
||||
// =================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user