VMware Cloud Community
ullbergm
Enthusiast
Enthusiast

How do I wait for a host to finish rebooting?

Question for class.

I have a workflow where i reboot a host and i do a pretty simple check to see if the reboot is done and i was curious if anyone had any better way of doing it.

The workflow looks like this:
2011-09-30_103951.png

The "Wait for host" step looks like this:

Server.log(currenthost.runtime.connectionState.value);


// Wait for 5 minutes to make sure that the host has disconnected from vCenter due to the reboot.

System.sleep(5 * 60 * 1000);

while( currenthost.runtime.connectionState.value != "connected" )
{

    // Wait a second before checking again
    System.sleep(1 * 60 * 1000);
}

It works, but it just feels like a ugly hack to wait for 5 minutes, what if something is whack and it takes longer than 5 minutes for it to drop out of vCenter?

Thanks,

Magnus

Check out my orchestration blog here: http://ullberg.us/orchestrate/
0 Kudos
1 Reply
peetz
Leadership
Leadership

Hmm, you could first wait (in a similar while-loop) for the host to disconnect (to be sure that it reboots), and then wait for re-connect.

- Andreas

Twitter: @VFrontDe, @ESXiPatches | https://esxi-patches.v-front.de | https://vibsdepot.v-front.de
0 Kudos