From 5574047a5f5807d9191b1df5033696d191dadf59 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 7 Jan 2008 13:29:02 +0000 Subject: [PATCH] Activate logical volumes at Assemble() time This patch changes the Assemble() method for logical volumes from a noop to do a `lvchange -ay` on the logical volume; this ensures that if the logical volume is not active, we are able to activate and use it. Reviewed-by: imsnah --- lib/bdev.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/bdev.py b/lib/bdev.py index fb9d4e1e7..1552956c7 100644 --- a/lib/bdev.py +++ b/lib/bdev.py @@ -415,11 +415,15 @@ class LogicalVolume(BlockDev): def Assemble(self): """Assemble the device. - This is a no-op for the LV device type. Eventually, we could - lvchange -ay here if we see that the LV is not active. + We alway run `lvchange -ay` on the LV to ensure it's active before + use, as there were cases when xenvg was not active after boot + (also possibly after disk issues). """ - return True + result = utils.RunCmd(["lvchange", "-ay", self.dev_path]) + if result.failed: + logger.Error("Can't activate lv %s: %s" % (self.dev_path, result.output)) + return not result.failed def Shutdown(self): """Shutdown the device. -- GitLab