VMware Cloud Community
mmonkman
Enthusiast
Enthusiast
Jump to solution

vRA8.1 - Deployments succeed while guest customisation is still running

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.

1 Solution

Accepted Solutions
dbis7575
Enthusiast
Enthusiast
Jump to solution

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.

View solution in original post

5 Replies
dbis7575
Enthusiast
Enthusiast
Jump to solution

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.

mmonkman
Enthusiast
Enthusiast
Jump to solution

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.

Reply
0 Kudos
siglert
Enthusiast
Enthusiast
Jump to solution

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;

siglert
Enthusiast
Enthusiast
Jump to solution

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

mmonkman
Enthusiast
Enthusiast
Jump to solution

That's almost exactly what I was about to write myself. Smiley Wink


Thank you.  It's spot on!

Reply
0 Kudos