VMware Cloud Community
LenK
Enthusiast
Enthusiast

Add or Update Property using Event Broker Subscription

Is anyone using workflow subscriptions to add or update virtual machine properties during event topic Machine Provisioning?

I have a simple subscription defined that’s called for all conditions where Lifecycle State Name = VMPSMasterWorkflow32.Requested to experiment with something like custom host naming in vRO.  My WF is setup with an input variable named “payload” of type Properties and I have no problem reading the properties passed from vRA to vRO but I’m not sure how to modify something like Hostname.

In the documentation I see the following schema for the event data payload:

{

  machine : {

      id                : STRING,      /* IaaS machine ID */

      name              : STRING,      /* machine name */

externalReference : STRING, /* machine ID on the hypervisor */

      owner             : STRING,      /* machine owner */

      type              : INTEGER,     /* machine type: 0 - virtual machine; 1 - physical machine; 2 - cloud machine */

      properties        : Properties   /* machine properties, see notes below how to expose virtual machine properties */           

  },

  blueprintName   : STRING,      /* blueprint name */

  componentId     : STRING,      /* component id */

  componentTypeId : STRING,      /* component type id */

  endpointId      : STRING, /* endpoint id */

  requestId       : STRING,      /* request id */

  lifecycleState  : { /* see Life Cycle State Definitions*/

      state : STRING,

      phase : STRING,

      event : STRING

  },

  virtualMachineEvent                 : STRING,     /* fire an event on that machine - only processed by Manager Service as consumer */

workflowNextState : STRING,     /* force the workflow to a specific state - only processed by Manager Service as consumer */

virtualMachineAddOrUpdateProperties : Properties, /* properties on the machine to add/update - only processed by Manager Service as consumer */

virtualMachineDeleteProperties : Properties  /* properties to remove from the machine - only processed by Manager Service as consumer */

}

My question is how can I leverage “virtualMachineAddOrUpdateProperties” to force a hostname change when the payload I’m working with is an input parameter to the workflow?

0 Kudos
2 Replies
SeanKohler
Expert
Expert

I haven't done anything with that. (I don't think/remember.)

But for workflow-based custom hostnames...  Brian has a nice blog on it and he references his sources.

Setting the Machine Name of a vCAC-provisioned VM to comply with a Corporate Standard – Part 1 of 4 ...

We actually take a few different user selectable fields in the BluePrint to then build the custom hostname.  It has worked for us for the past year and half or so.

0 Kudos
admin
Immortal
Immortal

1. virtualMachineAddOrUpdateProperties is bound to an output parameter with the same name.

2. Your event subscription should be a blocking task? That is required to process the output

//Update or add any Custom Properties here, for example:

virtualMachineAddOrUpdateProperties = new Properties();

virtualMachineAddOrUpdateProperties.put('some.property', 'GOOD LUCK');

0 Kudos