cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
716
Views
0
Helpful
3
Replies

Help with UCSD Custom Tasks

scottw80
Level 1
Level 1

Hi. 

I'm currently working on a project that will be using UCSD 6.6 to orchestrate the creation and configuration of virtual machines within VMware. The development of workflows using UCSD has identified settings within VMware that are not provided by the default UCSD VM Tasks, and so I've started to look at custom tasks to provide these additional settings through the use of Cloupia scripting.

 

However, my initial investigation with custom tasks has not resulted in success and I'm struggling to find the required documentation to understand what APIs I should be using.

The documentation I have been using is the UCS Director Custom Task Getting Started Guide: (https://www.cisco.com/c/en/us/td/docs/unified_computing/ucs/ucs-director/custom-task-getting-started-guide/6-6/cisco-ucs-director-custom-task-getting-started-66/cisco-ucs-director-custom-task-getting-started-66_chapter_0101.html)

and examples at:

(https://www.cisco.com/c/en/us/td/docs/unified_computing/ucs/ucs-director/cloupia-script-cookbook/6-0/b_Cisco_UCS_Director_CloupiaScript_Cookbook_60/b_Cisco_UCS_Director_CloupiaScript_Cookbook_54_chapter_010.html#reference_3C3357A829E141F1A0EA6F565545...)

 

I've tried implementing the Disk Resize example from the second link (repeated below).

 

importPackage(java.lang);
importPackage(java.util);
importPackage(com.cloupia.model.cIM);
importPackage(com.cloupia.service.cIM.inframgr);
function resizeVmDisk(vmidstr, diskName, sizeInGB)
{
var vmid = Integer.parseInt(vmidstr);
// create the context to
var vmcontext = util.createContext("vm", null, vmidstr);
// obtain VM details
var vminfo = ctxt.getAPI().getVMwareVMInfo(vmid);
var vmname = vminfo.getName();
var nameparam = new ActionParam("vmName", vmname);
var sizeparam = new ActionParam("vmSize", sizeInGB);
var diskparam = new ActionParam("vmDiskLabel", diskName);
var paramarr = [ nameparam, sizeparam, diskparam ];
logger.addInfo("About to resize VM "+vmidstr+" name="+vmname);
var status = ctxt.getAPI().performAction(vmcontext,"diskResize","Resizing VM to
test the script",ctxt.getUserId(),paramarr);
logger.addInfo("status = "+status);
}
var vmidstr1 = ctxt.getInput("VMID");
resizeVmDisk(vmidstr1, "Hard Disk 1", "10");

 

When executing a workflow with this example, the workflow is reported as completed within UCSD, by I see no new Task/Change within VMware. What tools are available to debug this and determine where the failure occurs? In regards to documentation for the different Cloupia packages and their usage, the Javadoc pages appear empty of documentation (assuming that I am looking at the right place) : (https://developer.cisco.com/docs/ucs-dev-center-ucs-director/#!ucs-director-open-automation-javadocs).

 

Therefore I'm not sure if I am using the right classes and methods for these operations and what is available to me (e.g. in the disk resize example, "diskResize" is the action passed to the performAction method. How do I know what actions are available?). Are the com.cloupia packages the correct ones to use for VMware operations? 

 

Any input/advice/link to better documentation would be greatly appreciated.

3 Replies 3

John Weigand
Level 1
Level 1

Out of curiosity, what are you trying to do that you don't see a task for in Director? Custom tasks are one option, but the few things I couldn't do, I was able to do either by calling some powershell, generic API calls, or calling into the guest VM to do some stuff.

It's quite possible that there may be other mechanisms that I'm not aware of. Sadly I'm not a network engineer and don't have a large amount of experience with VMware.

Ultimately the intention is that these UCSD workflows will be invoked by some form of Service Incident Management System through the UCSD ServiceRequest API. As part of this, there are parameters being passed in the Service Request that require some logic within the flow (an example being a "Contention Level" that will be used to set the CPU Reservation level depending on the number of CPU Cores present and will need to be calculated). This simple logic is straight forward to execute within javascript, I just can't find decent documentation around the classes and methods I need to call to retrieve and modify WMware properties (just empty javadocs).

Apologies for the bump but I'm still struck on the approach to using Cloupia and the lack of documentation against it. Does anyone have any references that would help?

Thanks

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:

Cisco UCS X-Series Energy Efficiency Offer