AstraMonti
Enthusiast
Enthusiast

Fail VRA deployment when event broker workflow fails

Jump to solution

Hi all,

I have an event broker workflow that runs on VMPSMasterWorkflow32.MachineProvisioned lifecycle state. If that workflow fails, I want VRA to also fail the deployment. Is that possible to do?

1 Solution

Accepted Solutions
nmshadey
Enthusiast
Enthusiast

You haven't specified what phase the state was in for VMPSMasterWorkflow32.MachineProvisioned lifecycle state.

vRA will only fail the deployment on specific lifecycle states:

  • VMPSMasterWorkflow32.Requested
  • VMPSMasterWorkflow32.BuildingMachine
  • VMPSMasterWorkflow32.MachineProvisioned

But the phase must always be PRE.

If the state phase is EVENT or POST then it will continue with the deployment regardless if the workflow throws an exception.

Change your EBS subscription to include the state phase as PRE as a second condition.

The subscription must also be BLOCKING.

Gavin

View solution in original post

12 Replies
sharptonm
Enthusiast
Enthusiast

It should do this out of the box for that state.  If that fails, the whole build should fail with it and be disposed.  We had something similar in which we wanted to fail the entire build at requested state if that workflow were to fail which does not happen out of the box.  This link may be of help, in the behaviors and limitations section.

https://virtualviking.net/2016/01/20/exploring-the-vrealize-automation-7-0-event-broker-part-2/

AstraMonti
Enthusiast
Enthusiast

Thank you @sharptonm. That's what I thought but It doesn't do it out of the box; when the workflow fails (and it's in blocking state) the deployment still finishes correctly. I ll have a look on that article too, thanks.

0 Kudos
sharptonm
Enthusiast
Enthusiast

Is your workflow failing?  If not, throw an error see what happens.  I can confirm the whole build fails when machine provisioned fails for me.

0 Kudos
AstraMonti
Enthusiast
Enthusiast

The workflow is definitely failing with an exception. I have now added the "BuildFailure" output but it made no difference, the workflow failed, but the VRA deployment still finished successfully.

0 Kudos
sharptonm
Enthusiast
Enthusiast

Doesn't make sense.  There must be some other non default setting that is causing it to continue.

0 Kudos
AstraMonti
Enthusiast
Enthusiast

It's a very simple setup, just one VM inside the blueprint, the user decides the name of the VM through a dropdown menu, the machine starts building and on the VMPSMasterWorkflow32.MachineProvisioned lifecycle state I run a workflow, but regardless of the result, the deployment still going ahead and finishes successful.

0 Kudos
nmshadey
Enthusiast
Enthusiast

You haven't specified what phase the state was in for VMPSMasterWorkflow32.MachineProvisioned lifecycle state.

vRA will only fail the deployment on specific lifecycle states:

  • VMPSMasterWorkflow32.Requested
  • VMPSMasterWorkflow32.BuildingMachine
  • VMPSMasterWorkflow32.MachineProvisioned

But the phase must always be PRE.

If the state phase is EVENT or POST then it will continue with the deployment regardless if the workflow throws an exception.

Change your EBS subscription to include the state phase as PRE as a second condition.

The subscription must also be BLOCKING.

Gavin

View solution in original post

AstraMonti
Enthusiast
Enthusiast

Thank you Gavin. All I was missing was the pre. I had set my action to post. It now fails the deployment if the workflow fails.

0 Kudos
qc4vmware
Virtuoso
Virtuoso

I'm trying to setup  a workflow that when it fails in the VMPSMasterWorkflow32.Requested the deployment fails.  I dunno if I am being dense but I can't seem to get this to work.  I've added the virtualMachineEvent output to my workflow, I've subscribed to the "PRE" state but the deployment still doesn't fail.  I think I must be misreading the docs or something.  I've tried setting the virtualMachineEvent to "BuildFailure" and that doesn't work.  I've tried a few other things but I can't seem to get it to work. 

0 Kudos
DLally
Enthusiast
Enthusiast

Did you ever figure this out?  I've got mine setup the same with, VMPSMasterWorkflow32.Requested and state phase PRE however it's still not causing my builds to fail out if the workflow fails

0 Kudos
DLally
Enthusiast
Enthusiast

I spoke too soon.  Unless I'm missing something, I think there might be some bad advice in here..partly.

I never got mine to fail using the VMPSMasterWorkflow32.Requested.

According to the link below, it only works in either of the 3 phases. BuildingMachine, MachineProvisioned, MachineRegistered.

https://virtualviking.net/2016/01/20/exploring-the-vrealize-automation-7-0-event-broker-part-2/

As soon as i flipped my event from requested to building machine,  my workflow failures now cause the server to fail out as well. 

0 Kudos
SkyCoop
VMware Employee
VMware Employee

You can use pre-requested to fail the workflow, but you have to have the custom property -

In addition to using the PRE lifecycle phase, you also need to add the following custom property:

Extensibility.Lifecycle.Error.Event.VMPSMasterWorkflow32.Requested = Destroy

With the exception of BuildingMachine, MachineProvisioned, and RegisterMachine, the property needs to be added for any lifecycle state:

Extensibility.Lifecycle.Error.Event.VMPSMasterWorkflow32.{state} = Destroy

Might actually be Disposing instead of Destroy. I wouldn't use Requested for the subscription as I've seen random machines fail in the vRO portion but a VM gets spun up in vCenter, while vRA isn't aware of it. Safer to use the Building Machine state, typically fits most use cases that Requested would work for anyway.

0 Kudos