# HG changeset patch # User David Scott # Date 1261058926 0 # Node ID 5d6a3e43431f73d0af2bf28082960499819cd9b8 # Parent cb2080bdb84a5aea257dbf71392453d9139afeb8 CA-35893: add delay to the VM.hard_shutdown retry loop. When performing a VM.hard_shutdown we initially call Xc.domain_shutdown Halt and then later check the domain actually has shutdown. If the domain is running we assume that something like a reboot has happened in between and we retry. It turns out that there's sometimes a delay between calling Xc.domain_shutdown and Xc.domain_getinfo reporting a shutdown domain: paper over this crack with the retry loop. Ideally in future we'd look for domid changes => reboots but this requires a bit more refactoring to remember the old domid. Signed-off-by: David Scott diff -r cb2080bdb84a -r 5d6a3e43431f ocaml/xapi/xapi_vm.ml --- a/ocaml/xapi/xapi_vm.ml Thu Dec 17 14:08:46 2009 +0000 +++ b/ocaml/xapi/xapi_vm.ml Thu Dec 17 14:08:46 2009 +0000 @@ -591,6 +591,7 @@ let aborting = n < 1 in debug "Conflict when executing %s: %s" x.TwoPhase.api_call_name (if aborting then "aborting" else "retrying"); if aborting then raise e; + Thread.delay 5.; retry (n - 1) in retry 10