ia64/xen-unstable

changeset 7755:0c3335a98f0b

Make the 04_restore test verify that two block devices and two nics are
restored to a working state and that the nics retain their configuration.
author danms@us.ibm.com
date Thu Nov 10 11:48:05 2005 +0100 (2005-11-10)
parents 7562dc888468
children 578736096552
files tools/xm-test/tests/restore/04_restore_withdevices_pos.py
line diff
     1.1 --- a/tools/xm-test/tests/restore/04_restore_withdevices_pos.py	Thu Nov 10 11:48:05 2005 +0100
     1.2 +++ b/tools/xm-test/tests/restore/04_restore_withdevices_pos.py	Thu Nov 10 11:48:05 2005 +0100
     1.3 @@ -5,14 +5,21 @@
     1.4  
     1.5  from XmTestLib import *
     1.6  
     1.7 -domain = XmTestDomain()
     1.8 +import re
     1.9 +
    1.10 +domain = XmTestDomain(extraOpts={"nics":2})
    1.11  
    1.12  domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
    1.13 +domain.configAddDisk("phy:/dev/ram1", "hdb2", "w")
    1.14  
    1.15  s, o = traceCommand("mke2fs -q /dev/ram0")
    1.16  if s != 0:
    1.17      FAIL("Unable to mke2fs /dev/ram0 in dom0")
    1.18  
    1.19 +s, o = traceCommand("mke2fs -q /dev/ram1")
    1.20 +if s != 0:
    1.21 +    FAIL("Unable to mke2fs /dev/ram1 in dom0")
    1.22 +
    1.23  try:
    1.24      domain.start()
    1.25  except DomainError, e:
    1.26 @@ -22,13 +29,38 @@ try:
    1.27      console = XmConsole(domain.getName())
    1.28      console.sendInput("foo")
    1.29  
    1.30 -    run = console.runCmd("mount /dev/hda1 /mnt")
    1.31 +    run = console.runCmd("mkdir /mnt/a /mnt/b")
    1.32 +    if run["return"] != 0:
    1.33 +        FAIL("Unable to mkdir /mnt/a /mnt/b")
    1.34 +
    1.35 +    run = console.runCmd("mount /dev/hda1 /mnt/a")
    1.36      if run["return"] != 0:
    1.37          FAIL("Unable to mount /dev/hda1")
    1.38  
    1.39 -    run = console.runCmd("echo bar > /mnt/foo")
    1.40 +    run = console.runCmd("mount /dev/hdb2 /mnt/b")
    1.41 +    if run["return"] != 0:
    1.42 +        FAIL("Unable to mount /dev/hdb2")
    1.43 +
    1.44 +    run = console.runCmd("echo hda1 > /mnt/a/foo")
    1.45 +    if run["return"] != 0:
    1.46 +        FAIL("Unable to write to block device hda1!")
    1.47 +
    1.48 +    run = console.runCmd("echo hdb2 > /mnt/b/foo")
    1.49      if run["return"] != 0:
    1.50 -        FAIL("Unable to write to block device!")
    1.51 +        FAIL("Unable to write to block device hdb2!")
    1.52 +
    1.53 +    run = console.runCmd("ifconfig eth0 169.254.0.1 netmask 255.255.255.0")
    1.54 +    if run["return"] != 0:
    1.55 +        FAIL("Unable to configure DomU's eth0")
    1.56 +
    1.57 +    run = console.runCmd("ifconfig eth1 169.254.1.1 netmask 255.255.255.0")
    1.58 +    if run["return"] != 0:
    1.59 +        FAIL("Unable to configure DomU's eth1")
    1.60 +
    1.61 +    run = console.runCmd("ifconfig lo 127.0.0.1")
    1.62 +    if run["return"] != 0:
    1.63 +        FAIL("Unable to configure DomU's lo")
    1.64 +
    1.65  
    1.66  except ConsoleError, e:
    1.67      FAIL(str(e))
    1.68 @@ -63,9 +95,31 @@ try:
    1.69      if run["return"] != 0:
    1.70          FAIL("ls failed on restored domain")
    1.71      
    1.72 -    run = console.runCmd("cat /mnt/foo | grep bar")
    1.73 +    run = console.runCmd("cat /mnt/a/foo")
    1.74 +    if run["return"] != 0:
    1.75 +        FAIL("Unable to read from block device hda1")
    1.76 +    if not re.search("hda1", run["output"]):
    1.77 +        FAIL("Failed to read correct data from hda1")
    1.78 +
    1.79 +    run = console.runCmd("cat /mnt/b/foo")
    1.80      if run["return"] != 0:
    1.81 -        FAIL("Unable to read from block device")
    1.82 +        FAIL("Unable to read from block device hdb2")
    1.83 +    if not re.search("hdb2", run["output"]):
    1.84 +        FAIL("Failed to read correct data from hdb2")
    1.85 +
    1.86 +    run = console.runCmd("ifconfig")
    1.87 +    if not re.search("eth0", run["output"]):
    1.88 +        FAIL("DomU's eth0 disappeared")
    1.89 +    if not re.search("169.254.0.1", run["output"]):
    1.90 +        FAIL("DomU's eth0 lost its IP")
    1.91 +    if not re.search("eth1", run["output"]):
    1.92 +        FAIL("DomU's eth1 disappeared")
    1.93 +    if not re.search("169.254.1.1", run["output"]):
    1.94 +        FAIL("DomU's eth1 lost its IP")
    1.95 +    if not re.search("Loopback", run["output"]):
    1.96 +        FAIL("DomU's lo disappeared")
    1.97 +    if not re.search("127.0.0.1", run["output"]):
    1.98 +        FAIL("DomU's lo lost its IP")
    1.99  
   1.100  except ConsoleError, e:
   1.101      FAIL(str(e))