Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 

4.1.03 Adding a virtual disk

Using Aruba's WsEndUser SetEnqueueVirtualDiskManage method you can queue a virtual disk management operation (Job).

Parameters
serverId
Type: int
System.Int32 type value which represents the unique identifier of the virtual server on which to perform the virtual disk management operation.
disk
Type: VirtualDiskUpdate
VirtualDiskUpdate class object represents the virtual disk on which to perform the management operation. The VirtualDiskUpdate class contains all the useful information to complete the requested operation, depending on the type of operation task to be performed.

The virtual disk management operation can only be completed if the virtual server is not stopped, archived or deleting. Once the operation is queued you will not be able to queue other operations until the first one is complete.
There are also additional conditions for which a Virtual Disk management operation cannot be carried out:

Operation Condition
Create There is already a virtual disk of the same type (e.g. , there is already a primary virtual disk)

Let's look at an example of a method that adds a virtual disk subsequent to the primary one

//IWsEndUser.SetEnqueueVirtualDiskManage Method (c# .NET)
private static void CreateVirtualDisk(WsEndUserClient client, int serverId)
{
    try
    {
        //creates a new object called diskToCreate, VirtualDiskUpdate class
        VirtualDiskUpdate diskToCreate = new VirtualDiskUpdate()
        {
            VirtualDiskUpdateType = VirtualDiskOperationTypes.Create,
            VirtualDiskType = VirtualDiskTypes.AdditionalVirtualDisk1,
        };

        //calls the SetEnqueueVirtualDiskManage method,
        //getting a WsResult object
        WsResult result = client.SetEnqueueVirtualDiskManage(serverId, diskToCreate);

        //if the call fails; it relaunches the error indicating the message
        if (!result.Success)
            throw new ApplicationException(result.ResultMessage);
    }
    catch (Exception ex)
    {
        //relaunches the generic error
        throw new ApplicationException(ex.Message);
    }
}
//IWsEndUser.setEnqueueVirtualDiskManage Method (JAVA)
private static void CreateVirtualDisk(IWsEndUser client, int serverId)
{
    try
    {
        //creates a new object called diskToCreate, VirtualDiskUpdate class
        VirtualDiskUpdate diskToCreate = new VirtualDiskUpdate();
        diskToCreate.setVirtualDiskUpdateType(VirtualDiskOperationTypes.CREATE);
        diskToCreate.setVirtualDiskType(VirtualDiskTypes.ADDITIONAL_VIRTUAL_DISK_1);
        
        //calls the setEnqueueVirtualDiskManage method,
        //getting a WsResult object
        WsResult result = client.setEnqueueVirtualDiskManage(serverId, diskToCreate);

        //if the call fails; it relaunches the error indicating the message
        if (!result.isSuccess())
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //prints the error
        System.out.println(ex);
    }
}

Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl
See also

API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl

Bookmark and Share