Yeela Kaplan has uploaded a new change for review.
Change subject: [WIP]blockSD: do not umount if not all processes were killed
......................................................................
[WIP]blockSD: do not umount if not all processes were killed
Umount of the masterFS will fail if there are
processes accessing it.
Related to BZ#949581
Change-Id: I899aa033436bb41d8bef5ec18091c3d9c9566efc
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm/storage/blockSD.py
1 file changed, 15 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/18876/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index e8b2980..c2c27f9 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -1166,11 +1166,11 @@
cls.__handleStuckUmount(masterdir)
try:
masterMount = mount.getMountFromTarget(masterdir)
- except OSError as ex:
- if ex.errno == errno.ENOENT:
+ except OSError as e:
+ if e.errno == errno.ENOENT:
return
-
raise
+
if masterMount.isMounted():
# Try umount, take 1
try:
@@ -1185,36 +1185,35 @@
return
if len(pids) == 0:
- cls.log.warn("Unmount failed because of errors that fuser
"
- "can't solve")
+ cls.log.warn("Unmount failed, but there are no processes "
+ "accessing masterFS reported by fuser")
else:
+ doUmount = True
for pid in pids:
+ cls.log.debug("Trying to kill pid %d", pid)
try:
- cls.log.debug("Trying to kill pid %d", pid)
os.kill(pid, signal.SIGKILL)
except OSError as e:
if e.errno == errno.ESRCH: # No such process
- pass
+ cls.log.warn("Could not find pid %d ", pid)
elif e.errno == errno.EPERM: # Op. not permitted
cls.log.warn("Could not kill pid %d because "
"operation was not permitted",
pid)
+ doUmount = False
else:
cls.log.warn("Could not kill pid %d because
an"
" unexpected error",
exc_info=True)
- except:
- cls.log.warn("Could not kill pid %d because an "
- "unexpected error", exc_info=True)
+ doUmount = False
- # Try umount, take 2
- try:
- masterMount.umount()
- except mount.MountError:
- pass
+ if doUmount:
+ try:
+ masterMount.umount()
+ except mount.MountError:
+ pass
if masterMount.isMounted():
- # We failed to umount masterFS
# Forcibly rebooting the SPM host would be safer. ???
raise se.StorageDomainMasterUnmountError(masterdir, 1)
--
To view, visit
http://gerrit.ovirt.org/18876
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I899aa033436bb41d8bef5ec18091c3d9c9566efc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>