Ganeti used to use the logical_id of a disk to name the file containing a locally exported disk. This worked while only plain or drbd disks were used, but broke down with e.g. file-based disks. The reason is simple - the logical_id is specific to each disk template, and in the case of files, contains the full path to the file, causing various issues when used.
This patch uses the newly introduced disk UUID instead of the logical_id, adding it to snapshot generation where it was previously missing. While the logical_id did have some meaning (Linux UUID), the UUID was actually taken from an LVM snapshot and did not have any meaning due to the short life of the snapshot. The id format also differed between plain and drbd, which makes sense as it was used only as a reference - much as it should for compatibility with e.g. OVF. This also means we maintain backward compatibility with older Ganeti versions. Signed-off-by: Hrvoje Ribicic <r...@google.com> --- lib/backend.py | 2 +- lib/masterd/instance.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index da98b5a..224f8c1 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -4230,7 +4230,7 @@ def FinalizeExport(instance, snap_disks): config.set(constants.INISECT_INS, "disk%d_ivname" % disk_count, ("%s" % disk.iv_name)) config.set(constants.INISECT_INS, "disk%d_dump" % disk_count, - ("%s" % disk.logical_id[1])) + ("%s" % disk.uuid)) config.set(constants.INISECT_INS, "disk%d_size" % disk_count, ("%d" % disk.size)) config.set(constants.INISECT_INS, "disk%d_name" % disk_count, diff --git a/lib/masterd/instance.py b/lib/masterd/instance.py index 392d328..ba3b3cf 100644 --- a/lib/masterd/instance.py +++ b/lib/masterd/instance.py @@ -1211,6 +1211,7 @@ class ExportInstanceHelper(object): new_dev = objects.Disk(dev_type=dev_type, size=disk.size, logical_id=disk_id, iv_name=disk.iv_name, params=disk_params) + new_dev.uuid = self._lu.cfg.GenerateUniqueID(self._lu.proc.GetECId()) assert idx not in self._disks_to_transfer self._disks_to_transfer[idx] = new_dev @@ -1268,7 +1269,7 @@ class ExportInstanceHelper(object): continue path = utils.PathJoin(pathutils.EXPORT_DIR, "%s.new" % instance.name, - dev.logical_id[1]) + dev.uuid) finished_fn = compat.partial(self._TransferFinished, idx) -- 2.2.0.rc0.207.ga3a616c