VMware Cloud Community
RonPSSC
Enthusiast
Enthusiast
Jump to solution

Create / update property on virtualMachine Entity - vCO Help

I'm trying to update a Custom property of a vCAC-provisioned VM using the subject Out-of-the-Box Workflow which is included in the vCAC Plugin Extensibility Package. Manually selecting a vCAC Host in the Common parameters window is not a problem. What I can't do is select/input anything in the virtualMachineEntity Field. Nothing appears in the Chooser/popup window and no data appears regardless of what I may enter in the vCAC:Entity Filter Box. Should this Field auto-populate with some type of data or is there a specific string I need to enter to target my VM?

Am I using the correct Workflow? I'd like to be able to replace the propertyValue of a Custom property of a specific/existing VM.

Thx. Ron

1 Solution

Accepted Solutions
qc4vmware
Virtuoso
Virtuoso
Jump to solution

I think you will find that many of those workflows need a little doctoring up to work if you want to run them interactively.  You might want to copy that and instead of using the entity for the input use vCACVm:VirtualMachine then you can use the getEntity()  to set that value.

Here is a snippet from one of our actions setting the cpu and ram for example.  We just pass in the virtual machine.  I wrote another action to fetch the host and as you can see you can get the entity with a method of the scriptable object.

var host = System.getModule("com.qualcomm.basic").QCgetvCACHostForvCACVm(vCACVm);

var virtualMachineEntity = vCACVm.getEntity();

var propertyIsHidden = false;

var propertyIsRuntime = false;

var propertyIsEncrypted = false;

var doNotUpdate = false;

System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(host,virtualMachineEntity,"VirtualMachine.CPU.Count",resize[0].toString(),propertyIsHidden,propertyIsRuntime,propertyIsEncrypted,doNotUpdate);

System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(host,virtualMachineEntity,"VirtualMachine.Memory.Size",resize[1].toString(),propertyIsHidden,propertyIsRuntime,propertyIsEncrypted,doNotUpdate);

View solution in original post

9 Replies
qc4vmware
Virtuoso
Virtuoso
Jump to solution

I think you will find that many of those workflows need a little doctoring up to work if you want to run them interactively.  You might want to copy that and instead of using the entity for the input use vCACVm:VirtualMachine then you can use the getEntity()  to set that value.

Here is a snippet from one of our actions setting the cpu and ram for example.  We just pass in the virtual machine.  I wrote another action to fetch the host and as you can see you can get the entity with a method of the scriptable object.

var host = System.getModule("com.qualcomm.basic").QCgetvCACHostForvCACVm(vCACVm);

var virtualMachineEntity = vCACVm.getEntity();

var propertyIsHidden = false;

var propertyIsRuntime = false;

var propertyIsEncrypted = false;

var doNotUpdate = false;

System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(host,virtualMachineEntity,"VirtualMachine.CPU.Count",resize[0].toString(),propertyIsHidden,propertyIsRuntime,propertyIsEncrypted,doNotUpdate);

System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(host,virtualMachineEntity,"VirtualMachine.Memory.Size",resize[1].toString(),propertyIsHidden,propertyIsRuntime,propertyIsEncrypted,doNotUpdate);

RonPSSC
Enthusiast
Enthusiast
Jump to solution

Thanks for your input. Looks like I'll need to script a new workflow with inputs and values as you've suggested below in order to achieve desired results. I can appreciate defining custom properties within vCO to be invoked later at the Blueprint and various Machine States would naturally require customization of sorts but updating these properties after a VM has been provisioned, you would think, could be facilitated via Out-of-the-box. Anyway, that was my initial assessment of the purpose of the subject workflow.

Somewhat disappointed to say the least..Why does automating and orchestrating even the basic tasks seem so complex in vCO...? Thx again for your help..

Ron

EDIT 1

Paul's suggestion above did the trick. By changing the default input parameters to target a VCAC:VM entity, I was able to Update a custom property of a VM on an "interactive" basis. I've attached a copy of my Workflow on the odd chance others may find it useful. As a final comment or request rather, since this Workflow is set to run against a single VM, I'm wondering what I'd need to do to change the input variable(s) to target multiple VMs? I was unsuccessful when I introduced an "array" type. Sorry, my javascript skills are very limited. Thx. Ron

EDIT 2

I was able to figure out how to add a simple loop operation to my Scriptable task once combined with the Array/vCAC:VM input parameter, so all is good there as well. I now have another workflow that will target Multiple VMs and have attached it as well for info. It's primitive, not very elegant and probably can be cleaned up or improved upon but, for now, appears to execute properly which satisfies my needs.

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

In this case vCO is not the difficulty, it is the API that is exposed by the vCAC IaaS. The vCO  IaaS plug-in removes some of its complexity with providing authorization management, session management, actions and workflows abstracting the underlying API.

I admit that if your first experience with vCO is to leverage the IaaS plug-in then it is a rough first step.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
stvkpln
Virtuoso
Virtuoso
Jump to solution

Honestly, Out-of-the-box, as you put it.. is relative. When you buy a 1,000 piece puzzle to put together, everything you need is given... you just have to understand how the pieces get put together to achieve the desired outcome. The plugin itself gives all of the pieces required to achieve this out of the box with very little understanding for how things work.. Just need to get those pieces snapped together!

Knowing Paul the way I happen to know Paul, he gave you the exact answer to your specific question, but I'm going to take a step back and recommend you read both parts of this blog series that Ryan Kelly did (linking part 1, part 2 should be linked at the bottom): How to extend vCAC with vCO Part 1

Lots of great info there to glean in how to just get a basic setup going.. Then, it's a lot of trial error and toying around.

-Steve
RonPSSC
Enthusiast
Enthusiast
Jump to solution

Perhaps a little clarification is required here. When I solicited advice and help, I was trying to determine whether the outcome I was aiming to achieve could be carried out using the subject workflow, in its primitive form, in an "interactive" manner. Although I'm somewhat of a vCO novice, I have used a select number of workflows, that come bundled with various extensibility packages, interactively w/o any additional customization or doctoring as qc4vmware (whom I'm guessing is Paul) adequately put it. These are what I refer to as out-of-the-box. Clearly this particular workflow is not one of them.

Appreciate the reference links.. I agree, a substantial amount of info to digest with plenty of tinkering...and failures to be sure.. Smiley Happy

Thx. Ron

0 Kudos
RonPSSC
Enthusiast
Enthusiast
Jump to solution

Updating this post to acknowledge Paul (qc4vmware) as having the Correct Answer. Unfortunately this option is no longer available. I'm going to attempt to re-enable this feature by Unmarking as Helpful. Apologize, in advance, if this doesn't work.

vMarkusK1985
Expert
Expert
Jump to solution

I have an other solution to update / add a property.

https://mycloudrevolution.com | https://twitter.com/vMarkus_K | https://github.com/vMarkusK
0 Kudos
RaviMV
Enthusiast
Enthusiast
Jump to solution

Thanks ! good information. its helpfull

0 Kudos
balsz
Contributor
Contributor
Jump to solution

This workflow is not working for me. I am using payload properties to get the virtual machine details and updating ServiceNow CMDB. With this payload workflow, when I add vCACHost and vCAC:virtualmachine parameters to update the service now sysid to vmentity (for to remove/update the cmdb later) using the action "addUpdatePropertyFromVirtualMachineEntity" or with your update property workflow I am getting error like below.

Error in (Dynamic Script Module name : parsePayload#1) TypeError: Cannot call method "get" of null

Can you please help on this? and let me know if you need more details.

0 Kudos