New patch submitted by Yotam Oron (yoron(a)redhat.com)
You can review this change at:
http://gerrit.usersys.redhat.com/653
commit fde88efa7db551334fc697c84d6211eebc313c86
Author: Yotam Oron <yoron(a)redhat.com>
Date: Tue Jul 5 12:14:53 2011 +0300
_initpv throws an unexpected exception.
_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 ef60c02..c5b66aa 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)