The downgrade was not correctly removing some of the UUIDs (namely, those
of disks and NICs).

Fixes Issue 510.

Signed-off-by: Michele Tartara <[email protected]>
---
 tools/cfgupgrade | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/cfgupgrade b/tools/cfgupgrade
index fe73899..14b2685 100755
--- a/tools/cfgupgrade
+++ b/tools/cfgupgrade
@@ -309,6 +309,14 @@ def DowngradeCluster(config_data):
     DowngradeIPolicy(ipolicy, "cluster")
 
 
+def DowngradeDisk(disk):
+  if "uuid" in disk:
+    del disk["uuid"]
+  if "children" in disk:
+    for child_disk in disk["children"]:
+      DowngradeDisk(child_disk)
+
+
 def DowngradeInstances(config_data):
   if "instances" not in config_data:
     raise Error("Can't find the 'instances' key in the configuration!")
@@ -317,6 +325,15 @@ def DowngradeInstances(config_data):
     if "disks_active" in iobj:
       del iobj["disks_active"]
 
+    # Remove the NICs UUIDs
+    for nic in iobj["nics"]:
+      if "uuid" in nic:
+        del nic["uuid"]
+
+    # Downgrade the disks
+    for disk in iobj["disks"]:
+      DowngradeDisk(disk)
+
 
 def DowngradeAll(config_data):
   # Any code specific to a particular version should be labeled that way, so
-- 
1.8.3

Reply via email to