]> xenbits.xensource.com Git - xen.git/commitdiff
xm-test: Allow dom0 network interface used in tests to be overriden
authorJames Bulpin <james@xensource.com>
Sun, 12 Aug 2007 15:09:13 +0000 (16:09 +0100)
committerJames Bulpin <james@xensource.com>
Sun, 12 Aug 2007 15:09:13 +0000 (16:09 +0100)
  ./configure --with-dom0-intf=<intf>  (default vif0.0)

tools/xm-test/configure.ac
tools/xm-test/lib/XmTestLib/NetConfig.py
tools/xm-test/lib/XmTestLib/XenDevice.py
tools/xm-test/lib/XmTestLib/config.py.in

index d3c651a250aa2aaedf9ff4aecde2b5a5bf931cb3..14aee142b7b7e8f4d5166657703f0ea034d987f3 100644 (file)
@@ -85,6 +85,13 @@ AC_SUBST(NET_IP_RANGE)
 AC_SUBST(NETWORK_ADDRESS)
 AC_SUBST(NETMASK)
 
+DOM0_INTF="vif0.0"
+AC_ARG_WITH(dom0-intf,
+        [ --with-dom0-intf=intf Set dom0 interface name [[default="vif0.0"]]],
+        [ DOM0_INTF="$withval" ])
+
+AC_SUBST(DOM0_INTF)
+
 AC_ARG_WITH(hvm-kernel,
       [[  --with-hvm-kernel=kernel       Use this kernel for hvm disk.img testing]],
       HVMKERNEL=$withval,
index 652db573f6e5dd844c4eb2f5dc345d1abfeb58d9..fe0cfb429f2c118181a825b5eeca47f3e5e7a415 100644 (file)
@@ -104,8 +104,8 @@ class NetConfig:
             if self.network == "169.254.0.0":
                 checkZeroconfAddresses()
 
-            # Clean out any aliases in the network range for vif0.0. If
-            # an alias exists, a test xendevice add command could fail.
+            # Clean out any aliases in the network range for dom0's interface.
+            # If an alias exists, a test xendevice add command could fail.
             if NETWORK_IP_RANGE != "dhcp":
                 self.__cleanDom0Aliases()
 
@@ -139,20 +139,22 @@ class NetConfig:
 
     def __cleanDom0Aliases(self):
         # Remove any aliases within the supplied network IP range on dom0
-        scmd = 'ip addr show dev vif0.0'
+        scmd = 'ip addr show dev %s' % (DOM0_INTF)
 
         status, output = traceCommand(scmd)
         if status:
-            raise NetworkError("Failed to show vif0.0 aliases: %d" % status)
+            raise NetworkError("Failed to show %s aliases: %d" %
+                               (DOM0_INTF, status))
 
         lines = output.split("\n")
         for line in lines:
             ip = re.search('(\d+\.\d+\.\d+\.\d+)', line)
             if ip and self.isIPInRange(ip.group(1)) == True:
-                dcmd = 'ip addr del %s dev vif0.0' % ip.group(1)
+                dcmd = 'ip addr del %s dev %s' % (ip.group(1), DOM0_INTF)
                 dstatus, doutput = traceCommand(dcmd)
                 if dstatus:
-                    raise NetworkError("Failed to remove vif0.0 aliases: %d" % status)
+                    raise NetworkError("Failed to remove %s aliases: %d" %
+                                       (DOM0_INTF, status))
                 
     def getNetEnv(self):
         return self.netenv
index d899a5e4c851cc295755927fa6ac1aba179e3f13..79dfbfc73af1e00e7ed419e3eb6cab29baa13be9 100644 (file)
@@ -214,7 +214,7 @@ class XenNetDevice(XenDevice):
     def removeDevice(self):
         self.releaseNetDevIP()
 
-    def addDom0AliasCmd(self, dev="vif0.0"):
+    def addDom0AliasCmd(self, dev=DOM0_INTF):
         # Method to add start and remove dom0 alias cmds
         acmd = 'ip addr add %s dev %s' % (self.dom0_alias_ip, dev)
         rcmd = 'ip addr del %s dev %s' % (self.dom0_alias_ip, dev) 
index 986eb36aff0f6fa63df5a4496d07aba47de7b823..21c6cc5585194838def32309285d5687852e1043 100644 (file)
@@ -4,3 +4,4 @@ ENABLE_HVM_SUPPORT = @ENABLE_HVM@
 NETWORK_IP_RANGE = "@NET_IP_RANGE@"
 NETWORK = "@NETWORK_ADDRESS@"
 NETMASK = "@NETMASK@"
+DOM0_INTF = "@DOM0_INTF@"