Option to enable provisioning status sync with neutron db

In large build situations, nova can be slow to build VMs, this means that the
default 100 second timeout may expire before the final status has been updated
in the neutron database. This patch will emit provisioning status to be sync
with neutron db

Change-Id: If6c0b81630fd1911518792d9947f8622f065ff4e
(cherry picked from commit 94a8d5715a)
This commit is contained in:
Santhosh Fernandes 2017-06-28 10:39:42 +05:30
parent 66fe6d327f
commit fbfb3c8f54
5 changed files with 26 additions and 4 deletions

View File

@ -59,6 +59,9 @@
# noop_event_streamer
# event_streamer_driver = noop_event_streamer
# Enable provisioning status sync with neutron db
# sync_provisioning_status = False
[keystone_authtoken]
# This group of config options are imported from keystone middleware. Thus the
# option names should match the names declared in the middleware.

View File

@ -136,7 +136,9 @@ healthmanager_opts = [
'don\'t need to sync the database or are running '
'octavia in stand alone mode use the '
'noop_event_streamer'),
default='noop_event_streamer')]
default='noop_event_streamer'),
cfg.BoolOpt('sync_provisioning_status', default=False,
help=_("Enable provisioning status sync with neutron db"))]
oslo_messaging_opts = [
cfg.StrOpt('topic'),

View File

@ -77,6 +77,7 @@ DEGRADED = 'DEGRADED'
ERROR = 'ERROR'
NO_MONITOR = 'NO_MONITOR'
OPERATING_STATUS = 'operating_status'
PROVISIONING_STATUS = 'provisioning_status'
SUPPORTED_OPERATING_STATUSES = (ONLINE, OFFLINE, DEGRADED, ERROR, NO_MONITOR)
AMPHORA_VM = 'VM'

View File

@ -46,6 +46,7 @@ class UpdateHealthDb(object):
self.loadbalancer_repo = repo.LoadBalancerRepository()
self.member_repo = repo.MemberRepository()
self.pool_repo = repo.PoolRepository()
self.sync_prv_status = cfg.CONF.health_manager.sync_provisioning_status
def emit(self, info_type, info_id, info_obj):
cnt = update_serializer.InfoContainer(info_type, info_id, info_obj)
@ -54,15 +55,22 @@ class UpdateHealthDb(object):
def _update_status_and_emit_event(self, session, repo, entity_type,
entity_id, new_op_status):
entity = repo.get(session, id=entity_id)
message = {}
if entity.operating_status.lower() != new_op_status.lower():
LOG.debug("%s %s status has changed from %s to "
"%s. Updating db and sending event.",
entity_type, entity_id, entity.operating_status,
new_op_status)
repo.update(session, entity_id, operating_status=new_op_status)
self.emit(
entity_type, entity_id,
{constants.OPERATING_STATUS: new_op_status})
message.update({constants.OPERATING_STATUS: new_op_status})
if self.sync_prv_status:
LOG.debug("%s %s provisioning_status %s. Updating db and sending"
" event.", entity_type, entity_id,
entity.provisioning_status)
message.update(
{constants.PROVISIONING_STATUS: entity.provisioning_status})
if message:
self.emit(entity_type, entity_id, message)
def update_health(self, health):
"""This function is to update db info based on amphora status

View File

@ -0,0 +1,8 @@
---
upgrade:
- Added option 'sync_provisioning_status' to enable synchronizing provisioning status
of loadbalancers with the neutron-lbaas database. Enabling this option will queue one
additional message per amphora every heartbeat interval.
fixes:
- Resolved an issue that could cause provisioning status to become out of sync between
neutron-lbaas and octavia during high load.