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

4.2.5 Importing a virtual disk

Using Aruba's WsEndUser SetEnqueueVirtualDiskManage method you can queue a virtual disk management operation (Job).
By extending the CustomVirtualDiskPath parameter of the VirtualDiskUpdate object we can specify the virtual disk path within the FTP space.

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.

Let's look at an example of a method that adds a secondary virtual disk imported from the FTP space.
//IWsEndUser.SetEnqueueVirtualDiskManage Method (c# .NET)
private static void ImportVirtualDisk(WsEndUserClient client, int serverId)
{
    try
    {
        //creates a new object called diskToImport, VirtualDiskUpdate class
        VirtualDiskUpdate diskToImport = new VirtualDiskUpdate()
        {
            VirtualDiskUpdateType = VirtualDiskOperationTypes.Create,
            VirtualDiskType = VirtualDiskTypes.AdditionalVirtualDisk2,
            CustomVirtualDiskPath = @"custom.iso"
        };

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

        //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 ImportVirtualDisk(IWsEndUser client, int serverId)
{
    try
    {
        //creates a new object called diskToImport, VirtualDiskUpdate class
        VirtualDiskUpdate diskToImport = new VirtualDiskUpdate();
        diskToImport.setVirtualDiskUpdateType(VirtualDiskOperationTypes.CREATE);
        diskToImport.setVirtualDiskType(VirtualDiskTypes.ADDITIONAL_VIRTUAL_DISK_2);
        diskToImport.setCustomVirtualDiskPath("custom.iso");

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

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