sbeaver
Leadership
Leadership

Brain Cramp - What object to query to check if the provisioning request failed

I guess I am having a but of a brain cramp today.  What I am looking for is the object to query to see if a provisioning request has failed.  What I am looking for is the first step to see if a job has failed and if so automatically re-submit the request.  I was thinking about making this check during the start of the unprovisioning and destroying stubs so that if a request was found in a failed cleanup state I could bypass the decommission steps like releasing name, ip and such and then for loop through the properties and resubmitting the request.

Thanks

Cheers

Steve

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
1 Reply
stvkpln
Virtuoso
Virtuoso

What I did, for error handling purposes, was inject a custom property called __vm.State (or something like that) which gets updated at various stages of the provisioning workflow.... If I recall right, the places I inject it are:

- At the beginning of the BuildingMachine state to indicatethat the workflow started

- At the end of BuildingMachine to indicatethat the workflow completed successfully and vCenter cloning operation was to be initiated

- At the beginning of the MachineProvisioned to indicate cloning / customization finished and the workflow was starting

- At the end of the MachineProvisioned to indicate things completed as expected

Using that custom property, I can look at the value and determine what actions to take on the MachineDisposing state based on it's value.

Another way to attack it, though, would be to export the Request Number during the BuildingMachine and store it, then be able to access that request to initiate the new provisioning attempt.... Though, I'm not 100% sure how to manipulate that info (haven't tried yet). I sorted out how to pull the request number out this morning on an unrelated reason, and posted the code in this thread! In theory, you could have the MachineDisposing workflow query the request and determine if it should reprovision. The big thing with that would be to be careful and only initiate a re-request under the right conditions... This could quickly become a death spiral of pain if the reason for the failure is unknown! or requires a fix somewhere.

-Steve