WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][XM-TEST] Check that block-list is accurate after det

To: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH][XM-TEST] Check that block-list is accurate after detach
From: Dan Smith <danms@xxxxxxxxxx>
Date: Thu, 17 Nov 2005 14:55:17 -0800
Delivery-date: Thu, 17 Nov 2005 22:55:15 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)
This patch adds a test that performs a series of block-attach and
block-detach operations and verifies that block-list accurately
represents the current state of a domain's block devices.

Signed-off-by: Dan Smith <danms@xxxxxxxxxx>
# HG changeset patch
# User dan@xxxxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID 1b466985687fe1d02e80aad813878dcba251eaa8
# Parent  f6fdb6e0d3c96241354fe87cb264d740dfe4087c
Added a test to verify that devices come and go from block-list
as they are block-attach'd and block-detach'd.

diff -r f6fdb6e0d3c9 -r 1b466985687f tools/xm-test/tests/block-list/Makefile.am
--- a/tools/xm-test/tests/block-list/Makefile.am        Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/tests/block-list/Makefile.am        Thu Nov 17 22:56:44 2005
@@ -5,7 +5,8 @@
        02_block-list_attachbd_pos.test \
        03_block-list_anotherbd_pos.test \
        04_block-list_nodb_pos.test \
-       05_block-list_nonexist_neg.test
+       05_block-list_nonexist_neg.test \
+       06_block-list_checkremove_pos.test
 
 XFAIL_TESTS = 
 
diff -r f6fdb6e0d3c9 -r 1b466985687f 
tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py
--- /dev/null   Thu Nov 17 13:56:50 2005
+++ b/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py   Thu Nov 
17 22:56:44 2005
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@xxxxxxxxxx>
+
+from XmTestLib import *
+
+domain = XmTestDomain()
+
+try:
+    domain.start()
+except DomainError, e:
+    FAIL(str(e))
+
+try:
+    console = XmConsole(domain.getName())
+except ConsoleError, e:
+    FAIL(str(e))
+
+s, o = traceCommand("xm block-list %s" % domain.getName())
+if s != 0:
+    FAIL("block-list returned !0 when no devices attached")
+if o:
+    FAIL("block-list without devices reported something!")
+
+s, o = traceCommand("xm block-attach %s phy:/dev/ram0 hda1 w" % 
domain.getName())
+if s != 0:
+    FAIL("Unable to attach /dev/ram0->hda1")
+
+s, o = traceCommand("xm block-list %s" % domain.getName())
+if s != 0:
+    FAIL("block-list failed")
+if not o.find("769"):
+    FAIL("block-list didn't show the block device I just attached!")
+
+s, o = traceCommand("xm block-attach %s phy:/dev/ram1 hda2 w" % 
domain.getName())
+if s != 0:
+    FAIL("Unable to attach /dev/ram1->hda2")
+
+s, o = traceCommand("xm block-list %s" % domain.getName())
+if s != 0:
+    FAIL("block-list failed")
+if not o.find("770"):
+    FAIL("block-list didn't show the other block device I just attached!")
+
+s, o = traceCommand("xm block-detach %s 769" % domain.getName())
+if s != 0:
+    FAIL("block-destroy of hda1 failed")
+
+s, o = traceCommand("xm block-list %s" % domain.getName())
+if s != 0:
+    FAIL("block-list failed after detaching a device")
+if o.find("769"):
+    FAIL("hda1 still shown in block-list after detach!")
+if not o.find("770"):
+    FAIL("hda2 not shown after detach of hda1!")
+
+s, o = traceCommand("xm block-detach %s 770" % domain.getName())
+if s != 0:
+    FAIL("block-list failed after detaching another device")
+if o.find("770"):
+    FAIL("hda2 still shown in block-list after detach!")
+if o:
+    FAIL("block-list still shows something after all devices detached!")
+    
+
-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@xxxxxxxxxx
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>