[NEW PATCH] _initpv should only throw PhysDevInitializationError exceptions, however when a bad device is received (say /dev/null) it throws OSError. This patch is fixing this scenario (via gerrit-bot)
Yotam Oron
yoron at redhat.com
Tue Jul 5 12:16:53 UTC 2011
New patch submitted by Yotam Oron (yoron at redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/653
commit 46c8d0077575cdcc7353b802b9bd0c8f68136c6e
Author: Yotam Oron <yoron at redhat.com>
Date: Tue Jul 5 12:14:53 2011 +0300
_initpv should only throw PhysDevInitializationError exceptions, however
when a bad device is received (say /dev/null) it throws OSError.
This patch is fixing this scenario
Change-Id: I05e55b361df1523d970428d5453f36e98b2c9a2b
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index d6159eb..f87bf6b 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -676,7 +676,11 @@ def _initpv(device, withmetadata=False):
if isPvPartOfVg(device):
raise se.PhysDevInitializationError(device)
- devicemapper.removeMappingsHoldingDevice(os.path.basename(device))
+ try:
+ devicemapper.removeMappingsHoldingDevice(os.path.basename(device))
+ except OSError:
+ raise se.PhysDevInitializationError(device)
+
rc, out, err = _lvminfo.cmd(cmd)
if rc != 0:
raise se.PhysDevInitializationError(device)
More information about the vdsm-patches
mailing list