cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5631
Views
7
Helpful
14
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameExample on converting VM Name TO Vm ID
Description

Prerequisites

Tested on 5.5

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.

The Workflow:

Screen Shot 2016-08-15 at 1.53.39 PM.png

Input:

Screen Shot 2016-08-15 at 1.53.47 PM.png

Workflow Run:

Screen Shot 2016-08-15 at 1.53.29 PM.png

When the VM Name is not found:

Screen Shot 2016-08-15 at 2.16.42 PM.png

Comments
yshtoots
Cisco Employee
Cisco Employee

Is there a custom task to do the opposite VMID 2 VMNAME like with the VDC custom tasks we have?

I need to use the VMName inside a VIX task (the workflow has only loop and vix) and ${VM_NAME} macro doesn't work unless i use VM Context but then again i need to use a loop task as well so i'll get the same ${VMname} value every iteration run if i use a VM Context WF.

Orf Gelbrich
Cisco Employee
Cisco Employee

take a look inside the custom task.  I am looking at a certain report (screen) and a column.  you have to just swap the algorithm to a different column.

Orf Gelbrich
Cisco Employee
Cisco Employee

just looked inside the task...

// Filter 1

report = report.filterRowsByColumn("VM Name", vmname, false);

var i=0;

var numRowsFound = report.rowCount();

var pgn = report.getColumnValue(i, "VM-ID");

I am looking for column "VM NAME" vs you want to look for "VM-ID"  and then get the ColumnValue of "VM Name"

clone the task and change input vars / out put

danielkeisling
Community Member

I cannot import this into UCSD 6.0.1.0.  I get a "Workflow Import Thread Exception" on the last screen of the import page.  Here's what's in the log:

2017-02-20 20:34:02,113 [ORR-InfraMgr:A4CB8EAB83] INFO  run(OperationRequestReceiver.java:38) - Received operational request, added to queue.

2017-02-20 20:34:02,113 [ORP-1-9] INFO  run(OperationRequestProcessor.java:79) - Executing request... requestId=2728; opName=doFormSubmit

2017-02-20 20:34:02,113 [ORP-1-9] INFO  doFormSubmit(APIProvider.java:1297) - FORM SUBMIT CustomAction.mimp.form.add

2017-02-20 20:34:02,114 [Thread-4498] ERROR run(WFDXImportConfirmationPage.java:367) - java.lang.NullPointerException

2017-02-20 20:34:08,070 [ORP-1-9] INFO  setEmbeddedLOVs(Page.java:752) - set embedded lov 31 for ExistingFolder

2017-02-20 20:34:08,070 [ORP-1-9] INFO  invoke(ServiceBinder.java:201) - Executing method getAllProductAccess; operationTimeout=90000

2017-02-20 20:34:08,080 [ORP-1-9] INFO  invoke(ServiceBinder.java:213) - Returning result. returnType=class [Lcom.cloupia.model.cID.cIdAccess.ProductAccess;

2017-02-20 20:34:08,084 [ORP-1-9] INFO  sendNotificationEmail(EmailPolicyNotificationEmailSender.java:49) - Send email option is disabled : false

2017-02-20 20:34:08,085 [ORP-1-9] INFO  run(OperationRequestProcessor.java:140) - Sending response... requestId=2728

Orf Gelbrich
Cisco Employee
Cisco Employee

I just downloaded it and unzipped it and imported it and ran it. Did you unzip it?

danielkeisling
Community Member

D'oh...I don't know what I was thinking.  Yeah, that was it.  It imports fine now.

Orf Gelbrich
Cisco Employee
Cisco Employee

Good... are you interested in participating in the UCSD Glacier Beta Program?  If so send me your e-mail to ogelbric@cisco.com  Starts March 8th.  I am testing alpha looks really cool.

Orf Gelbrich
Cisco Employee
Cisco Employee

Never mind I tracked you down - e-mail coming shortly

J Dhollander
Level 1
Level 1

Hi, Quick question, when I use the workflow it works like a charm. However I have to use it as a step in a different workflow (creating server flow). So I made it a compound task and call it in the main workflow where i fill the VMName input with a output of an earlier step. But when I do it this way it always return -1 -> can't find the vm Below are the different output. First is when I run the original, second one is the child request 

J Dhollander
Level 1
Level 1

1)

 

Feb 20, 2019 09:31:12 CET Trigger context executeWorkFlowStep called 

Feb 20, 2019 09:31:12 CET Executing custom action VMName_2_VMID (custom_vmName2vmID)

Feb 20, 2019 09:31:12 CET Executing custom action VMName_2_VMID (custom_vmName2vmID)

Feb 20, 2019 09:31:12 CET Executing custom script for vmName2vmID

Feb 20, 2019 09:31:12 CET VM Name Input : V01W0666

Feb 20, 2019 09:31:13 CET reportName : TABULAR_REPORT_VMS_PAGINATED_CONFIG_REPORT

Feb 20, 2019 09:31:13 CET report : com.cloupia.lib.util.managedreports.TableView@1ba27975

Feb 20, 2019 09:31:13 CET Greater then Zero...............: 

Feb 20, 2019 09:31:13 CET Greater then Zero...............: 

Feb 20, 2019 09:31:13 CET Number of Rows found...............: 1

Feb 20, 2019 09:31:13 CET Processing output: VMID

Feb 20, 2019 09:31:13 CET Task #2 (VMName_2_VMID (custom_vmName2vmID)) completed successfully in 0 seconds

Feb 20, 2019 09:31:13 CET Input/Output values for Task #2 (VMName_2_VMID (custom_vmName2vmID)):

Feb 20, 2019 09:31:13 CET  [Mapped Input: VMname = V01W0666]

Feb 20, 2019 09:31:13 CET  [Output: VMID = 1945]

2)

---- Feb 20, 2019 09:02:17 CET Trigger context executeWorkFlowStep called 

---- Feb 20, 2019 09:02:17 CET Executing custom action VMName_2_VMID (custom_vmName2vmID)

---- Feb 20, 2019 09:02:17 CET Executing custom action VMName_2_VMID (custom_vmName2vmID)

---- Feb 20, 2019 09:02:17 CET Executing custom script for vmName2vmID

---- Feb 20, 2019 09:02:17 CET VM Name Input : V01W0666

---- Feb 20, 2019 09:02:19 CET reportName : TABULAR_REPORT_VMS_PAGINATED_CONFIG_REPORT

---- Feb 20, 2019 09:02:19 CET report : com.cloupia.lib.util.managedreports.TableView@5ccf8ef9

---- Feb 20, 2019 09:02:19 CET Greater then Zero...............: 

---- Feb 20, 2019 09:02:19 CET Zero or Less...............: 

---- Feb 20, 2019 09:02:19 CET Number of Rows found...............: 0

---- Feb 20, 2019 09:02:19 CET Processing output: VMID

---- Feb 20, 2019 09:02:19 CET Task #2 (VMName_2_VMID (custom_vmName2vmID)) completed successfully in 2 seconds

---- Feb 20, 2019 09:02:19 CET Input/Output values for Task #2 (VMName_2_VMID (custom_vmName2vmID)):

---- Feb 20, 2019 09:02:19 CET  [Mapped Input: VMname = V01W0666]

---- Feb 20, 2019 09:02:19 CET  [Output: VMID = -1] 

 

Orf Gelbrich
Cisco Employee
Cisco Employee

Whow - something must have gone astray - I had 7 messages in my in box this morning... 

 

Ok I am testing now  

    Regular catalog with post provisioning attached which will send me an e-mail

        Compound task is enabled and VM context

   That workflow calls a compound task with also VM context enabled.  

    Will see how far down the chain the VM context is passed. 

 

my email contains

 

This is post provisioning 1

SR-ID: ${SR_ID}

VM_NAME : ${VM_NAME}

VM_ID : ${VM_ID}

VM_IPADDRESS: ${VM_IPADDRESS}

SUBMITTER_EMAIL: ${SUBMITTER_EMAIL}

 

stay tuned

 

 

Orf Gelbrich
Cisco Employee
Cisco Employee

I tested this and the VM context gets transferred 2 levels down into the compound tasks..

 

Screen Shot 2019-02-20 at 7.46.50 AM.pngScreen Shot 2019-02-20 at 7.53.40 AM.pngScreen Shot 2019-02-20 at 7.53.54 AM.pngScreen Shot 2019-02-20 at 7.54.08 AM.pngScreen Shot 2019-02-20 at 7.54.26 AM.pngScreen Shot 2019-02-20 at 7.54.51 AM.pngScreen Shot 2019-02-20 at 7.55.17 AM.pngScreen Shot 2019-02-20 at 7.55.29 AM.pngScreen Shot 2019-02-20 at 7.55.39 AM.pngScreen Shot 2019-02-20 at 7.55.46 AM.png

J Dhollander
Level 1
Level 1
HI,

Could it be because in the beginning of the flow (main flow) the vm doesnt exist and flow uses the vm inventory in that state?
Maybe thats why?
However I use a wait duration command which waits 1 hour before trying to convert the vmname in the ID, our vmware inventory sync happens every 20min.

So

* Create new vm
* Wait 1 hour (so everything is synced for sure)
* Vmname2Vmid

Maybe this is the issue?
Orf Gelbrich
Cisco Employee
Cisco Employee

Not sure I follow - I used a standard catalog and have a post provisioning attached and it know that VMID.  Not sur ehow you can have a workflow creating a VM and the VM does not exists.  

 

There is a task to run inventory on vCenter and or VM (By VMid).  

 

There is also this task to run inventory on any system task. 

https://community.cisco.com/t5/ucs-director-documents/ucsd-ucs-central-inventory-refresh-any-system-task-inventory/ta-p/3610149

 

if you send me an e-mail we coud have a webex and I could take a look at your situation.  Waiting the workflow for an hour does not sound very good. 

 

ogelbric@cisco.com

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