VMware Cloud Community
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?

Reply
0 Kudos
8 Replies
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)
qc4vmware
Virtuoso
Virtuoso

I just attempted to create an event subscription for this and was also shocked to see there is not an expiration topic.  We can't really rely on power off as this is not enforced at the time the expiration happens.  It is actually one of the things I'd like to force when the lease expires along with a customized message to the owner.  We also need to modify some of the config on these machines while they are in an expired state to turn off some monitoring and other things.  Conversely when the lease is extended we need to activate what we had disabled.  This we can catch obviously.  I can't think of a way to catch the expiration when it happens organically though.  Am I missing something?  I can 't believe in all this time that event has not yet been added.

Reply
0 Kudos
user1959
Contributor
Contributor

I have been experimenting with this recently. When you subscribe to the "deployment.action.post" topic you will get triggered by an action named "Expire" when the lease expires. I have not a seen standard deployment action of that name like vRA 7 has (actually I was again looking for that when I stumbled over this discussion).

qc4vmware
Virtuoso
Virtuoso

Interesting I'll have to give that a shot.  I did open a support ticket and got them to put in a feature request for me to create an event topic for that specifically.

 

Hi Paul,

Good day!
I have created the feature request to have the "Deployment lease Expiring" be added as Event topic to be able to use the Extensibility well for leases expiring.

The feature request ID is VRA-I-1504 for your future referenece.

Reply
0 Kudos
RebeccaW
Enthusiast
Enthusiast

I have been using deployment.action.pre with the condition "event.data.actionName == 'Expire'"

qc4vmware
Virtuoso
Virtuoso

Nice this worked for me.  I added a subscription to the post event which seems to trigger about 7-8 minutes after it shows as expired.  Not sure why so long of a delay there but it's more appropriate for my needs to trigger after the action completes.  I'll keep this in mind the next time I'm trying to track something down that isn't explicitly available via the gui as an action on the deployment or one of the objects in the deployment.  I think having a topic for the lease expiration is still valid though or good documentation that lists all of the not so obvious actions that are being tracked.  Maybe those examples are there and I need to RTFM again but it would be nice if it were in the topic description.

Reply
0 Kudos
qc4vmware
Virtuoso
Virtuoso

Following up here again hoping we get the ability to subscribe directly to the topic... the timing around when the "Action" kicks off on the deployment and when the actual events trigger and finish is really causing me to have an over complicated solution to what we need to do.  It makes no sense to me that the expiration time will be anywhere from a few minute to as much as 15 minutes BEFORE you see the events trigger?  I am attaching a screen shot where the system expired on time at 11:35 and was shown as such in the UI but you see the expire event doesn't trigger until 11:43:09 and finishes about 30 seconds after.  The "Deployment Request" action events for the expiration do trigger around the same time as the actual expiration but don't show in the UI history for the deployment.  Something is so out of whack here.  Do others see this?

Reply
0 Kudos
user1959
Contributor
Contributor

Have you tried subscribing to the deployment.action.post event, instead of deployment.action.pre?

Tags (1)
Reply
0 Kudos