enable swift pollsters poll data for specific region

Currently swift pollsters only poll data from first region, which
is bad for multiple regions scenario.

This patch enables poll swift data for specific region. And improves
log message and promotes the log level to INFO, now it looks like:

    Swift endpoint not found: public endpoint for object-store
    service in RegionTwo region not found

Change-Id: Ifffb33ba1174a1a54f0ce1c4614bcd35d57ea4c3
Closes-Bug: #1584364
(cherry picked from commit 1610935ee3)
This commit is contained in:
ZhiQiang Fan 2016-05-22 08:56:56 +08:00
parent 1c0b83cbbb
commit 7951eb5edf
1 changed files with 5 additions and 3 deletions

View File

@ -25,6 +25,7 @@ import six.moves.urllib.parse as urlparse
from swiftclient import client as swift
from ceilometer.agent import plugin_base
from ceilometer.i18n import _LI
from ceilometer import keystone_client
from ceilometer import sample
@ -72,9 +73,10 @@ class _Base(plugin_base.PollsterBase):
_Base._ENDPOINT = keystone_client.get_service_catalog(
ksclient).url_for(
service_type=cfg.CONF.service_types.swift,
interface=conf.interface)
except exceptions.EndpointNotFound:
LOG.debug("Swift endpoint not found")
interface=conf.interface,
region_name=conf.region_name)
except exceptions.EndpointNotFound as e:
LOG.info(_LI("Swift endpoint not found: %s"), e)
return _Base._ENDPOINT
def _iter_accounts(self, ksclient, cache, tenants):