Comment #1 on issue 1070 by [email protected]: Upgrade of Ganeti 2.5.2 to 2.12.0 fails due to missing UUIDs for disks
https://code.google.com/p/ganeti/issues/detail?id=1070

commit 0de1e688eb06dbc4389891cf2d8e971c24e32f53
Author: Klaus Aehlig <[email protected]>
Date:   Thu Apr 23 13:31:27 2015 +0200

    When assigning UUIDs to disks, do so recursively

    Old versions of Ganeti (in particular, 2.5 and earlier) did not
    have UUIDs assigned to objects. If we happen to find such an old
    configuration, we assign UUIDs now, during the upgrade. However,
    we must do this recursively, as disks might have children. Note
    that before Ganeti 2.12 this didn't matter, as the UUIDs of the
    children where never used or enforced. With the strict type checking
    introduced by the switch to haskell, we have to care about those
    little details.

    Signed-off-by: Klaus Aehlig <[email protected]>
    Reviewed-by: Hrvoje Ribicic <[email protected]>

diff --git a/tools/cfgupgrade b/tools/cfgupgrade
index c8dfdec..a42b94a 100755
--- a/tools/cfgupgrade
+++ b/tools/cfgupgrade
@@ -241,6 +241,14 @@ def _ConvertNicNameToUuid(iobj, network2uuid):
         nic["network"] = uuid


+def AssignUuid(disk):
+  if not "uuid" in disk:
+    disk["uuid"] = utils.io.NewUUID()
+  if "children" in disk:
+    for d in disk["children"]:
+      AssignUuid(d)
+
+
 def _ConvertDiskAndCheckMissingSpindles(iobj, instance):
   missing_spindles = False
   if "disks" not in iobj:
@@ -265,8 +273,7 @@ def _ConvertDiskAndCheckMissingSpindles(iobj, instance):
       if not "spindles" in dobj:
         missing_spindles = True

-      if not "uuid" in dobj:
-        dobj["uuid"] = utils.io.NewUUID()
+      AssignUuid(dobj)
   return missing_spindles




--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

Reply via email to