Fixes ceilometer-compute service start failure

Currently ceilometer-compute service is failing to start in the
'vmware' region, because of the additional parameter 'port', is
added to the oslo.vmware _get_wsdl_loc method.

This patch fixes it by not calling the private method _get_wsdl_loc,
avoiding the mismatch in the method call. Additional optional
'wsdl_location' is added to over-ride to default location for bug
work-arounds.

Test cases are not added, since the changed method just calls the
oslo.vmware and method is already mocked in the setUp of the
class TestVsphereInspection.

Change-Id: Ib70092c1ccb14421701acdf8ff4a3805becbeef4
Closes-Bug: #1326230
This commit is contained in:
chinmay 2014-06-04 20:44:06 +05:30
parent b19c138295
commit ff5c133cb0
2 changed files with 8 additions and 7 deletions

View File

@ -17,7 +17,6 @@
from oslo.config import cfg from oslo.config import cfg
from oslo.vmware import api from oslo.vmware import api
from oslo.vmware import vim
from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.compute.virt.vmware import vsphere_operations from ceilometer.compute.virt.vmware import vsphere_operations
@ -43,7 +42,12 @@ OPTS = [
cfg.FloatOpt('task_poll_interval', cfg.FloatOpt('task_poll_interval',
default=0.5, default=0.5,
help='Sleep time in seconds for polling an ongoing async ' help='Sleep time in seconds for polling an ongoing async '
'task') 'task'),
cfg.StrOpt('wsdl_location',
help='Optional vim service WSDL location '
'e.g http://<server>/vimService.wsdl. '
'Optional over-ride to default location for bug '
'work-arounds'),
] ]
cfg.CONF.register_group(opt_group) cfg.CONF.register_group(opt_group)
@ -60,15 +64,13 @@ VC_DISK_WRITE_REQUESTS_RATE_CNTR = "disk:numberWriteAveraged:average"
def get_api_session(): def get_api_session():
hostIp = cfg.CONF.vmware.host_ip
wsdl_loc = vim.Vim._get_wsdl_loc("https", hostIp)
api_session = api.VMwareAPISession( api_session = api.VMwareAPISession(
hostIp, cfg.CONF.vmware.host_ip,
cfg.CONF.vmware.host_username, cfg.CONF.vmware.host_username,
cfg.CONF.vmware.host_password, cfg.CONF.vmware.host_password,
cfg.CONF.vmware.api_retry_count, cfg.CONF.vmware.api_retry_count,
cfg.CONF.vmware.task_poll_interval, cfg.CONF.vmware.task_poll_interval,
wsdl_loc=wsdl_loc) wsdl_loc=cfg.CONF.vmware.wsdl_location)
return api_session return api_session

View File

@ -31,7 +31,6 @@ class TestVsphereInspection(test.BaseTestCase):
api_session = api.VMwareAPISession("test_server", "test_user", api_session = api.VMwareAPISession("test_server", "test_user",
"test_password", 0, None, "test_password", 0, None,
create_session=False) create_session=False)
api_session._vim = mock.MagicMock()
vsphere_inspector.get_api_session = mock.Mock( vsphere_inspector.get_api_session = mock.Mock(
return_value=api_session) return_value=api_session)
self._inspector = vsphere_inspector.VsphereInspector() self._inspector = vsphere_inspector.VsphereInspector()