diff --git a/share/etc/oned.conf b/share/etc/oned.conf index a83f34faa0..b6af142ac8 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -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" diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java index f28811f687..34f3280066 100644 --- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java +++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java @@ -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 // =================================