ia64/xen-unstable

view tools/xm-test/tests/restore/04_restore_withdevices_pos.py @ 7753:fb4f48f0116e

Tweak the usage of mke2fs to be quiet, so that the XML reports
contain less garbage
author dan@guaranine.beaverton.ibm.com
date Thu Nov 10 11:47:38 2005 +0100 (2005-11-10)
parents b0b854126410
children 0c3335a98f0b
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2005
4 # Author: Dan Smith <danms@us.ibm.com>
6 from XmTestLib import *
8 domain = XmTestDomain()
10 domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
12 s, o = traceCommand("mke2fs -q /dev/ram0")
13 if s != 0:
14 FAIL("Unable to mke2fs /dev/ram0 in dom0")
16 try:
17 domain.start()
18 except DomainError, e:
19 FAIL(str(e))
21 try:
22 console = XmConsole(domain.getName())
23 console.sendInput("foo")
25 run = console.runCmd("mount /dev/hda1 /mnt")
26 if run["return"] != 0:
27 FAIL("Unable to mount /dev/hda1")
29 run = console.runCmd("echo bar > /mnt/foo")
30 if run["return"] != 0:
31 FAIL("Unable to write to block device!")
33 except ConsoleError, e:
34 FAIL(str(e))
36 console.closeConsole()
38 try:
39 s, o = traceCommand("xm save %s /tmp/test.state" % domain.getName(),
40 timeout=30)
41 except TimeoutError, e:
42 FAIL(str(e))
44 if s != 0:
45 FAIL("xm save exited with %i != 0" % s)
47 # Let things settle
48 time.sleep(15)
50 try:
51 s, o = traceCommand("xm restore /tmp/test.state",
52 timeout=30)
53 except TimeoutError, e:
54 FAIL(str(e))
56 if s != 0:
57 FAIL("xm restore exited with %i != 0" % s)
59 try:
60 console = XmConsole(domain.getName())
62 run = console.runCmd("ls | grep proc")
63 if run["return"] != 0:
64 FAIL("ls failed on restored domain")
66 run = console.runCmd("cat /mnt/foo | grep bar")
67 if run["return"] != 0:
68 FAIL("Unable to read from block device")
70 except ConsoleError, e:
71 FAIL(str(e))