mstefani77
Contributor
Contributor

vRA 8 Expire Event Topic

Has anyone found an event topic for lease expiration in vRA 8?  We used to run specific vRO workflows during the expiration state in 7.x, but I'm not seeing an event topic for that in 8.x .  I feel like that goes hand in hand with leases, so I'm hoping I'm just missing something obvious.  Has anyone found that in 8.x?

0 Kudos
1 Reply
kev01228
Enthusiast
Enthusiast

Surely an event topic for machine expirations will be coming soon. Until then, I came up with the following.

-Created a subscription for deployment.resource.action.pre (Deployment resource action requested) with filter event.data.actionName == 'PowerOff' (so it runs every time  a machine is powered off from vra).

-The sub calls a workflow that makes a call back to vRA via restHost to get the leaseExpire date. 

-In the workflow, compare the leaseExpireAt date against  the current time to determine if it’s expired, and check that the actionName is “PowerOff”. If so, go run a workflow. 

I had to play with the leaseExpireAt and current date formatting to get it into numbers that could be easily compared (i.e. currentDate >  leaseExpireAt) and the extensibility samples package helped me find what I needed from the vRA REST Host. 

https://code.vmware.com/samples/7469/vrealize-automation-8-x-extensibility-migration-guide-samples

If anyone has a cleaner or better way, please share.

Tags (1)