[NEW PATCH] _initpv throws an unexpected exception. (via gerrit-bot)
Yotam Oron
yoron at redhat.com
Wed Jul 27 14:45:52 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 728f80edf3fca4bbedc38c21dad893bddbf89fec
Author: Yotam Oron <yoron at 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..8cbc408 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