aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test
diff options
context:
space:
mode:
authorJames Bulpin <james@xensource.com>2007-08-12 16:09:13 +0100
committerJames Bulpin <james@xensource.com>2007-08-12 16:09:13 +0100
commit9119ea5153b5feb9aee3ce8d66f909f529f443e9 (patch)
tree09c3cc725ebb50a296c7fa5d6fcbfae697fd46c8 /tools/xm-test
parent0067e950074566bfc542ce3cf640c4546217d915 (diff)
downloadxen-9119ea5153b5feb9aee3ce8d66f909f529f443e9.tar.gz
xen-9119ea5153b5feb9aee3ce8d66f909f529f443e9.tar.bz2
xen-9119ea5153b5feb9aee3ce8d66f909f529f443e9.zip
xm-test: Allow dom0 network interface used in tests to be overriden
./configure --with-dom0-intf=<intf> (default vif0.0)
Diffstat (limited to 'tools/xm-test')
-rw-r--r--tools/xm-test/configure.ac7
-rw-r--r--tools/xm-test/lib/XmTestLib/NetConfig.py14
-rw-r--r--tools/xm-test/lib/XmTestLib/XenDevice.py2
-rw-r--r--tools/xm-test/lib/XmTestLib/config.py.in1
4 files changed, 17 insertions, 7 deletions
diff --git a/tools/xm-test/configure.ac b/tools/xm-test/configure.ac
index d3c651a250..14aee142b7 100644
--- a/tools/xm-test/configure.ac
+++ b/tools/xm-test/configure.ac
@@ -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,
diff --git a/tools/xm-test/lib/XmTestLib/NetConfig.py b/tools/xm-test/lib/XmTestLib/NetConfig.py
index 652db573f6..fe0cfb429f 100644
--- a/tools/xm-test/lib/XmTestLib/NetConfig.py
+++ b/tools/xm-test/lib/XmTestLib/NetConfig.py
@@ -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
diff --git a/tools/xm-test/lib/XmTestLib/XenDevice.py b/tools/xm-test/lib/XmTestLib/XenDevice.py
index d899a5e4c8..79dfbfc73a 100644
--- a/tools/xm-test/lib/XmTestLib/XenDevice.py
+++ b/tools/xm-test/lib/XmTestLib/XenDevice.py
@@ -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)
diff --git a/tools/xm-test/lib/XmTestLib/config.py.in b/tools/xm-test/lib/XmTestLib/config.py.in
index 986eb36aff..21c6cc5585 100644
--- a/tools/xm-test/lib/XmTestLib/config.py.in
+++ b/tools/xm-test/lib/XmTestLib/config.py.in
@@ -4,3 +4,4 @@ ENABLE_HVM_SUPPORT = @ENABLE_HVM@
NETWORK_IP_RANGE = "@NET_IP_RANGE@"
NETWORK = "@NETWORK_ADDRESS@"
NETMASK = "@NETMASK@"
+DOM0_INTF = "@DOM0_INTF@"