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

4.2.7 Mount an .iso disk

Using Aruba's WsEndUser SetEnqueueMountDvdIso method you can mount an ISO image to a virtual machine. This operation is performed using one of the ISO images (custom ISO) available in the FTP space associated with the account specified during authentication.
To use a custom ISO image, the image file format will be .ISO and the size will not be more than 9 GB.

Parameters
iso
Type: NewIso
NewIso class which represents the ISO image to be mounted on the virtual server.
The NewIso class contains all the useful information to perform the image mounting operation: file path (if it's a custom image), Id of the server on which to mount the image.

Let's look at the example of a method which mounts the Hyper-V_Server_R2_SP1.iso image found in the FTP area of the account on the specified server.
//IWsEndUser.SetEnqueueMountDvdIso Method (c# .NET)
private static void MountDvdIso(WsEndUserClient client, int serverId)
{
    try
    {
        //creates a new object called isoToMount, NewIso class
        NewIso isoToMount = new NewIso()
        {
            //if you want to install a client ISO you need to
            //specify the related path in the client FTP space. 
            IsoPath = @"Hyper-V_Server_R2_SP1.iso",

            //the type of image, Custom type
            IsoType = IsoTypes.Custom,

            //id of the server on which to mount the image
            ServerId = serverId
        };

        //calls the SetEnqueueMountDvdIso method, 
        //getting a WsResult object
        WsResult result = client.SetEnqueueMountDvdIso(isoToMount);

        //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.setEnqueueMountDvdIso Method (JAVA)
private static void MountDvdIso(IWsEndUser client, int serverId)
{
    try
    {
        //creates a new object called isoToMount, NewIso class
        NewIso isoToMount = new NewIso();
        
        //if you want to install a client ISO you need to
        //specify the related path in the client FTP space. 
        isoToMount.setIsoPath("Hyper-V_Server_R2_SP1.iso");
        
        //the type of image, Custom type
        isoToMount.setIsoType(IsoTypes.CUSTOM);

        //id of the server on which to mount the image
        isoToMount.setServerId(serverId);

        //calls the setEnqueueMountDvdIso method, 
        //getting a WsResult object
        WsResult result = client.setEnqueueMountDvdIso(isoToMount);

        //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);
    }
}


Using Aruba's WsEndUser SetEnqueueUnmountDvdIso method you can unmount an ISO image from a virtual machine.

Let's look at an example of a method that unmounts the image previously mounted from the specified server.
//IWsEndUser.SetEnqueueUnmountDvdIso Method (c# .NET)
private static void UnmountDvdIso(WsEndUserClient client, int serverId)
{
    try
    {
        //retrieves the information from the virtual server
        WsResultOfServerDetails serverDetails = client.GetServerDetails(serverId);

        //checks to see if there is a virtual DVD with an ISO mounted
        if (serverDetails != null && serverDetails.Value.VirtualDVDs.Count() > 0)
        {
            //calls the SetEnqueueUnmountDvdIso method, 
            //getting a WsResult object
            WsResult result = client.SetEnqueueUnmountDvdIso(serverId);

            //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.setEnqueueUnmountDvdIso Method (JAVA)
private static void UnmountDvdIso(IWsEndUser client, int serverId)
{
    try
    {
        //retrieves the information from the virtual server
        WsResultOfServerDetails serverDetails = client.getServerDetails(serverId);

        //checks to see if there is a virtual DVD with an ISO mounted
        if (serverDetails != null && !serverDetails.getValue()
                .getVirtualDVDs().getVirtualDVD().isEmpty())
        {
            //calls the setEnqueueUnmountDvdIso method, 
            //getting a WsResult object
            WsResult result = client.setEnqueueUnmountDvdIso(serverId);

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

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