UCSD Create Cluster Storage Policy

Version 2
    Task NameUCSD Remedy Integration
    Description
    1. UCSD Remedy Integration
    Prerequisites
    1. Tested on 5.2.0.0.A
    CategoryWorkflow
    ComponentsvSphere 5.x
    User Inputs

    Instructions for Regular Workflow Use:

    1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
    2. Unzip the file on your computer. Should end up with a .WFD file.
    3. Log in to UCS Director as a user that has "system-admin" privileges.
    4. Navigate to "Policies-->Orchestration" and click on "Import".
    5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
    6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
    7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
    8. Click "Submit".
    9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

     

    A thank you goes out to Niraj Kumar.

     

     

    Workflow execution:

     

    Unknown.png

     

     

    The SR log run:

     

    Unknown.jpeg

     

     

    The outcome is a new storage policy:

     

    Unknown-1.png

     

    The workflows and custom task :

     

    Screen Shot 2015-07-23 at 10.20.34 AM.png

     

    The code:

     

    importPackage(java.lang);

    importPackage(java.util);

    importPackage(com.cloupia.model.cIM);

    importPackage(com.cloupia.service.cIM.inframgr);

    importPackage(com.cloupia.service.cIM.inframgr.profiles);

    importPackage(com.cloupia.lib.cIaaS.vmware);

     

     

    var storPolicyId;

     

     

    var vdcProfile = input.vDCProfile;

    var storPolicyName = input.StorPolicyName;

    var datastoreClusterIdentity = input.DatastoreCluster;

    var datastoreClusterArray =[];

    datastoreClusterArray = datastoreClusterIdentity.split("@");

    var datastoreCluster=[];

    datastoreCluster[0] = datastoreClusterArray[2];

    var scopeType=input.datastoreClusterScope;

     

     

    var oldVDC = VDCUtil.getVDC(vdcProfile);

     

     

    function createStorPolicy(oldVDC,storPolicyName, datastoreCluster)

    {

      var policy;

           var policy = InfraPersistenceUtil.getPrivateCloudStoragePolicy(storPolicyName);

        if (policy != null)

           {

                   ctxt.setFailed("Storage policy with name "+storPolicyName+" already exists");

                   ctxt.exit();

           }

        var profile = InfraPersistenceUtil.getPrivateCloudStoragePolicy(oldVDC.getStoragePolicy());

        policy = new PrivateCloudStoragePolicy();

        policy.setPolicyName(storPolicyName);

           policy.setPolicyDescription(storPolicyName+" created by SR "+ctxt.getSrId());

           policy.setCloudName(oldVDC.getCloudName());

     

      var result = new DRAPScope();

            result.setEnabled(true);

            result.setInclude(true);

            result.setScopeContextName(DRAPFormUtil.SCOPE_CONTEXT_NAME_DATASTORE_CLUSTERS);

            result.setScopeContextValue(datastoreCluster);

     

     

            var list = new ArrayList();

            list.add(result);

      policy.setScopeType(scopeType);

      policy.setDatastoreCluster(datastoreCluster);

      policy.setScopeList(list);

      policy.setLocalStorage(profile.isLocalStorage());

      policy.setNfsStorage(profile.isNfsStorage());

      policy.setISCSIStorage(profile.isISCSIStorage());

      policy.setRules(profile.getRules());

     

      if(profile.isOverrideTemplateProperties()){

      policy.setOverrideTemplateProperties(profile.isOverrideTemplateProperties());

      policy.setDoThinProvisioning(profile.isDoThinProvisioning());

     

      if(profile.isManualDiskSize()){

      policy.setManualDiskSize(profile.isManualDiskSize());

      policy.setCustomDiskSizeGB(profile.getCustomDiskSizeGB());

      }

      }

     

      if(profile.isAllowResizing()){

      policy.setAllowResizing(profile.isAllowResizing());

      policy.setResizeAllowedDiskGB(profile.getResizeAllowedDiskGB());

      }

      policy.setAllowDataStoreSelect(profile.isAllowDataStoreSelect());

     

           InfraPersistenceUtil.persistPrivateCloudStoragePolicy(policy);

     

      storPolicyId = policy.getPolicyId();

           return policy;

    }

    createStorPolicy(oldVDC,storPolicyName,datastoreCluster);

    logger.addInfo("storage policy created successfully");