mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
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>
55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
#!/usr/bin/python
|
|
#============================================================================
|
|
# This library is free software; you can redistribute it and/or
|
|
# modify it under the terms of version 2.1 of the GNU Lesser General Public
|
|
# License as published by the Free Software Foundation.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with this library; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#============================================================================
|
|
# Copyright (C) 2006 XenSource Ltd.
|
|
# Copyright (C) 2006 IBM Corporation
|
|
# Copyright (C) 2009 flonatel GmbH & Co. KG
|
|
#============================================================================
|
|
|
|
import atexit
|
|
import os
|
|
import sys
|
|
from XmTestLib import *
|
|
from xen.xm import main as xmmain
|
|
from xen.xm import XenAPI
|
|
from xen.xm.opts import OptionError
|
|
from types import DictType
|
|
import xml.dom.minidom
|
|
|
|
sessions=[]
|
|
|
|
def connect(*args):
|
|
creds = ("", "")
|
|
uri = "http://localhost:9363"
|
|
|
|
try:
|
|
session = XenAPI.Session(uri)
|
|
except:
|
|
raise OptionError("Could not create XenAPI session with Xend." \
|
|
"URI=%s" % uri)
|
|
try:
|
|
session.login_with_password(*creds)
|
|
except:
|
|
raise OptionError("Could not login to Xend. URI=%s" % uri)
|
|
def logout():
|
|
try:
|
|
for s in sessions:
|
|
s.xenapi.session.logout()
|
|
except:
|
|
pass
|
|
sessions.append(session)
|
|
atexit.register(logout)
|
|
return session
|