Task Name | Testing for NetApp Aggregate to come on line |
Description | |
Prerequisites | Minimum UCSD version: 5.4.0.0 |
Category | Custom task |
Components |
|
User Inputs | |
User Output | |
Instructions for Regular Workflow Use:
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- 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…
- Aggregate Identity - can be mapped from aggregate create task in UCSD
- Status Check Interval (min) - takes an integer value. This is how many minutes you want between status checks.
- 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:
Input to the workflow:
Input to the custom task:
Import of zip file:
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);
}