Is it possible to wait for vsphere guest customisations to have completed before blueprint deployment status is set to success?
In my case a number of config management tasks need to happen once the deployment vm has joined the AD domain and rebooted etc.
There is no way to wait for your customization to complete, as there is no confirmation when it is completed.
What I did is add an action to sleep for X amount of time after provisioning is completed to ensure all customization are done when it is marked as completed.
There is no way to wait for your customization to complete, as there is no confirmation when it is completed.
What I did is add an action to sleep for X amount of time after provisioning is completed to ensure all customization are done when it is marked as completed.
OK, thanks. I'll work on checking for the customisation succeeded vcentre event. I'd be forever tweaking the sleep timer as guest customisation time is not predictable in our environment.
I wrote an action to do just that:
var vcConn = vm.sdkConnection;
var evtMan = vcConn.eventManager;
var tmpComplete;
var succeed = "succeeded."
var actionResult;
timeout = timeout * 1000
var filterSpec = new VcEventFilterSpec();
filterSpec.eventTypeId = ['CustomizationSucceeded'];
filterSpec.entity = new VcEventFilterSpecByEntity();
filterSpec.entity.entity = vm;
filterSpec.entity.recursion = VcEventFilterSpecRecursionOption.self;
var events = evtMan.queryEvents(filterSpec);
if ( events == null) {
actionResult = false;
}
System.log(vm.name);
//System.log(events.length);
if (events != null) {
for (var i=0;i<events.length;i++) {
System.log(JSON.stringify(events[i].fullFormattedMessage))
System.log(JSON.stringify(events[i].fullFormattedMessage).split(' ')[4]);
tmpComplete = JSON.stringify(events[i].fullFormattedMessage).split(' ')[4];
if (tmpComplete == succeed) {
actionResult = true;
break;
} else {
actionResult = false;
}
}
}
System.log(actionResult);
return actionResult;
System.log(vm.name);
System.log(events.length);
for (var i=0;i<events.length;i++) {
System.log(JSON.stringify(events[i].fullFormattedMessage))
System.log(JSON.stringify(events[i].fullFormattedMessage).split(' ')[4]);
tmpComplete = JSON.stringify(events[i].fullFormattedMessage).split(' ')[4];
if (tmpComplete == succeed) {
actionResult = true;
break;
} else {
actionResult = false;
}
}
System.log(actionResult);
return actionResult;
I should have clarified as well. instead of waiting in the running action in the workflow I put a sleep if the action return is equal to false and then run it again. it checks every 30 seconds for ethe event Customization succeeded on the VM
That's almost exactly what I was about to write myself.
Thank you. It's spot on!