Support for Xen-API authenticated session
PATCH 1/1 Support for Xen-API authenticated session
I am adding a tool 'xapi-setup.py' to the xm-test suite for being able to setup authentication credentials needed for automatically running Xen-API - related tests. The username and password information is stored in cleartext in lib/XmTestLib/xapi_auth.py.
In the one test using the Xen-API I add another check for availability of the python PAM module. The test is skipped if the module is not available on the system.
Signed-off-by Stefan Berger <[email protected]>
xen-unstable.hg/tools/xm-test/lib/XmTestLib/xapi.py +6 -5
@@ -24,9 +24,6 @@ from xen.util.xmlrpclib2 import ServerPr from types import DictType -XAPI_DEFAULT_LOGIN = " " -XAPI_DEFAULT_PASSWORD = " " - class XenAPIError(Exception): pass
@@ -58,8 +55,12 @@ def _connect(*args): global _server, _session, _initialised if not _initialised: _server = ServerProxy('httpu:///var/run/xend/xen-api.sock') - login = XAPI_DEFAULT_LOGIN - password = XAPI_DEFAULT_PASSWORD + try: + from XmTestLib import xapi_auth + except: + FAIL("Missing Xen-API credentials. Run xapi-setup.py!") + login = xapi_auth.XAPI_DEFAULT_LOGIN + password = xapi_auth.XAPI_DEFAULT_PASSWORD creds = (login, password) _session = execute(_server.session.login_with_password, *creds) _initialised = True
xen-unstable.hg/tools/xm-test/tests/vtpm/09_vtpm-xapi.py +4 -0
@@ -68,6 +68,10 @@ def do_test(): domain.destroy() +try: + import PAM +except ImportError: + SKIP("Skipping test. Python-PAM module not found.") try: do_test()
xen-unstable.hg/tools/xm-test/xapi-setup.py new file +41 -0
41 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel