Add log output of "x-openstack-request-id" from nova
This patch enables ceilometer to output 'x-openstack-request-id'/'x-compute-request-id' of nova's responses to the log. And it also enables ceilometer to output request headers, request parameters, other response headers and a response body to the log when ceilometer calls nova. DocImpact: There is a new configuration option 'nova_http_log_debug' in ceilometer.nova_client Change-Id: Ic7e5301e46ac45597721f4a9b41c38f8c4ff0d14 Closes-bug: #1332060
This commit is contained in:
parent
0ecfe09075
commit
6403c8562b
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user