diff --git a/ceilometer/nova_client.py b/ceilometer/nova_client.py index e8b67b8ef..a7421a6d9 100644 --- a/ceilometer/nova_client.py +++ b/ceilometer/nova_client.py @@ -21,6 +21,12 @@ from oslo.config import cfg from ceilometer.openstack.common import log +nova_opts = [ + cfg.BoolOpt('nova_http_log_debug', + default=False, + help='Allow novaclient\'s debug log output.'), +] +cfg.CONF.register_opts(nova_opts) cfg.CONF.import_group('service_credentials', 'ceilometer.service') LOG = log.getLogger(__name__) @@ -55,6 +61,7 @@ class Client(object): endpoint_type=conf.os_endpoint_type, cacert=conf.os_cacert, insecure=conf.insecure, + http_log_debug=cfg.CONF.nova_http_log_debug, no_cache=True) def _with_flavor_and_image(self, instances): diff --git a/ceilometer/tests/test_novaclient.py b/ceilometer/tests/test_novaclient.py index b6c21c332..3606baffe 100644 --- a/ceilometer/tests/test_novaclient.py +++ b/ceilometer/tests/test_novaclient.py @@ -20,6 +20,7 @@ import mock import novaclient from ceilometer import nova_client +from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common.fixture import mockpatch from ceilometer.openstack.common import test @@ -37,6 +38,7 @@ class TestNovaClient(test.BaseTestCase): self.useFixture(mockpatch.PatchObject( self.nv.nova_client.images, 'get', side_effect=self.fake_images_get)) + self.CONF = self.useFixture(config.Config()).conf def fake_flavors_get(self, *args, **kwargs): self._flavors_count += 1 @@ -233,3 +235,8 @@ class TestNovaClient(test.BaseTestCase): self.assertIsNone(instance.kernel_id) self.assertIsNone(instance.image) self.assertIsNone(instance.ramdisk_id) + + def test_with_nova_http_log_debug(self): + self.CONF.set_override("nova_http_log_debug", True) + self.nv = nova_client.Client() + self.assertTrue(self.nv.nova_client.client.http_log_debug) diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst index e6a41fb02..ea81502e0 100644 --- a/doc/source/configuration.rst +++ b/doc/source/configuration.rst @@ -42,6 +42,7 @@ control_exchange ceilometer AMQP exch database_connection mongodb://localhost:27017/ceilometer Database connection string metering_api_port 8777 The port for the ceilometer API server reseller_prefix AUTH\_ Prefix used by swift for reseller token +nova_http_log_debug False Log request/response parameters between nova and ceilometer =============================== ==================================== ============================================================== Service polling authentication