Fix for PTP sync failure n a Distributed Cloud system.

PTP failed to sync because of "enabled" parameter passed.
It was passed as a boolean and ingnored by SysInv API.
Need to convert it to string before passing to SysInv.

Change-Id: Ice439bcb46bc901390c562f4ca5a8af0a73b738e
Closes-Bug: 1791997
Signed-off-by: Alex Kozyrev <alex.kozyrev@windriver.com>
This commit is contained in:
Alex Kozyrev 2018-10-03 11:40:14 -04:00
parent f5d74e6da7
commit 27654d679c
2 changed files with 13 additions and 13 deletions

View File

@ -173,7 +173,7 @@ class SysinvClient(base.DriverBase):
not self._same_ntpservers(intp.ntpservers, ntpservers):
if ntpservers == "":
ntpservers = "NC"
patch = make_sysinv_patch({'enabled': enabled,
patch = make_sysinv_patch({'enabled': str(enabled),
'ntpservers': ntpservers,
'action': 'apply'})
LOG.info("region={} ntp update uuid={} patch={}".format(
@ -226,10 +226,10 @@ class SysinvClient(base.DriverBase):
ptp.mode != mode or \
ptp.transport != transport or \
ptp.mechanism != mechanism:
patch = make_sysinv_patch({'enabled': enabled},
{'mode': mode},
{'transport': transport},
{'mechanism': mechanism})
patch = make_sysinv_patch({'enabled': str(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)

View File

@ -185,7 +185,7 @@ class SysinvSyncThread(SyncThread):
enabled = ipayload.get('value')
LOG.debug("sync_ntp enabled %s" % enabled,
extra=self.log_extra)
if ipayload.get('path') == '/ntpservers':
elif ipayload.get('path') == '/ntpservers':
ntpservers = ipayload.get('value')
LOG.debug("sync_ntp ntpservers = {}".format(ntpservers),
extra=self.log_extra)
@ -256,16 +256,16 @@ class SysinvSyncThread(SyncThread):
enabled = ipayload.get('value')
LOG.debug("sync_ptp enabled %s" % enabled,
extra=self.log_extra)
if ipayload.get('path') == '/mode':
elif ipayload.get('path') == '/mode':
mode = ipayload.get('value')
LOG.debug("sync_ptp mode %s" % mode,
extra=self.log_extra)
if ipayload.get('path') == '/transport':
elif 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')
elif ipayload.get('path') == '/mechanism':
mechanism = ipayload.get('value')
LOG.debug("sync_ptp mechanism %s" % mechanism,
extra=self.log_extra)
if all([enabled, mode, transport, mechanism]):
@ -275,11 +275,11 @@ class SysinvSyncThread(SyncThread):
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,
LOG.debug("sync_ptp enabled {} mode {} transport {} mechanism {}"
.format(enabled, mode, transport, mechanism),
extra=self.log_extra)
if enabled is None:
if not any([enabled, mode, transport, mechanism]):
LOG.info("sync_ptp No status update found in resource_info"
"{}".format(request.orch_job.resource_info),
extra=self.log_extra)