[NEW PATCH] _initpv should only throw PhysDevInitializationError exceptions, however when a bad device argument is passed to _initpv (say /dev/null) it throws OSError. This patch is fixing this scenario (via gerrit-bot)
Yotam Oron
yoron at redhat.com
Tue Jul 5 13:54:57 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 1d3cb8cbf8a43ec7d110980227b0a9d24deb3c1d
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 argument is passed to _initpv (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..b3d7221 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -676,7 +676,13 @@ 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:
+ log.warning("removeMappingsHoldingDevice() failed with %s" % device,
+ exc_info=True)
+ 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