Also add the current version to the intent-to-upgrade file
authorKlaus Aehlig <aehlig@google.com>
Fri, 10 Jan 2014 10:13:42 +0000 (11:13 +0100)
committerKlaus Aehlig <aehlig@google.com>
Fri, 10 Jan 2014 12:19:36 +0000 (13:19 +0100)
Our design states, that the intent-to-upgrade file contains "the current
version of ganeti, the version to change to, and the process ID". Make the
implementation fit with that design.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>

lib/client/gnt_cluster.py

index c28936b..05f3eeb 100644 (file)
@@ -1786,10 +1786,10 @@ def _ReadIntentToUpgrade():
 
   contentstring = utils.ReadFile(pathutils.INTENT_TO_UPGRADE)
   contents = utils.UnescapeAndSplit(contentstring)
-  if len(contents) != 2:
+  if len(contents) != 3:
     # file syntactically mal-formed
     return None
-  return contents[0]
+  return contents[1]
 
 
 def _WriteIntentToUpgrade(version):
@@ -1800,7 +1800,8 @@ def _WriteIntentToUpgrade(version):
 
   """
   utils.WriteFile(pathutils.INTENT_TO_UPGRADE,
-                  data=utils.EscapeAndJoin([version, "%d" % os.getpid()]))
+                  data=utils.EscapeAndJoin([constants.RELEASE_VERSION, version,
+                                            "%d" % os.getpid()]))
 
 
 def _UpgradeBeforeConfigurationChange(versionstring):