Yedidyah Bar David has uploaded a new change for review.
Change subject: packaging: setup: Clear rollback message
......................................................................
packaging: setup: Clear rollback message
Remove the message '[WARNING] Rolling back upgrade' which was emitted
during rollback of db schema setup/upgrade.
Add a message '[WARNING] Rolling back {action}' which is emitted
as the first message during rollback.
In a normal upgrade from 3.2 to 3.3, if it was rolled back e.g.
because of a db schema update failure (easily tested with 'killall psql'
in another window), there was a long operation of rolling back the rpm
packages, and only when the schema was rolled back the message was
emitted. Also the same message was emitted also during a clean setup
(not upgrade).
The new message is registered during the setup stage at priority FIRST,
so will be displayed immediately when the rollback starts.
Change-Id: Ieec07031079e23b23f59e166d647988743dffb7b
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M packaging/setup/plugins/ovirt-engine-common/core/__init__.py
A packaging/setup/plugins/ovirt-engine-common/core/rollbackmsg.py
M packaging/setup/plugins/ovirt-engine-setup/db/schema.py
3 files changed, 80 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/45/17845/1
diff --git a/packaging/setup/plugins/ovirt-engine-common/core/__init__.py
b/packaging/setup/plugins/ovirt-engine-common/core/__init__.py
index e900a2c..273183e 100644
--- a/packaging/setup/plugins/ovirt-engine-common/core/__init__.py
+++ b/packaging/setup/plugins/ovirt-engine-common/core/__init__.py
@@ -29,6 +29,7 @@
from . import answerfile
from . import uninstall
from . import protocols
+from . import rollbackmsg
@util.export
@@ -40,6 +41,7 @@
answerfile.Plugin(context=context)
uninstall.Plugin(context=context)
protocols.Plugin(context=context)
+ rollbackmsg.Plugin(context=context)
# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/packaging/setup/plugins/ovirt-engine-common/core/rollbackmsg.py
b/packaging/setup/plugins/ovirt-engine-common/core/rollbackmsg.py
new file mode 100644
index 0000000..9351018
--- /dev/null
+++ b/packaging/setup/plugins/ovirt-engine-common/core/rollbackmsg.py
@@ -0,0 +1,78 @@
+#
+# ovirt-engine-setup -- ovirt engine setup
+# Copyright (C) 2013 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+"""Rollback message plugin."""
+
+
+import gettext
+_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup')
+
+
+from otopi import constants as otopicons
+from otopi import util
+from otopi import plugin
+from otopi import transaction
+
+
+from ovirt_engine_setup import constants as osetupcons
+
+
[email protected]
+class Plugin(plugin.PluginBase):
+ """Rollback message plugin."""
+
+ class RBMsgTransaction(transaction.TransactionElement):
+ """yum transaction element."""
+
+ def __init__(self, parent, backup=None):
+ self._parent = parent
+
+ def __str__(self):
+ return _("Rollback message Transaction")
+
+ def prepare(self):
+ pass
+
+ def abort(self):
+ self._parent.logger.warning(
+ _('Rolling back {action}').format(
+ action=self._parent.environment[
+ osetupcons.CoreEnv.ACTION
+ ]
+ )
+ )
+
+ def commit(self):
+ pass
+
+ def __init__(self, context):
+ super(Plugin, self).__init__(context=context)
+
+ @plugin.event(
+ stage=plugin.Stages.STAGE_SETUP,
+ priority=plugin.Stages.PRIORITY_FIRST,
+ )
+ def _setup(self):
+ self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(
+ self.RBMsgTransaction(
+ parent=self,
+ )
+ )
+
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/packaging/setup/plugins/ovirt-engine-setup/db/schema.py
b/packaging/setup/plugins/ovirt-engine-setup/db/schema.py
index 36ab0a7..582eac1 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/db/schema.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/db/schema.py
@@ -52,7 +52,6 @@
pass
def abort(self):
- self._parent.logger.warning(_('Rolling back upgrade'))
try:
dbovirtutils = database.OvirtUtils(plugin=self._parent)
self._parent.logger.info(
--
To view, visit http://gerrit.ovirt.org/17845
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieec07031079e23b23f59e166d647988743dffb7b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches