Browse Source

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>
Alex Kozyrev 4 months ago
parent
commit
7fe134264b
2 changed files with 6 additions and 6 deletions
  1. 4
    4
      dcorch/drivers/openstack/sysinv_v1.py
  2. 2
    2
      dcorch/engine/sync_services/sysinv.py

+ 4
- 4
dcorch/drivers/openstack/sysinv_v1.py View File

@@ -170,11 +170,11 @@ class SysinvClient(base.DriverBase):
170 170
                 return intp
171 171
             if ntpservers == "NC":
172 172
                 ntpservers = ""
173
-            if intp.enabled != (enabled == "True") or \
173
+            if str(intp.enabled) != enabled or \
174 174
                not self._same_ntpservers(intp.ntpservers, ntpservers):
175 175
                 if ntpservers == "":
176 176
                     ntpservers = "NC"
177
-                patch = make_sysinv_patch({'enabled': str(enabled),
177
+                patch = make_sysinv_patch({'enabled': enabled,
178 178
                                            'ntpservers': ntpservers,
179 179
                                            'action': 'apply'})
180 180
                 LOG.info("region={} ntp update uuid={} patch={}".format(
@@ -223,11 +223,11 @@ class SysinvClient(base.DriverBase):
223 223
                 LOG.warn("ptp not found %s" % self.region_name)
224 224
                 return ptp
225 225
 
226
-            if ptp.enabled != (enabled == "True") or \
226
+            if str(ptp.enabled) != enabled or \
227 227
                ptp.mode != mode or \
228 228
                ptp.transport != transport or \
229 229
                ptp.mechanism != mechanism:
230
-                patch = make_sysinv_patch({'enabled': str(enabled),
230
+                patch = make_sysinv_patch({'enabled': enabled,
231 231
                                            'mode': mode,
232 232
                                            'transport': transport,
233 233
                                            'mechanism': mechanism})

+ 2
- 2
dcorch/engine/sync_services/sysinv.py View File

@@ -210,7 +210,7 @@ class SysinvSyncThread(SyncThread):
210 210
                      extra=self.log_extra)
211 211
             return
212 212
 
213
-        intp = self.update_ntp(enabled, ntpservers)
213
+        intp = self.update_ntp(str(enabled), ntpservers)
214 214
 
215 215
         # Ensure subcloud resource is persisted to the DB for later
216 216
         subcloud_rsrc_id = self.persist_db_subcloud_resource(
@@ -291,7 +291,7 @@ class SysinvSyncThread(SyncThread):
291 291
                      extra=self.log_extra)
292 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 296
         # Ensure subcloud resource is persisted to the DB for later
297 297
         subcloud_rsrc_id = self.persist_db_subcloud_resource(

Loading…
Cancel
Save