Computing > 7 - Unified Storage Management > Create a Unified Storage

7.2 Create a Unified Storage

By using the Aruba WsEndUser method SetEnqueuePurchaseSharedStorage ou can puchase a network storage. The method require to specify the name of storage, the protocol, the IP if you want and the size of storage also if you specify the ISCSI protocol you must specify the IQN of your machine .

Parameters
quantity
Type: int
Size of the storage in GB

storageName
Type: string
Name of the storage

protocolType
Type: SharedStorageProtocolType
Storage type. Values are:
  • CIFS
  • ISCSI
  • NFS

IQNValues
Type: string[]
Array of Strings with the values of IQN to assign the storage (for ISCSI storage type)


public static string SetEnqueuePurchaseSharedStorage(WsEndUserClient client,
    int quantity, String storageName, 
    SharedStorageProtocolType protocolType, String[] IQNValues= null)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // create the object EnqueuePurchaseSharedStorageRequest  for the request 
        // with data to process
        EnqueuePurchaseSharedStorageRequest request = 
            new EnqueuePurchaseSharedStorageRequest();

        request.Quantity = quantity;
        request.SharedStorageName = storageName;
        request.SharedStorageProtocolType = protocolType;

        if (protocolType == SharedStorageProtocolType.ISCSI)
        {
            // IQN values are mandatory ...
            if (IQNValues == null || IQNValues.Length==0)
            {
                throw new ApplicationException(
                    @"For ISCSI SharedStorageProtocolType IQNs values 
                      are mandatory.");
            }

            // create the IQNvalues to assign to the storage
            request.SharedStorageIQNs = new SharedStorageIQN[IQNValues.Length];

            for (int i=0; i< IQNValues.Length; i++)
            {
                SharedStorageIQN iqn = new SharedStorageIQN();
                iqn.Value =  IQNValues[i];
                iqn.Status = SharedStorageStatus.Active;
                request.SharedStorageIQNs[i] = iqn; 
            }
        }

        // call method SetEnqueuePurchaseSharedStorage, 
        // obtaining a WsResult item               
        WsResult result = client.SetEnqueuePurchaseSharedStorage(request);
                
        //if the call is Success print history values
        if (result.Success)
        {
            // get Value returned from server
            stringBuilder.Append(" Operation successfully. Result Code : ");
            stringBuilder.Append(result.ResultCode);
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
// IWsEndUser.SetEnqueuePurchaseSharedStorage  Method (JAVA)
ppublic static String SetEnqueuePurchaseSharedStorage(IWsEndUser client,
    int quantity, String storageName, SharedStorageProtocolType protocolType,
    String[] IQNValues)
{
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
	    .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
	    .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
	// create the object EnqueuePurchaseSharedStorageRequest  for the request 
	// with data to process
	EnqueuePurchaseSharedStorageRequest request = 
            new EnqueuePurchaseSharedStorageRequest();
	request.setQuantity(quantity);
	request.setSharedStorageName(storageName);
	request.setSharedStorageProtocolType(protocolType);

        if (protocolType == SharedStorageProtocolType.ISCSI)
        {
            // IQN values are mandatory ...
            if (IQNValues == null || IQNValues.length==0)
            {
                throw new Exception(
                    "For ISCSI SharedStorageProtocolType IQNs values \n" +
"                      are mandatory ");
            }

            // create the IQNvalues to assign to the storage
            ArrayOfSharedStorageIQN arrayOfSharedStorageIQN = new ArrayOfSharedStorageIQN();
           
            for (int i=0; i< IQNValues.length; i++)
            {
                SharedStorageIQN iqn = new SharedStorageIQN();
                iqn.setValue(IQNValues[i]);
                iqn.setStatus(SharedStorageStatus.ACTIVE);
                arrayOfSharedStorageIQN.getSharedStorageIQN().add(iqn);
            }
            request.setSharedStorageIQNs(arrayOfSharedStorageIQN);
        }
                
	// call method SetEnqueuePurchaseSharedStorage, 
	// obtaining a WsResult item               
	WsResult result = client.setEnqueuePurchaseSharedStorage(request);
	
	//if the call is Success print history values
	if (result.isSuccess())
	{
	    // get Value returned from server
	    stringBuilder.append(" Operation successfully. Result Code : ");
	    stringBuilder.append(result.getResultCode());
	}
	else
	{
	    throw new Exception(result.getResultMessage());
	}
    }
    catch (Exception ex)
    {
    //show error
    System.out.println(ex);
    }

    return stringBuilder.toString();
}
Version
API: v2.8 URL:https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl
See also