From 998c712c50408f1eb7686e098387492844bbab98 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 16 Jan 2009 16:24:26 +0000
Subject: [PATCH] Fix LUExportInstance

Due to deficiencies in our block device implementation, it is a must to
call SetDiskID on disks before passing them to remote nodes. Since in
export/import, we don't touch the disks themselves, this was not needed
before in this function.

However, since having instance symlinks, the correct ID is needed here
too, and with static minors it's a "must need". This reflects into
failed instance starts after migration and/or failover.

Reviewed-by: ultrotter
---
 lib/cmdlib.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 9fdfe30a0..b239e67c6 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -5886,6 +5886,11 @@ class LUExportInstance(LogicalUnit):
 
     snap_disks = []
 
+    # set the disks ID correctly since call_instance_start needs the
+    # correct drbd minor to create the symlinks
+    for disk in instance.disks:
+      self.cfg.SetDiskID(disk, src_node)
+
     try:
       for disk in instance.disks:
         # new_dev_name will be a snapshot of an lvm leaf of the one we passed
-- 
GitLab