Skip to contentSkip to conversation

hvm network test fixes

PATCH Applied Adam Wendt 4 participants 4 messages Feb 1, 2006 – Jun 6, 2019

lore
Share & tools
lore
#1 lore raw
In reply to Adam Wendt

AW> the hvm image doesn't appear to have support for ping -f so I'll AW> need to find another solution, any ideas?

We put hping is in the disk image for network testing, so perhaps it can be of use? It looks like you can at least specify the interval between pings to be a small number of microseconds, with -i uX.

Signature · 4 lines
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: [email protected]
#2 lore raw
Quoted 7 lines · Dan Smith

AW> the hvm image doesn't appear to have support for ping -f so I'll AW> need to find another solution, any ideas?

We put hping is in the disk image for network testing, so perhaps it can be of use? It looks like you can at least specify the interval between pings to be a small number of microseconds, with -i uX.

Yep, that was one of the reasons for the hping inclusion..

thanks,
Nivedita

Applied
#3 lore raw
In reply to Adam Wendt
Quoted 7 lines · Adam Wendt

The following patch allows the network tests to pass with hvm support enabled.

More specifically:
02_network_local_ping_pos.py
REASON: ping loopback failed for size 65507. ping eth0 failed for size 65507. (but all other size pings work)

Quoted 7 lines

05_network_dom0_ping_pos.py
REASON: Ping to dom0 failed for size 65507.
(but all other size pings work)

11_network_domU_ping_pos.py
passes 100% (even the large ping, i know the large ping is another bug but is it supposed to work or fail on this test?)

Applied, thank you.

Could you please include a Signed-off-by: line with your patches?

Thanks,

Ewan.

Adam Wendt

author
#0 lore raw

PATCH 1/1 hvm network test fixes

The following patch allows the network tests to pass with hvm support enabled.

More specifically:
02_network_local_ping_pos.py
REASON: ping loopback failed for size 65507. ping eth0 failed for size 65507. (but all other size pings work)

05_network_dom0_ping_pos.py
REASON: Ping to dom0 failed for size 65507.
(but all other size pings work)

11_network_domU_ping_pos.py
passes 100% (even the large ping, i know the large ping is another bug but is it supposed to work or fail on this test?)

Let me know if there's anything I should change in the patch, my next step is to try to build some network tests that put a little strain on the network, the hvm image doesn't appear to have support for ping -f so I'll need to find another solution, any ideas? (Yes I can probably ping -f from outside the domain at it, but would be nice to have something to test the other direction, or even ssh to test that data isn't being corrupted.)

Adam Wendt
IPCoast, Inc.

# HG changeset patch
# User [email protected]
# Node ID 20630fa9c577af094375463c991d06313b2fa97a # Parent 0c94043f5c5b845a2b0731c444aec09ef7a901f4 Fix xm-test network tests to work with hvm support enabled.

tools/xm-test/lib/XmTestLib/Network.py +23 -3
diff -r 0c94043f5c5b -r 20630fa9c577 tools/xm-test/lib/XmTestLib/Network.py
@@ -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):
tools/xm-test/tests/network/02_network_local_ping_pos.py +5 -1
diff -r 0c94043f5c5b -r 20630fa9c577 tools/xm-test/tests/network/02_network_local_ping_pos.py
@@ -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()
tools/xm-test/tests/network/05_network_dom0_ping_pos.py +8 -2
diff -r 0c94043f5c5b -r 20630fa9c577 tools/xm-test/tests/network/05_network_dom0_ping_pos.py
@@ -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))
 
tools/xm-test/tests/network/11_network_domU_ping_pos.py +5 -1
diff -r 0c94043f5c5b -r 20630fa9c577 tools/xm-test/tests/network/11_network_domU_ping_pos.py
@@ -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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel