From 3721d2fe03ea5ee4916f8db315d90e8ba803fea5 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Wed, 8 Dec 2010 15:53:48 +0100
Subject: [PATCH] Fix rename for file-backed instances
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently the code wrongly changes the disk logical/physical id
component representing the path from "$storage_dir/$iname/disk$seq" to
"$storage_dir/$iname/disk/$seq" (note the additional slash) breaking the
rename.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/config.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/config.py b/lib/config.py
index 1435ffaba..2284063f0 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -924,10 +924,11 @@ class ConfigWriter:
       if disk.dev_type == constants.LD_FILE:
         # rename the file paths in logical and physical id
         file_storage_dir = os.path.dirname(os.path.dirname(disk.logical_id[1]))
+        disk_fname = "disk%s" % disk.iv_name.split("/")[1]
         disk.physical_id = disk.logical_id = (disk.logical_id[0],
                                               utils.PathJoin(file_storage_dir,
                                                              inst.name,
-                                                             disk.iv_name))
+                                                             disk_fname))
 
     self._config_data.instances[inst.name] = inst
     self._WriteConfig()
-- 
GitLab