Alon Bar-Lev has posted comments on this change.
Change subject: packaging: added DB validation functions
......................................................................
Patch Set 7: (11 inline comments)
Great! almost there.
....................................................
File packaging/setup/plugins/ovirt-engine-setup/upgrade/asynctasks.py
Line 50: self._parent = parent
Line 51: self._origTimeout = 0
Line 52: self._dbstatement = dbstatement
Line 53:
Line 54: def _setEngineMode(self, maintenance=True, timeout=0):
you don't need the default for maintenance.
Line 55: if maintenance:
Line 56: self._origTimeout = self._dbstatement.getVDCOption(
Line 57: name='AsyncTaskZombieTaskLifeInMinutes',
Line 58: )
Line 52: self._dbstatement = dbstatement
Line 53:
Line 54: def _setEngineMode(self, maintenance=True, timeout=0):
Line 55: if maintenance:
Line 56: self._origTimeout = self._dbstatement.getVDCOption(
why do we need this helper function to store the timeout within member? Can't
we assume that after this process we set the timeout to 0? If not, I prefer a
different method to get this timeout.
Line 57: name='AsyncTaskZombieTaskLifeInMinutes',
Line 58: )
Line 59: mode = 'MAINTENANCE'
Line 60: else:
Line 71: 'name': 'EngineMode',
Line 72: 'value': mode,
Line 73: }
Line 74: )
Line 75: self._dbstatement.updateVDCOption(
why call twice?
Line 76: {
Line 77: 'name': 'AsyncTaskZombieTaskLifeInMinutes',
Line 78: 'value': timeout,
Line 79: },
Line 165: '---- Task ID: {task_id:30} -------\n'
Line 166: 'Task Name: {task_name:>30}\n'
Line 167: 'Task Description: \t{task_desc:>30}\n'
Line 168: 'Started at: {started_at:>30}\n'
Line 169: 'DC Name: {name:>30}'
are you sure this is not right aligned?
I think that:
xxxx {name:30}
yyyyyy {started_at:30}
is the way to go... not sure... maybe this :> is good.
Line 170: ).format(
Line 171: task_id=entry['task_id'],
Line 172:
task_name=ASYNC_TASKS_MAP[entry['action_type']][0],
Line 173:
task_desc=ASYNC_TASKS_MAP[entry['action_type']][1],
Line 252: compensations =
self._getCompensations(dbstatement)
Line 253: if runningTasks or compensations:
Line 254: self.dialog.note(
Line 255: text=_(
Line 256: 'Waiting for the completion of {num}
running '
please don't use abbreviation for translators... use number.
Line 257: 'tasks during the next {cleanup_wait}
'
Line 258: 'seconds.\n'
Line 259: 'Press Ctrl+C to interrupt. '
Line 260: ).format(
Line 261: cleanup_wait=self.environment[
Line 262: osetupcons.AsyncTasksEnv.
Line 263: CLEAR_TASKS_WAIT_PERIOD
Line 264: ],
Line 265: num=len(runningTasks + compensations)
comma
Line 266: )
Line 267: )
Line 268: time.sleep(
Line 269: self.environment[
Line 273: )
Line 274: else:
Line 275: break
Line 276: except KeyboardInterrupt:
Line 277: self._askUserToStopTasks(runningTasks,
compensations)
this doesn't make sense... I expect the KeyboardInterrupt to be caught outside
the loop and stop the loop. How come it is here?
Or the askUserTo... is not really asking but doing something.
Line 278:
Line 279: def __init__(self, context):
Line 280: super(Plugin, self).__init__(context=context)
Line 281: self._enabled = False
Line 297: stage=plugin.Stages.STAGE_SETUP,
Line 298: condition=lambda self: self._enabled,
Line 299: )
Line 300: def _setup(self):
Line 301: self._enabled = osetupcons.environment[
self?
Line 302: osetupcons.AsyncTasksEnv.CLEAR_TASKS
Line 303: ] is True
Line 304:
Line 305: @plugin.event(
Line 325:
Line 326: self.logger.info(
Line 327: _(
Line 328: 'Cleaning async tasks and compensations'
Line 329: )
_('Cleaning....')
Line 330: )
Line 331: self._clearRunningTasks()
Line 332:
Line 333:
....................................................
File packaging/setup/plugins/ovirt-engine-setup/upgrade/dbvalidations.py
Line 108: def _customization(self):
Line 109: self.logger.info(
Line 110: _(
Line 111: 'Checking the DB consistency'
Line 112: )
_('xxxx')
Line 113: )
Line 114: violations, issues_found = self._checkDb()
Line 115: if issues_found:
Line 116: if self.environment[
Line 156: def _misc(self):
Line 157: self.logger.info(
Line 158: _(
Line 159: 'Fixing DB inconsistencies'
Line 160: )
_('xxxx')
Line 161: )
Line 162: self._dbUtil(fix=True)
Line 163:
Line 164:
--
To view, visit http://gerrit.ovirt.org/15970
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I25979acbf54d980168be929638ff4aed800bf6d3
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <[email protected]>
Gerrit-Reviewer: Alex Lourie <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Moran Goldboim <[email protected]>
Gerrit-Reviewer: Ofer Schreiber <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches