«

»

May 02

vRealize Automation 7 – Enabling the Event Broker part 2

Well my hope is that you have already read through the Enabling the Event Broker that was posted in January. Then were thirsty for more and more around the Event broker. If you recall, in that post we covered the basics of consuming the payload from vRA 7 and utilize it just like we did the “Workflow Template” that used to exist in the 6.* days of vRA.

In the days since Enabling the Event Broker was posted I’ve built out some really powerful use cases as you can see by reviewing other more advanced Event Broker postings like Due to high demand, here’s the combined AAA deployment!, and New disk on a new SCSI adapter at request time. The issue is that it came to my attention by comments and customer meetings that I shouldn’t just be building out great use cases but enabling vRO template based examples.

So here we are with part 2 and in this post we will focus on Adding or Updating properties as the example. I will assume that you have followed the Enabling the Event Broker which will have your property groups already built out to pass all of the needed properties from vRA to vRO.

As I frequently do, if you want to follow along via video feel free to view this

***Note – You will notice there has been a bit of a change to my folder structure due to some standardization internally. Basically the team and I have decided that between us “Experts” (I use that term loosely) we will all build our content in a standardized layout so when you use stuff from Daily Hypervisor or VMtoCloud that you will have the same layout and limited reproduction of content.

While you can still use the examples from the original post you will likely get more out of the package I’ve posted here or here!

Then import into vRO and follow along step by step.

First let’s look at what’s included in the package you’ve downloaded.

Expand out the VMware -> SDE-SET -> Common -> vRealize Automation folder. In there you’ll find the folder we are going to base this post on. Expand Property Examples and the workflows you need for examples are all in this folder.

01-eb-addorupdatemp4

 

If we review the Add or Update properties for vRA example you’ll see the standard scriptable task which pulls in the payload (properties) and logs those. There are also 3 lines added to the end of that and an output of virtualMachineAddOrUpdateProperties with a type of properties. The benefit of this is that you can pass any number of value pairs back to vRA during the Event Broker execution.

virtualMachineAddOrUpdateProperties = new Properties ();
virtualMachineAddOrUpdateProperties.put(‘VirtualMachine.Network0.Name’, ‘dvPortGroup’);
virtualMachineAddOrUpdateProperties.put(‘custom.example’, ‘just a simple example’);
Reviewing these 3 lines you can see we are defining the property, updating an existing property, and creating a new property. These should help you as a starting point.

02-eb-addorupdatemp4

 

Now that we have looked at those to understand what’s going on let’s jump into vRA and work through the subscription. Go to Administration -> Events -> Subscriptions and +New

03-eb-addorupdatemp4

 

Select Machine provisioning

04-eb-addorupdatemp4

 

Run based on conditions

All of the following

Expand Data-Lifecycle state-Lifecycle state name

05-eb-addorupdatemp4

 

Equals and I’m choosing BuildingMachine as the example but this could be used at any of the events

06-eb-addorupdatemp4

 

Expand Data-Lifecycle state-State phase

07-eb-addorupdatemp4

 

Equals and I chose POST for the example

08-eb-addorupdatemp4

 

Choose your workflow “Add or Update properties for vRA”

09-eb-addorupdatemp4

 

IMPORTANT Select Blocking this is the only way vRA will accept the output from vRO to add or update properties

10-eb-addorupdatemp4

 

Publish the subscription you just created

11-eb-addorupdatemp4

 

Now time for some verification work. Based on Enabling the Event Broker you should have a trigger on all events subscription if not repeat the steps above and make sure this is published.

12-trigger-all-events

 

This is the walk through to verify you have something collecting the payload at every event

13-eb-addorupdatemp4

 

Run on all events

14-eb-addorupdatemp4

 

Get properties (don’t worry it’s just logging so we can verify the add or update worked)

15-eb-addorupdatemp4

 

Doesn’t need to block, but make sure it’s PUBLISHED

16-eb-addorupdatemp4

 

Now all you need to do is put the request for your catalog item in and let’s look at the workflows as they execute.

First we look at the event on request and notice there are no custom.example

18-vro-output

 

And our VirtualMachine.Network0.Name is set to VM Network

19-eb-addorupdatemp4

 

When our Add or Update is kicked off we can see it successfully ran

20-eb-addorupdatemp4

 

Now let’s look at the logs collected after the Add or Update was run

Notice we now have a custom.example (Which was created)

21-eb-addorupdatemp4

 

And our VirtualMachine.Network0.Name is set to dvPortGroup

22-eb-addorupdatemp4

 

I chose these very specifically to illustrate something that you likely have or could use in your environment but mostly I wanted to provide you with a sampling of what you can accomplish and how much easier it is than the good ole days of v.6

Having completed this and previously completed the Enabling the Event Broker you should now be able to collect and update any of the custom properties in vRA 7 using the Event Broker!

As always please let me know any feedback, thoughts, concerns, or kudos.

 

21 comments

1 ping

Skip to comment form

  1. Dan

    Hey Gary, has anyone mentioned any issues around downloading the sdeset package? When importing it, I get an “invalid block type” error in vRO. Thanks!

    1. gary.coburn

      Tested on 7.01, what version are you running?

      1. Dan

        Should be 7.0.1 as it’s the one nested in our vRA 7.0.1

        1. gary.coburn

          Do me a favor and try this one. I think it may be an issue with sample exchange.
          https://www.dropbox.com/s/rngu9tzl93gogjm/com.vmware.sdeset.vra.workflowTemplates.package?dl=0

        2. gary.coburn

          Can you try this package? I believe we may have an issue with developer center. https://www.dropbox.com/s/rngu9tzl93gogjm/com.vmware.sdeset.vra.workflowTemplates.package?dl=0

          1. Dan

            That one worked as expected, thanks!

  2. Itrudeau

    Hello, I trying to used this method to rename the VM Name at the Pre BuildMachine Phase whit a custom name generated by a name generator from a web App REst API Call.

    Using this the methode list bellow:

    virtualMachineAddOrUpdateProperties = new Properties ();
    virtualMachineAddOrUpdateProperties.put(“Name”, VMNewName);

    is the new name generated by the web app Rest API Call workflow result.

    This not seams to be working because I cannot see the VM Name change wen deploy and part of the Item list.

    Do you have any idea what I missing ?

    1. gary.coburn

      Based on my testing you can only do this at Requested Post. That should work for you as long as you have the subscription set to block

      1. Itrudeau

        Wow that work as you said. Now I was strungleling for week trying to figured this out.

        Very appreciate you help on this.

        Regards,

        1. gary.coburn

          I’m very glad these have helped you over come any learning challenges you may have been having. Stay tuned for even more content my friend!

  3. Dan

    Gary, have you seen it where the payload isn’t even passed to the workflow?

    1. gary.coburn

      Typically that is due to the custom property not being assigned to the blueprint. Make sure the appropriate property is assigned for your state change.

      Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.Requested
      Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.MachineProvisioned
      Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.BuildingMachine
      Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.Disposing
      Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.MachineActivated
      Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.UnprovisionMachine

      1. Dan

        We have both the custom property and the *.Requested in place. What’s odd is we can choose between two different workflows to run in the event; one receives a payload and the other does not.

        1. gary.coburn

          More than willing to jump on a webex with you if you’d like to demonstrate the behavior. That said is this 7.0.1 fresh install or upgrade? Are both blocking tasks? Can you disable the one that’s successfully running now and see if the one not working will pull the payload?

  4. skraack

    Gary,
    Is there a particular state requirements for updating any of the “__” hidden properties? I am trying to add some data to the __Notes field and it does not seem to be working at MachineProvisioned PRE or POST. I am able to update and create standard custom properties though. Any suggestions?

    1. gary.coburn

      Skraack, Not sure what you’re running into. I just tested in my environment and at Requested and phase of PRE I just set the __Notes as expected.

      Here’s the vRO code I used
      virtualMachineAddOrUpdateProperties = new Properties ();
      virtualMachineAddOrUpdateProperties.put(‘__Notes’, ‘Test’);

      Make sure your subscription is blocking

      1. skraack

        Trying to do it in a later state when I have more data. Requested is too early in the process.

      2. skraack

        Now I see what is happening. I am trying to update the VM Description field and I assumed that the __Notes was it, but it looks like Description is a copy of __Notes. I guess I will have to update the vCAC entity to get the description to update in VRA. Thought there might be a shortcut there, but I guess not.

        1. gary.coburn

          If you’re attempting to update the description of the actual deployment then that may be a bit of a challenge. I’m not sure that the vCAC entity will even do it. Since the Event Broker doesn’t allow for any interaction at the deployment level I have only seen that updated via an API call. Take a look at http://dailyhypervisor.com/vrealize-automation-custom-hostnaming-extension/ for the example to jump off of.

  5. ong yc

    virtualMachineAddOrUpdateProperties.put(‘VirtualMachine.Network0.ProfileName’

    can this be sent back to VRA? cant grab the profile

    1. gary.coburn

      Yes you can force settings back to vRA simply by making the event blocking and having the vRO workflow set a properties output. Take a look at this much older video as the example. http://screencast-o-matic.com/watch/coX2nOhDqD

  1. vRealize Automation 7 – Enabling the Event Broker » Extending Clouds

    […] Check out part 2 […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>