From ff5c133cb0f548851a8d276a31c7f38bcc9c5522 Mon Sep 17 00:00:00 2001 From: chinmay Date: Wed, 4 Jun 2014 20:44:06 +0530 Subject: [PATCH] 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 --- ceilometer/compute/virt/vmware/inspector.py | 14 ++++++++------ .../tests/compute/virt/vmware/test_inspector.py | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ceilometer/compute/virt/vmware/inspector.py b/ceilometer/compute/virt/vmware/inspector.py index 46f83d4e9..32c66fb83 100644 --- a/ceilometer/compute/virt/vmware/inspector.py +++ b/ceilometer/compute/virt/vmware/inspector.py @@ -17,7 +17,6 @@ from oslo.config import cfg from oslo.vmware import api -from oslo.vmware import vim from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.compute.virt.vmware import vsphere_operations @@ -43,7 +42,12 @@ OPTS = [ cfg.FloatOpt('task_poll_interval', default=0.5, 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:///vimService.wsdl. ' + 'Optional over-ride to default location for bug ' + 'work-arounds'), ] cfg.CONF.register_group(opt_group) @@ -60,15 +64,13 @@ VC_DISK_WRITE_REQUESTS_RATE_CNTR = "disk:numberWriteAveraged:average" def get_api_session(): - hostIp = cfg.CONF.vmware.host_ip - wsdl_loc = vim.Vim._get_wsdl_loc("https", hostIp) api_session = api.VMwareAPISession( - hostIp, + cfg.CONF.vmware.host_ip, cfg.CONF.vmware.host_username, cfg.CONF.vmware.host_password, cfg.CONF.vmware.api_retry_count, cfg.CONF.vmware.task_poll_interval, - wsdl_loc=wsdl_loc) + wsdl_loc=cfg.CONF.vmware.wsdl_location) return api_session diff --git a/ceilometer/tests/compute/virt/vmware/test_inspector.py b/ceilometer/tests/compute/virt/vmware/test_inspector.py index 56b1f3518..d5ee4c85e 100644 --- a/ceilometer/tests/compute/virt/vmware/test_inspector.py +++ b/ceilometer/tests/compute/virt/vmware/test_inspector.py @@ -31,7 +31,6 @@ class TestVsphereInspection(test.BaseTestCase): api_session = api.VMwareAPISession("test_server", "test_user", "test_password", 0, None, create_session=False) - api_session._vim = mock.MagicMock() vsphere_inspector.get_api_session = mock.Mock( return_value=api_session) self._inspector = vsphere_inspector.VsphereInspector()