summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kozyrev <alex.kozyrev@windriver.com>2018-12-13 16:09:31 -0500
committerAlex Kozyrev <alex.kozyrev@windriver.com>2018-12-14 17:04:51 +0000
commit7fe134264bcb57b8f58588276107a440c7dec63d (patch)
tree4bfc74bd8b8170a126391cca06baca7516cdf398
parent149979407eb2c3c1720a5b20ff66e0543ebd04e7 (diff)
Convert NTP/PTP enabled flag to string implicitly in DC sync.
NTP/PTP enabled flag is not propagated properly to subclouds. The root cause is the wrong boolean/string comparison of the enabled flag. Need to to convert it to string to simplify the logic. Change-Id: Ie9d67c567732caf5edba751fd1310b94d2c084ca Closes-Bug: 1802530 Signed-off-by: Alex Kozyrev <alex.kozyrev@windriver.com>
Notes
Notes (review): Code-Review+2: Bart Wensley <barton.wensley@windriver.com> Code-Review+2: John Kung <john.kung@windriver.com> Workflow+1: John Kung <john.kung@windriver.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 14 Dec 2018 18:51:33 +0000 Reviewed-on: https://review.openstack.org/625128 Project: openstack/stx-distcloud Branch: refs/heads/master
-rw-r--r--dcorch/drivers/openstack/sysinv_v1.py8
-rw-r--r--dcorch/engine/sync_services/sysinv.py4
2 files changed, 6 insertions, 6 deletions
diff --git a/dcorch/drivers/openstack/sysinv_v1.py b/dcorch/drivers/openstack/sysinv_v1.py
index eb9b432..da71c69 100644
--- a/dcorch/drivers/openstack/sysinv_v1.py
+++ b/dcorch/drivers/openstack/sysinv_v1.py
@@ -170,11 +170,11 @@ class SysinvClient(base.DriverBase):
170 return intp 170 return intp
171 if ntpservers == "NC": 171 if ntpservers == "NC":
172 ntpservers = "" 172 ntpservers = ""
173 if intp.enabled != (enabled == "True") or \ 173 if str(intp.enabled) != enabled or \
174 not self._same_ntpservers(intp.ntpservers, ntpservers): 174 not self._same_ntpservers(intp.ntpservers, ntpservers):
175 if ntpservers == "": 175 if ntpservers == "":
176 ntpservers = "NC" 176 ntpservers = "NC"
177 patch = make_sysinv_patch({'enabled': str(enabled), 177 patch = make_sysinv_patch({'enabled': enabled,
178 'ntpservers': ntpservers, 178 'ntpservers': ntpservers,
179 'action': 'apply'}) 179 'action': 'apply'})
180 LOG.info("region={} ntp update uuid={} patch={}".format( 180 LOG.info("region={} ntp update uuid={} patch={}".format(
@@ -223,11 +223,11 @@ class SysinvClient(base.DriverBase):
223 LOG.warn("ptp not found %s" % self.region_name) 223 LOG.warn("ptp not found %s" % self.region_name)
224 return ptp 224 return ptp
225 225
226 if ptp.enabled != (enabled == "True") or \ 226 if str(ptp.enabled) != enabled or \
227 ptp.mode != mode or \ 227 ptp.mode != mode or \
228 ptp.transport != transport or \ 228 ptp.transport != transport or \
229 ptp.mechanism != mechanism: 229 ptp.mechanism != mechanism:
230 patch = make_sysinv_patch({'enabled': str(enabled), 230 patch = make_sysinv_patch({'enabled': enabled,
231 'mode': mode, 231 'mode': mode,
232 'transport': transport, 232 'transport': transport,
233 'mechanism': mechanism}) 233 'mechanism': mechanism})
diff --git a/dcorch/engine/sync_services/sysinv.py b/dcorch/engine/sync_services/sysinv.py
index 060afc5..43628cc 100644
--- a/dcorch/engine/sync_services/sysinv.py
+++ b/dcorch/engine/sync_services/sysinv.py
@@ -210,7 +210,7 @@ class SysinvSyncThread(SyncThread):
210 extra=self.log_extra) 210 extra=self.log_extra)
211 return 211 return
212 212
213 intp = self.update_ntp(enabled, ntpservers) 213 intp = self.update_ntp(str(enabled), ntpservers)
214 214
215 # Ensure subcloud resource is persisted to the DB for later 215 # Ensure subcloud resource is persisted to the DB for later
216 subcloud_rsrc_id = self.persist_db_subcloud_resource( 216 subcloud_rsrc_id = self.persist_db_subcloud_resource(
@@ -291,7 +291,7 @@ class SysinvSyncThread(SyncThread):
291 extra=self.log_extra) 291 extra=self.log_extra)
292 return 292 return
293 293
294 ptp = self.update_ptp(enabled, mode, transport, mechanism) 294 ptp = self.update_ptp(str(enabled), mode, transport, mechanism)
295 295
296 # Ensure subcloud resource is persisted to the DB for later 296 # Ensure subcloud resource is persisted to the DB for later
297 subcloud_rsrc_id = self.persist_db_subcloud_resource( 297 subcloud_rsrc_id = self.persist_db_subcloud_resource(