ia64/xen-unstable

changeset 9895:e0e68942b205

Wait for the device to be connected on the guest (with a 10s timeout)
before detaching it. Fix a race condition that dom0 was tearing down the
block device while the guest was putting it in a Connected state.

Signed-off-by: Vincent Hanquez <vincent@snarc.org>
author vhanquez@kneesa.uk.xensource.com
date Fri Apr 28 16:44:00 2006 +0100 (2006-04-28)
parents 5931e98cd744
children 42a8e3101c6c
files tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py
line diff
     1.1 --- a/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py	Fri Apr 28 14:48:50 2006 +0100
     1.2 +++ b/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py	Fri Apr 28 16:44:00 2006 +0100
     1.3 @@ -26,6 +26,12 @@ def checkXmLongList(domain):
     1.4      else:
     1.5          return False
     1.6  
     1.7 +def checkBlockState(domain):
     1.8 +    s, o = traceCommand("xm block-list %s | awk '{print $4}' |tail -n 1" % domain.getName())
     1.9 +    if s != 0:
    1.10 +        FAIL("block-list failed")
    1.11 +    return int(o)
    1.12 +
    1.13  if ENABLE_HVM_SUPPORT:
    1.14      SKIP("Block-detach not supported for HVM domains")
    1.15  
    1.16 @@ -46,7 +52,11 @@ if not checkBlockList(domain):
    1.17  if not checkXmLongList(domain):
    1.18      FAIL("xm long list does not show that hda1 was attached")
    1.19  
    1.20 -time.sleep(2)
    1.21 +for i in range(1, 10):
    1.22 +    time.sleep(1)
    1.23 +    state = checkBlockState(domain)
    1.24 +    if state == 4:
    1.25 +        break
    1.26  
    1.27  s, o = traceCommand("xm block-detach %s hda1" % domain.getName())
    1.28  if s != 0: