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
This commit is contained in:
Santhosh Fernandes 2017-06-28 10:39:42 +05:30
parent 079990fe8c
commit 94a8d5715a
5 changed files with 26 additions and 4 deletions

View File

@ -72,6 +72,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

@ -183,7 +183,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

@ -107,6 +107,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

@ -42,6 +42,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)
@ -50,15 +51,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.