cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1254
Views
0
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameEnable VMRC Console via workflow
DescriptionEnable VMRC Console via workflow
Prerequisites
  1. Tested on 5.3
CategoryWorkflow tasks
ComponentsEnable VMRC Console via workflow
  1. Log in to UCS Director as a user that has "system-admin" privileges.
  2. Navigate to "Policies-->Orchestration" and click on "Import".
  3. Click "Browse" and navigate to the location on your computer where the .wfdx file resides. Choose the .wfdx file and click "Open".
  4. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
  5. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
  6. Click "Submit".
  7. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow.

Thank you goes out to Abhilash Pujari.

The workflow:

Screen Shot 2015-04-30 at 6.16.10 AM.png

Unknown.png

The workflow input of VM selection:

Screen Shot 2015-04-30 at 6.13.52 AM.png

Screen Shot 2015-04-29 at 7.18.39 AM.png

The custom task script:

importPackage(java.lang);

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

var vms = input.vmId;

var vmIds = vms.split(",");

var action = input.action;

try{

  for(var i=0; i<vmIds.length; i++){

  performAction(parseInt(vmIds[i]), action);

  }

}catch(e){

  logger.addError("Error occured"+e);

  ctxt.setFailed("Task failed to retrieve vm info.");

  ctxt.exit();

}

function performAction(vmId, action){

  var result = false;

  logger.addInfo("Getting Info. for VM : "+vmId);

  var vmSummary = ctxt.getAPI().getVMwareVMInfo(vmId);

  if(vmSummary != null){

  if(action.equalsIgnoreCase("Enable")){

  if(vmSummary.isVmrcEnabled()){

  logger.addWarning("VMRC Console Access already enabled for this VM");

  return;

  }else{

  vmSummary.setVmrcEnabled(true);

  result = InfraPersistenceUtil.modifyVMWareVMSummary(vmSummary);

  if(result)

  logger.addInfo("VMRC Console Access Enabled successfully.");

  else

  logger.addWarning("failed to enable VMRC Console Access.");

  }

  }else{

  if(! vmSummary.isVmrcEnabled()){

  logger.addWarning("VMRC Console Access already disabled for this VM");

  return;

  }else{

  vmSummary.setVmrcEnabled(false);

  result = InfraPersistenceUtil.modifyVMWareVMSummary(vmSummary);

  if(result)

  logger.addInfo("VMRC Console Access Disabled successfully.");

  else

  logger.addWarning("failed to disable VMRC Console Access.");

  }

  }

  }else{

  logger.addWarning("VM not found :"+ vmSummary.getName());

  }

}

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