xenapi: support the session to "unix://local"

When url is "unix://local", xenapi inspector should use specific
api to create the session to xenapi.

Change-Id: I1531c4ab75be7e1d462093dff1ddf0ca4ae4808e
Closes-Bug: 1484764
This commit is contained in:
Qiaowei Ren 2015-08-15 10:34:31 +08:00
parent 3c10d3876e
commit 6ad9203d9b

View File

@ -66,7 +66,8 @@ def get_api_session():
exception = api.Failure(_("Unable to log in to XenAPI "
"(is the Dom0 disk full?)"))
try:
session = api.Session(url)
session = (api.xapi_local() if url == 'unix://local'
else api.Session(url))
with timeout.Timeout(CONF.xenapi.login_timeout, exception):
session.login_with_password(username, password)
except api.Failure as e: