cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3418
Views
0
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameTesting for NetApp Aggregate to come on line
Description

Prerequisites

Minimum UCSD version: 5.4.0.0

CategoryCustom task
Components
User Inputs

User Output

Instructions for Regular Workflow Use:

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: Michael Zimmerman

Write up:

Attached is a workflow that contains a single custom task called “Wait For Aggr Online”. This task takes three inputs…

  1. Aggregate Identity - can be mapped from aggregate create task in UCSD
  2. Status Check Interval (min) - takes an integer value. This is how many minutes you want between status checks.
  3. Timeout (min) - takes an integer value. This is how many total minutes you want the task to keep trying before it times out and fails the task.

Except for the timeout, this task will continue to poll at the “status check interval” and will return the status of the aggregate internally. The task will not complete successfully until the aggregate in question is “online”.

FYI, this was written in UCSD 5.4.0.0 and tested against CDOT 8.2P4. There is potential that there could be a slight difference in the API call and/or response for CDOT 8.3, it looks like it’s ok just looking at the API, but the only way to know for sure is to use it in your environment with CDOT 8.3.

The Workflow:

Screen Shot 2016-02-08 at 10.00.57 AM.png

Input to the workflow:

Screen Shot 2016-02-08 at 10.02.11 AM.png

Input to the custom task:

Screen Shot 2016-02-08 at 10.02.41 AM.png

Import of zip file:

Screen Shot 2016-02-08 at 10.00.18 AM.png

The Code:

importPackage(java.util);

importPackage(java.lang);

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

importPackage(com.cloupia.lib.cIaaS.netapp); //NetAppSession

importPackage(Packages.netapp.manage); //NaElement

//--------------PRE-BODY-----------------

//INPUTS

var aggr_identity = input.Aggregate; //Aggregate Identity

var wait_interval = input.Wait_Interval; //In Minutes

var timeout = parseInt(input.Timeout); //In Minutes

logger.addInfo("Aggregate Identity: "+aggr_identity);

var account_name = aggr_identity.split("@")[1];

var aggr_name = aggr_identity.split("@")[3];

//CREATE XML ARGLIST

argList = new ArrayList();

unresolvedList = new ArrayList();

x1 = new NaElement("query");

x2 = new NaElement("aggr-attributes");

x3 = new NaElement("aggregate-name", aggr_name);

x2.addChildElem(x3);

x1.addChildElem(x2);

argList.add(new ApiArgument("<xmlobject>", x1));

//-----------BODY---------------

var aggr_status = null;

var counter = 0;

while (aggr_status != "online") {

  aggr_status = getAggrStatus(argList);

  logger.addInfo("Aggregate status equals: "+aggr_status);

  if (aggr_status != "online") {

  if (counter >= timeout) {

  ctxt.setFailed("Aggregate not yet online and timeout limit of "+timeout+" minutes has been reached.");

  ctxt.exit();

  }

  logger.addInfo("Aggregate not online. Sleeping for "+wait_interval+" minute(s) before next status check.");

  sleep();

  counter += parseInt(wait_interval);

  }

}

//----------FUNCTIONS------------

function getAggrStatus (argList) {

  //GET CLUSTER SESSION

  account = InfrastructureDataUtil.getAccount(account_name);

  session = new NetAppSession(account);

  //MAKE API CALL

  xml_out = session.invokeAPIAndGetNaElement("aggr-get-iter", argList);

  //CLOSE CLUSTER SESSION

  session.close();

  //PARSE OUTPUT

  aggr_attrib_list = xml_out.getChildByName("attributes-list").getChildren();

  aggr_raid_attrib = aggr_attrib_list[0].getChildByName("aggr-raid-attributes");

  agg_status = aggr_raid_attrib.getChildContent("state");

  //RETURN OUTPUT

  return agg_status;

}

function sleep() {

  var milliseconds = wait_interval*60000;

  Thread.sleep(milliseconds);

}

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links