xenlight: avoid the VM power_state becoming paused after a suspend
xenlight: avoid the VM power_state becoming paused after a suspend

The power state (as viewed by xenopsd clients) glitches at the end of suspend.
It seems that libxl actively pauses the shutdown suspended domain. This
shouldn't by itself cause a problem but I suspect that libxl's domain_destroy
is asynchronous: like libxc it just means 'set the destroy bit', not the
common english meaning of destroy i.e. 'domain, begone, and be all ways
away'[1]. Once the domain has been 'destroyed' then xapi will be allowed to
'stat' the domain, xenopsd will see a suspended, shutdown, paused *and*
destroyed domain and report this as 'paused' (!). This triggers an assertion
failure in xapi's VM.suspend.

We fix this by waiting for the destroyed domain to disappear. We should
consider also resetting the domain's uuid in a future patch.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>

[1] Shakespeare, A Midsummer Night's dream, Act 4, Scene 1

cheng--zhang/xenopsd,cheng--zhang/xenopsd,euanh/xenopsd,djs55/xenopsd,euanh/xenopsd,thomassa/xenopsd,thomassa/xenopsd,johnelse/xenopsd,cheng--zhang/xenopsd,koushikcgit/xenopsd,koushikcgit/xenopsd,koushikcgit/xenopsd,thomassa/xenopsd,euanh/xenopsd,djs55/xenopsd,johnelse/xenopsd,johnelse/xenopsd,djs55/xenopsd