os-xenapi: Fix configure driver creating issue

In pooled environment, there would be an error when we create a
VM with configure driver on slave hosts. It is happened because
the streaming connection is created between slave compute node and
master Dom0. Change the connection back to slave Dom0 to fix this
error.

Change-Id: I02a740be3acf8973b6a324cf3563e427fc11534b
This commit is contained in:
naichuans 2017-09-18 05:45:29 +00:00
parent e2f11239e8
commit 7dce682e2a
2 changed files with 7 additions and 4 deletions

View File

@ -88,8 +88,9 @@ class XenAPISession(object):
self.host_checked = False
self.is_slave = False
self.ip = self._get_ip_from_url(url)
self.url = self._create_first_session(url, user, pw)
self._populate_session_pool(self.url, user, pw)
self.url = url
self.master_url = self._create_first_session(url, user, pw)
self._populate_session_pool(self.master_url, user, pw)
self.host_ref = self._get_host_ref(self.ip)
self.host_uuid = self._get_host_uuid()
self.product_version, self.product_brand = \

View File

@ -101,7 +101,8 @@ class SessionTestCase(base.TestCase):
mock_gethostbyname.assert_called_with(fake_ip)
self.assertEqual('fake_host_ref', xenapi_sess.host_ref)
self.assertEqual('fake_host_uuid', xenapi_sess.host_uuid)
self.assertEqual('http://fake_master_url', xenapi_sess.url)
self.assertEqual('http://fake_master_url', xenapi_sess.master_url)
self.assertEqual(fake_url, xenapi_sess.url)
@mock.patch.object(session.XenAPISession, '_verify_plugin_version')
@mock.patch.object(session.XenAPISession, '_get_platform_version')
@ -142,7 +143,8 @@ class SessionTestCase(base.TestCase):
mock_gethostbyname.assert_called_with(fake_host_name)
self.assertEqual('fake_host_ref', xenapi_sess.host_ref)
self.assertEqual('fake_host_uuid', xenapi_sess.host_uuid)
self.assertEqual('http://fake_master_url', xenapi_sess.url)
self.assertEqual('http://fake_master_url', xenapi_sess.master_url)
self.assertEqual(fake_url, xenapi_sess.url)
@mock.patch.object(session.XenAPISession, '_verify_plugin_version')
@mock.patch.object(session.XenAPISession, '_get_platform_version')