From 91fb0d189213476a71009467726824ba15cdfcf0 Mon Sep 17 00:00:00 2001
From: Bernardo Dal Seno <bdalseno@google.com>
Date: Wed, 3 Apr 2013 17:38:58 +0200
Subject: [PATCH] Document procedure to downgrade a cluster

This is based on the --donwgrade option of cfgupgrade, first introduced in
1709435e.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 NEWS          |  2 ++
 UPGRADE       | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++
 doc/admin.rst |  3 ++-
 3 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 09fc29e32..b2c3466b3 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ Version 2.8.0 beta1
   are currently used by instances. The order of storage types will be based
   on Ganeti's history of supporting them. In the future, the first entry of
   the list will be used as a default storage type on instance creation.
+- ``cfgupgrade`` now supports a ``--downgrade`` option to bring the
+  configuration back to the previous stable version.
 
 
 Version 2.7.0 beta1
diff --git a/UPGRADE b/UPGRADE
index 02157d537..a1d21e764 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -71,6 +71,71 @@ To run commands on all nodes, the `distributed shell (dsh)
 
     $ gnt-cluster verify
 
+Reverting an upgrade
+~~~~~~~~~~~~~~~~~~~~
+
+For going back between revisions (e.g. 2.1.1 to 2.1.0) no manual
+intervention is required, as for upgrades.
+
+Starting from version 2.8, ``cfgupgrade`` supports ``--downgrade``
+option to bring the configuration back to the previous stable version.
+This is useful if you upgrade Ganeti and after some time you run into
+problems with the new version. You can downgrade the configuration
+without losing the changes made since the upgrade. Any feature not
+supported by the old version will be removed from the configuration, of
+course, but you get a warning about it. If there is any new feature and
+you haven't changed from its default value, you don't have to worry
+about it, as it will get the same value whenever you'll upgrade again.
+
+The procedure is similar to upgrading, but please notice that you have to
+revert the configuration **before** installing the old version.
+
+#. Ensure no jobs are running (master node only)::
+
+    $ gnt-job list
+
+#. Pause the watcher for an hour (master node only)::
+
+    $ gnt-cluster watcher pause 1h
+
+#. Stop all daemons on all nodes::
+
+    $ /etc/init.d/ganeti stop
+
+#. Backup old configuration (master node only)::
+
+    $ tar czf /var/lib/ganeti-$(date +\%FT\%T).tar.gz -C /var/lib ganeti
+
+#. Run cfgupgrade on the master node::
+
+    $ /usr/lib/ganeti/tools/cfgupgrade --verbose --downgrade --dry-run
+    $ /usr/lib/ganeti/tools/cfgupgrade --verbose --downgrade
+
+   You may want to copy all the messages about features that have been
+   removed during the downgrade, in case you want to restore them when
+   upgrading again.
+
+#. Install the old Ganeti version on all nodes
+#. Restart daemons on all nodes::
+
+    $ /etc/init.d/ganeti restart
+
+#. Re-distribute configuration (master node only)::
+
+    $ gnt-cluster redist-conf
+
+#. Restart daemons again on all nodes::
+
+    $ /etc/init.d/ganeti restart
+
+#. Enable the watcher again (master node only)::
+
+    $ gnt-cluster watcher continue
+
+#. Verify cluster (master node only)::
+
+    $ gnt-cluster verify
+
 
 2.0 releases
 ------------
diff --git a/doc/admin.rst b/doc/admin.rst
index a458a0f12..4eb51c57e 100644
--- a/doc/admin.rst
+++ b/doc/admin.rst
@@ -1564,7 +1564,8 @@ cfgupgrade
 ++++++++++
 
 The ``cfgupgrade`` tools is used to upgrade between major (and minor)
-Ganeti versions. Point-releases are usually transparent for the admin.
+Ganeti versions, and to roll back. Point-releases are usually
+transparent for the admin.
 
 More information about the upgrade procedure is listed on the wiki at
 http://code.google.com/p/ganeti/wiki/UpgradeNotes.
-- 
GitLab