Alex Lourie has posted comments on this change.
Change subject: packaging: added DB validation functions
......................................................................
Patch Set 7: (10 inline comments)
....................................................
File packaging/setup/plugins/ovirt-engine-setup/upgrade/asynctasks.py
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(
No; we set it to 0 when entering maintenance mode; we store previous value so
we can restore it on __exit__
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(
Fixed.
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}'
The default is left-aligned and I don't want to put \t to make values indented.
So using :> allows to right-align.
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 '
Done
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)
Done
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)
it's asking user whether he wants to keep waiting. If not, it raises
RuntimeError, if yes, it just keeps looping. I think asking a user is a better
way than just stop the upgrade on ctrl+c.
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[
Done
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: )
Done
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: )
Done
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: )
Done
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