Consider disks_active in UpgradeConfig
authorThomas Thrainer <thomasth@google.com>
Thu, 16 May 2013 09:13:24 +0000 (11:13 +0200)
committerThomas Thrainer <thomasth@google.com>
Tue, 28 May 2013 13:05:40 +0000 (15:05 +0200)
The disks_active flag is updated when masterd reads the configuration.
Also, cfgupgrade now removes the disks_active flag during downgrades.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/objects.py
tools/cfgupgrade

index f7ce3b6..1f5a194 100644 (file)
@@ -1223,6 +1223,8 @@ class Instance(TaggableObject):
     if self.osparams is None:
       self.osparams = {}
     UpgradeBeParams(self.beparams)
+    if self.disks_active is None:
+      self.disks_active = self.admin_state == constants.ADMINST_UP
 
 
 class OS(ConfigObject):
index 0526b1a..0508387 100755 (executable)
@@ -309,11 +309,21 @@ def DowngradeCluster(config_data):
     DowngradeIPolicy(ipolicy, "cluster")
 
 
+def DowngradeInstances(config_data):
+  if "instances" not in config_data:
+    raise Error("Can't find the 'instances' key in the configuration!")
+
+  for _, iobj in config_data["instances"].items():
+    if "disks_active" in iobj:
+      del iobj["disks_active"]
+
+
 def DowngradeAll(config_data):
   # Any code specific to a particular version should be labeled that way, so
   # it can be removed when updating to the next version.
   DowngradeCluster(config_data)
   DowngradeGroups(config_data)
+  DowngradeInstances(config_data)
 
 
 def main():