From be345db08f89f83057c35dc2200692a5d6f2f51a Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 2 Nov 2007 13:43:29 +0000
Subject: [PATCH] Update the dev_path on LVs on rename

When renaming a logical volume, we should change the dev_path (and other
internal variables) in order to be consistent.

Reviewed-by: imsnah
---
 lib/bdev.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/bdev.py b/lib/bdev.py
index c0608dc9c..a2d7e4f30 100644
--- a/lib/bdev.py
+++ b/lib/bdev.py
@@ -290,7 +290,6 @@ class LogicalVolume(BlockDev):
     self.dev_path = "/dev/%s/%s" % (self._vg_name, self._lv_name)
     self.Attach()
 
-
   @classmethod
   def Create(cls, unique_id, children, size):
     """Create a new logical volume.
@@ -380,6 +379,9 @@ class LogicalVolume(BlockDev):
     if result.failed:
       raise errors.BlockDeviceError("Failed to rename the logical volume: %s" %
                                     result.output)
+    self._lv_name = new_name
+    self.dev_path = "/dev/%s/%s" % (self._vg_name, self._lv_name)
+
 
   def Attach(self):
     """Attach to an existing LV.
-- 
GitLab