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-changelog

[Xen-changelog] Fix xm-test network tests to work with hvm support enabl

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix xm-test network tests to work with hvm support enabled.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Feb 2006 02:26:08 +0000
Delivery-date: Fri, 10 Feb 2006 02:38:28 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User adam@xxxxxxxxxxx
# Node ID 324caad9e1457ab4ca020c51ac5a392b2d0392da
# Parent  e2755215a1e59751360e131bfccb081fdff94525
Fix xm-test network tests to work with hvm support enabled.

diff -r e2755215a1e5 -r 324caad9e145 tools/xm-test/lib/XmTestLib/Network.py
--- a/tools/xm-test/lib/XmTestLib/Network.py    Fri Feb 10 01:04:24 2006
+++ b/tools/xm-test/lib/XmTestLib/Network.py    Fri Feb 10 01:05:26 2006
@@ -25,6 +25,7 @@
 
 from Test import *
 from Xm import *
+from config import *
 
 class NetworkError(Exception):
     def __init__(self, msg):
@@ -36,6 +37,9 @@
 def undo_dom0_alias(eth, ip):
     traceCommand("ip addr del " + ip + " dev " + eth)
 
+def net_from_ip(ip):
+    return ip[:ip.rfind(".")] + ".0/24"
+    
 class XmNetwork:
 
     def __init__(self):
@@ -56,14 +60,21 @@
         domnum = int(dom[len("dom"):])
         return "169.254."+ str(ethnum+153) + "." + str(domnum+10)
 
-    def ip(self, dom, interface, todomname=None, toeth=None):
+    def ip(self, dom, interface, todomname=None, toeth=None, bridge=None):
         newip = self.calc_ip_address(dom, interface)
 
         # If the testcase is going to talk to dom0, we need to add an 
         # IP address in the proper subnet
         if dom == "dom0":
-            # The domain's vif is a convenient place to add to
-            vifname = "vif" + str(domid(todomname)) + "." + toeth[3:]
+           if ENABLE_HVM_SUPPORT:
+               # HVM uses ioemu which uses a bridge
+               if not bridge:
+                   SKIP("no bridge supplied")
+               else:
+                   vifname = bridge
+           else:
+                # The domain's vif is a convenient place to add to
+                vifname = "vif" + str(domid(todomname)) + "." + toeth[3:]
 
             # register the exit handler FIRST, just in case
             atexit.register(undo_dom0_alias, vifname, newip)
@@ -73,6 +84,15 @@
                                               " dev " + vifname)
             if status:
                 SKIP("\"ip addr add\" failed")
+
+           if ENABLE_HVM_SUPPORT:
+               # We need to add a route to the bridge device
+               network = net_from_ip(newip)
+               status, output = traceCommand("ip route add " + network + " dev 
" + vifname + " scope link")
+
+                if status:
+                   SKIP("\"ip route add\" failed")
+
         return newip
 
     def mask(self, dom, interface):
diff -r e2755215a1e5 -r 324caad9e145 
tools/xm-test/tests/network/02_network_local_ping_pos.py
--- a/tools/xm-test/tests/network/02_network_local_ping_pos.py  Fri Feb 10 
01:04:24 2006
+++ b/tools/xm-test/tests/network/02_network_local_ping_pos.py  Fri Feb 10 
01:05:26 2006
@@ -28,7 +28,11 @@
 mask = Net.mask("dom1", "eth0")
 
 # Fire up a guest domain w/1 nic
-config = {"vif" : ['ip=%s' % ip]}
+if ENABLE_HVM_SUPPORT:
+    config = {"vif" : ['type=ioemu']}
+else:
+    config = {"vif" : ['ip=%s' % ip ]}
+
 domain = XmTestDomain(extraConfig=config)
 try:
     domain.start()
diff -r e2755215a1e5 -r 324caad9e145 
tools/xm-test/tests/network/05_network_dom0_ping_pos.py
--- a/tools/xm-test/tests/network/05_network_dom0_ping_pos.py   Fri Feb 10 
01:04:24 2006
+++ b/tools/xm-test/tests/network/05_network_dom0_ping_pos.py   Fri Feb 10 
01:05:26 2006
@@ -31,7 +31,13 @@
         FAIL(str(e))
 
 # Fire up a guest domain w/1 nic
-config = {"vif"  : ["ip=%s" % ip]}
+if ENABLE_HVM_SUPPORT:
+    brg = "xenbr0"
+    config = {"vif" : ['type=ioemu, bridge=%s' % brg]}
+else:
+    config = {"vif" : ['ip=%s' % ip ]}
+    brg = None
+
 domain = XmTestDomain(extraConfig=config)
 try:
     domain.start()
@@ -52,7 +58,7 @@
 
 try:
     # Add a suitable dom0 IP address 
-    dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0")
+    dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", 
bridge=brg)
 except NetworkError, e:
         FAIL(str(e))
 
diff -r e2755215a1e5 -r 324caad9e145 
tools/xm-test/tests/network/11_network_domU_ping_pos.py
--- a/tools/xm-test/tests/network/11_network_domU_ping_pos.py   Fri Feb 10 
01:04:24 2006
+++ b/tools/xm-test/tests/network/11_network_domU_ping_pos.py   Fri Feb 10 
01:05:26 2006
@@ -18,7 +18,11 @@
 from XmTestLib import *
 
 def netDomain(ip):
-    config = {"vif"  : ["ip=%s" % ip]}
+    if ENABLE_HVM_SUPPORT:
+        config = {"vif" : ['type=ioemu']}
+    else:
+        config = {"vif" : ['ip=%s' % ip ]}
+
     dom = XmTestDomain(extraConfig=config)
     try:
         dom.start()

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix xm-test network tests to work with hvm support enabled., Xen patchbot -unstable <=