clalancette/oz — pull request #23 by imcleod (2012-02-23 04:30:18+00:00)
Title: improve shutdown detection

Detecting when a guest has independently shutdown via libvirt calls turns
out to be a little dicey. During testing we have seen a variety of exceptions
depending on when exactly in the guest teardown process the libvirt call is
made. This patch changes the approach from checking against a growing
whitelist of exceptions to waiting until teardown/destroy is complete and
a single known good exception is thrown. That is, a libvirt exception where:

e.get_error_domain() == libvirt.VIR_FROM_QEMU and
e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN

We have been testing with a slightly different version of this patch in the
Aeolus project. It is here:

https://github.com/aeolusproject/oz/commit/620e6f94cecdc7f8b3ff6dc3960267ab803b8252

This has proven rock solid over about a month of testing.

This patch simply checks more frequently for the "correct" exception while
allowing up to 10 seconds for it to occur (instead of 5).