1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-25 02:50:08 +03:00

Merge branch 'feature-1223' of git.opennebula.org:one into feature-1223

This commit is contained in:
Tino Vazquez 2012-06-19 12:55:53 +02:00
commit 09ffdad2bf
2 changed files with 52 additions and 1 deletions
share/etc
src/oca/java/src/org/opennebula/client/vm

@ -440,7 +440,6 @@ SESSION_EXPIRATION_TIME = 900
#*******************************************************************************
VM_RESTRICTED_ATTR = "CONTEXT/FILES"
VM_RESTRICTED_ATTR = "DISK/SOURCE"
VM_RESTRICTED_ATTR = "NIC/MAC"
VM_RESTRICTED_ATTR = "NIC/VLAN_ID"
VM_RESTRICTED_ATTR = "RANK"

@ -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
// =================================