aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/lib
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-08-20 10:30:53 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-08-20 10:30:53 +0100
commitf0321cbffa61f08db52799a10d6d85ab59a238e0 (patch)
treee2f9e8d62fd6d79fa4f33cdbf51a85d34ab781c4 /tools/xm-test/lib
parent1ef2f79d046aa91462f15e10adc4aee09f8cdec8 (diff)
downloadxen-f0321cbffa61f08db52799a10d6d85ab59a238e0.tar.gz
xen-f0321cbffa61f08db52799a10d6d85ab59a238e0.tar.bz2
xen-f0321cbffa61f08db52799a10d6d85ab59a238e0.zip
Fix xapi xm-tests.
There were a couple of small bugs in the xapi xm-test: o outdated XenAPI calls were removed from testcase (02_xapi-vbd_basic) o minor problem with XendLocalStorageRepository is fixed (missed list_images() function - which is moved from the XenQCoWStroageRepo to the common base class XendStorageRepository) which was detected running 02_xapi-vbd_basic. o XenAPI session handling and connecting is fixed. o 03_xapi-network_pos was rewritten and now uses XenAPI. Signed-off-by: Andreas Florath <xen@flonatel.org>
Diffstat (limited to 'tools/xm-test/lib')
-rw-r--r--tools/xm-test/lib/XmTestLib/XenAPIDomain.py3
-rw-r--r--tools/xm-test/lib/XmTestLib/XenDevice.py3
-rw-r--r--tools/xm-test/lib/XmTestLib/xapi.py25
3 files changed, 11 insertions, 20 deletions
diff --git a/tools/xm-test/lib/XmTestLib/XenAPIDomain.py b/tools/xm-test/lib/XmTestLib/XenAPIDomain.py
index 31b91eed68..3c5310f061 100644
--- a/tools/xm-test/lib/XmTestLib/XenAPIDomain.py
+++ b/tools/xm-test/lib/XmTestLib/XenAPIDomain.py
@@ -94,9 +94,8 @@ class XenAPIDomain(XenDomain):
self.netEnv = "bridge"
self.session = xapi.connect()
- session = self.session
try:
- self.vm_uuid = session.xenapi.VM.create(self.config.getOpts())
+ self.vm_uuid = self.session.xenapi.VM.create(self.config.getOpts())
addXAPIDomain(self.vm_uuid)
except:
raise DomainError("Could not create VM config file for "
diff --git a/tools/xm-test/lib/XmTestLib/XenDevice.py b/tools/xm-test/lib/XmTestLib/XenDevice.py
index 688b39e543..d51ee28ef7 100644
--- a/tools/xm-test/lib/XmTestLib/XenDevice.py
+++ b/tools/xm-test/lib/XmTestLib/XenDevice.py
@@ -244,6 +244,9 @@ class XenNetDevice(XenDevice):
def getNetwork(self):
return self.network
+ def get_netmask(self):
+ return self.netmask
+
def setNetDevIP(self, ip=None):
# Function to set a new IP for NetDevice.
if NETWORK_IP_RANGE == "dhcp":
diff --git a/tools/xm-test/lib/XmTestLib/xapi.py b/tools/xm-test/lib/XmTestLib/xapi.py
index 773b3c1739..de552ef171 100644
--- a/tools/xm-test/lib/XmTestLib/xapi.py
+++ b/tools/xm-test/lib/XmTestLib/xapi.py
@@ -15,6 +15,7 @@
#============================================================================
# Copyright (C) 2006 XenSource Ltd.
# Copyright (C) 2006 IBM Corporation
+# Copyright (C) 2009 flonatel GmbH & Co. KG
#============================================================================
import atexit
@@ -27,33 +28,21 @@ from xen.xm.opts import OptionError
from types import DictType
import xml.dom.minidom
-def get_login_pwd():
- if xmmain.serverType == xmmain.SERVER_XEN_API:
- try:
- login, password = xmmain.parseAuthentication()
- return (login, password)
- except:
- raise OptionError("Configuration for login/pwd not found. "
- "Need to run xapi-setup.py?")
- raise OptionError("Xm configuration file not using Xen-API for "
- "communication with xend.")
-
sessions=[]
def connect(*args):
+ creds = ("", "")
+ uri = "http://localhost:9363"
+
try:
- creds = get_login_pwd()
- except Exception, e:
- FAIL("%s" % str(e))
- try:
- session = XenAPI.Session(xmmain.serverURI)
+ session = XenAPI.Session(uri)
except:
raise OptionError("Could not create XenAPI session with Xend." \
- "URI=%s" % xmmain.serverURI)
+ "URI=%s" % uri)
try:
session.login_with_password(*creds)
except:
- raise OptionError("Could not login to Xend. URI=%s" % xmmain.serverURI)
+ raise OptionError("Could not login to Xend. URI=%s" % uri)
def logout():
try:
for s in sessions: