Distributed Cloud: PTP parameters synchronization.
There are 3 new parameters added to PTP configuration: timestamping mode, transport protocol and delay mechanism. Need to synchronize these parameters in the Distibuted Cloud. Signed-off-by: Alex Kozyrev <alex.kozyrev@windriver.com>
This commit is contained in:
parent
a4cebb85c4
commit
2e3f520442
|
@ -25,11 +25,11 @@ from dcorch.common import consts
|
|||
from dcorch.common import exceptions
|
||||
|
||||
from dcorch.drivers.openstack.cinder_v2 import CinderClient
|
||||
from dcorch.drivers.openstack.fm import FmClient
|
||||
from dcorch.drivers.openstack.keystone_v3 import KeystoneClient
|
||||
from dcorch.drivers.openstack.neutron_v2 import NeutronClient
|
||||
from dcorch.drivers.openstack.nova_v2 import NovaClient
|
||||
from dcorch.drivers.openstack.sysinv_v1 import SysinvClient
|
||||
from dcorch.drivers.openstack.fm import FmClient
|
||||
|
||||
# Gap, in seconds, to determine whether the given token is about to expire
|
||||
STALE_TOKEN_DURATION = 60
|
||||
|
|
|
@ -200,14 +200,20 @@ class SysinvClient(base.DriverBase):
|
|||
return None
|
||||
ptp = ptps[0]
|
||||
|
||||
LOG.debug("get_ptp uuid=%s enabled=%s" % (ptp.uuid, ptp.enabled))
|
||||
LOG.debug("get_ptp uuid=%s enabled=%s mode=%s "
|
||||
"transport=%s mechanism=%s" %
|
||||
(ptp.uuid, ptp.enabled, ptp.mode,
|
||||
ptp.transport, ptp.mechanism))
|
||||
|
||||
return ptp
|
||||
|
||||
def update_ptp(self, enabled):
|
||||
def update_ptp(self, enabled, mode, transport, mechanism):
|
||||
"""Update the ptp configuration for this region
|
||||
|
||||
:param: enabled
|
||||
:param: mode
|
||||
:param: transport
|
||||
:param: mechanism
|
||||
:return: Nothing
|
||||
"""
|
||||
try:
|
||||
|
@ -216,15 +222,23 @@ class SysinvClient(base.DriverBase):
|
|||
LOG.warn("ptp not found %s" % self.region_name)
|
||||
return ptp
|
||||
|
||||
if ptp.enabled != (enabled == "True"):
|
||||
patch = make_sysinv_patch({'enabled': enabled})
|
||||
if ptp.enabled != (enabled == "True") or \
|
||||
ptp.mode != mode or \
|
||||
ptp.transport != transport or \
|
||||
ptp.mechanism != mechanism:
|
||||
patch = make_sysinv_patch({'enabled': enabled},
|
||||
{'mode': mode},
|
||||
{'transport': transport},
|
||||
{'mechanism': mechanism})
|
||||
LOG.info("region={} ptp update uuid={} patch={}".format(
|
||||
self.region_name, ptp.uuid, patch))
|
||||
ptp = self.client.ptp.update(ptp.uuid, patch)
|
||||
else:
|
||||
LOG.info("update_ptp no changes, skip ptp region={} "
|
||||
"update uuid={} enabled={}".format(
|
||||
self.region_name, ptp.uuid, enabled))
|
||||
"update uuid={} enabled={} mode={} "
|
||||
"transport={} mechanism={}".format(
|
||||
self.region_name, ptp.uuid,
|
||||
enabled, mode, transport, mechanism))
|
||||
except Exception as e:
|
||||
LOG.error("update_ptp exception={}".format(e))
|
||||
raise exceptions.SyncRequestFailedRetry()
|
||||
|
|
|
@ -21,8 +21,8 @@ from dcorch.common import exceptions
|
|||
from dcorch.common.i18n import _
|
||||
from dcorch.common import manager
|
||||
from dcorch.db import api as db_api
|
||||
from dcorch.drivers.openstack import sdk_platform
|
||||
from dcorch.drivers.openstack import sdk
|
||||
from dcorch.drivers.openstack import sdk_platform
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
|
|
@ -213,10 +213,13 @@ class SysinvSyncThread(SyncThread):
|
|||
.format(rsrc.id, subcloud_rsrc_id, enabled, ntpservers),
|
||||
extra=self.log_extra)
|
||||
|
||||
def update_ptp(self, enabled):
|
||||
def update_ptp(self, enabled, mode, transport, mechanism):
|
||||
try:
|
||||
s_os_client = sdk.OpenStackDriver(self.region_name)
|
||||
ptp = s_os_client.sysinv_client.update_ptp(enabled)
|
||||
ptp = s_os_client.sysinv_client.update_ptp(enabled,
|
||||
mode,
|
||||
transport,
|
||||
mechanism)
|
||||
return ptp
|
||||
except (exceptions.ConnectionRefused, exceptions.NotAuthorized,
|
||||
exceptions.TimeOut):
|
||||
|
@ -244,16 +247,37 @@ class SysinvSyncThread(SyncThread):
|
|||
payload = ptp_dict.get('payload')
|
||||
|
||||
enabled = None
|
||||
mode = None
|
||||
transport = None
|
||||
mechanism = None
|
||||
if type(payload) is list:
|
||||
for ipayload in payload:
|
||||
if ipayload.get('path') == '/enabled':
|
||||
enabled = ipayload.get('value')
|
||||
LOG.debug("sync_ptp enabled %s" % enabled,
|
||||
extra=self.log_extra)
|
||||
if ipayload.get('path') == '/mode':
|
||||
mode = ipayload.get('value')
|
||||
LOG.debug("sync_ptp mode %s" % mode,
|
||||
extra=self.log_extra)
|
||||
if ipayload.get('path') == '/transport':
|
||||
transport = ipayload.get('value')
|
||||
LOG.debug("sync_ptp transport %s" % transport,
|
||||
extra=self.log_extra)
|
||||
if ipayload.get('path') == '/mechanism':
|
||||
enabled = ipayload.get('value')
|
||||
LOG.debug("sync_ptp mechanism %s" % mechanism,
|
||||
extra=self.log_extra)
|
||||
if all([enabled, mode, transport, mechanism]):
|
||||
break
|
||||
else:
|
||||
enabled = payload.get('enabled')
|
||||
LOG.debug("sync_ptp enabled %s" % enabled, extra=self.log_extra)
|
||||
mode = payload.get('mode')
|
||||
transport = payload.get('transport')
|
||||
mechanism = payload.get('mechanism')
|
||||
LOG.debug("sync_ptp enabled %s mode %s transport %s mechanism %s" %
|
||||
enabled, mode, transport, mechanism,
|
||||
extra=self.log_extra)
|
||||
|
||||
if enabled is None:
|
||||
LOG.info("sync_ptp No status update found in resource_info"
|
||||
|
@ -261,7 +285,7 @@ class SysinvSyncThread(SyncThread):
|
|||
extra=self.log_extra)
|
||||
return
|
||||
|
||||
ptp = self.update_ptp(enabled)
|
||||
ptp = self.update_ptp(enabled, mode, transport, mechanism)
|
||||
|
||||
# Ensure subcloud resource is persisted to the DB for later
|
||||
subcloud_rsrc_id = self.persist_db_subcloud_resource(
|
||||
|
|
Loading…
Reference in New Issue