VMware Cloud Community
chrisheartland
Enthusiast
Enthusiast
Jump to solution

vCAC 6 WFStubBuildingMachine not finding vCAC:VirtualMachine?

Whenever the vCAC WFStubBuildingMAchine or Disposing workflows kick off it shows in the "variables" tab on the right pane that the type "vCAC:VirtualMachine" was "Not Found." It lists the vCAC:Entity and vcac:vcachost. I need this to be found so I can pull propeties directly from the vm such as OS type etc. Should this be shown/found during these workflows?

Tags (4)
Reply
0 Kudos
1 Solution

Accepted Solutions
chrisheartland
Enthusiast
Enthusiast
Jump to solution

I figured it out. It's not "hostname". that's what you would put into the custom property field in vcac, but it's not what you put in for the JS code...go figure?

The code to get machine name during destroy/dcommissioning is:

var vmName = vcacEntity.getProperty("VirtualMachineName");

Cheers

View solution in original post

Reply
0 Kudos
6 Replies
awjudge
Hot Shot
Hot Shot
Jump to solution

You may need to start from the VCAC:Entity object to get what you need. For my workflows (BuildingMachine, and Disposing) my workflow uses the VCAC:Entity as the primary input parameter.

You can easily get all the VCAC properties for the VM from VCAC:Entity, but you might need to get the VC:VirtualMachine object type to get any vCenter-based properties.

Which properties of the VM are you looking for?

chrisheartland
Enthusiast
Enthusiast
Jump to solution

I'm trying to get OS: either windows or linux. The easiest way I have found is to use object vcac:virtualmachine with code: var guestName = vCACVm.guestOS; if (guestName.indexOf("Red") > -1); OS = "Linux"'.

But, again, the vcac:virtualmachine is not inputting anytyhing. I may not have my input/ouputs right though. I created a test workflow and got it to work with inputs: vcac:virtualmachine and vcac:entity along with the above code. Not sure why I can't get it to work with the destroy stub workflow.

EDIT: Looks like I got it. I think my overall inputs/outputs were wrong. I didn't have vcac:vcachost as an input and when I added it I think that was the missing piece. Here is my final solution:

Inputs: vcac:vcachost, vcac:entity, vcac:virtualmachine

outputs: oS (string - variable to capture oS)

EDIT 2: Looks like I was wrong. I thought I fixed it but no. The odd thing is it seems to be giving me all three vcac inputs but is giving error: TypeErro: Cannot call mthod "indexOf" of null. So, it seems it's not finding vCACVm.guestOS for some reason. Will continue troubleshooting.

Reply
0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

I actually have to do a similar action (for probably both similar and not so similar reasons), but my approach, rather than relying on the vCACVm object, was to set custom properties with the guest O/S properties I wanted; in each build profile I have for the O/S, I set a "family" and "full" O/S custom property that I can use in various workflows. It was just easier to get all of my metadata attributes about a requested system from the same place (properties of the VM), rather than building logic into a workflow to sort it out for me.

-Steve
chrisheartland
Enthusiast
Enthusiast
Jump to solution

This is exactly what i did after I couldn't get the other way to work. I was still troubleshooting just to make sure because that's really a better (more dynamic) way to do it.

But, yes this works too. Now, i'm just trying to find the property for vm name. I tried "VirtualMachineName" but that did not work. Next I'll try "VMDNSname" and see what happens.

Reply
0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

That custom property should simply be hostname. I agree that it's kind of odd that it isn't picking up the values, but I personally think it's easier to manage metadata in a consistent manner; the less different objects / tracking methods you have to support, the easier long-term sustainability is (in my opinion).

-Steve
Reply
0 Kudos
chrisheartland
Enthusiast
Enthusiast
Jump to solution

I figured it out. It's not "hostname". that's what you would put into the custom property field in vcac, but it's not what you put in for the JS code...go figure?

The code to get machine name during destroy/dcommissioning is:

var vmName = vcacEntity.getProperty("VirtualMachineName");

Cheers

Reply
0 Kudos