Yeela Kaplan has uploaded a new change for review.

Change subject: Clean /rhev/data-center/mnt/ after failed mount command
......................................................................

Clean /rhev/data-center/mnt/ after failed mount command

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=853040
Change-Id: I91b11d11a6e3402fe40607847ee24b1fb539df22
Signed-off-by: Yeela Kaplan <[email protected]>
---
M vdsm/storage/mount.py
M vdsm/storage/storageServer.py
2 files changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/8695/1

diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index 94cfae0..a329ddf 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -156,6 +156,7 @@
 
 
 class Mount(object):
+
     def __init__(self, fs_spec, fs_file):
         self.fs_spec = normpath(fs_spec)
         self.fs_file = normpath(fs_file)
@@ -201,7 +202,7 @@
         rc = p.returncode
 
         if rc == 0:
-            return
+            return rc
 
         raise MountError(rc, ";".join((out, err)))
 
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index f95124e..7d63728 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -34,6 +34,7 @@
 import fileSD
 import iscsi
 from sync import asyncmethod, AsyncCallStub
+from mount import MountError
 import storage_exception as se
 
 
@@ -199,7 +200,14 @@
             if e.errno != errno.EEXIST:
                 raise
 
-        self._mount.mount(self.options, self._vfsType)
+        try:
+            self._mount.mount(self.options, self._vfsType)
+        except MountError:
+            try:
+                os.rmdir(self._getLocalPath())
+            except OSError as e:
+                if e.errno != errno.ENOENT:
+                    raise
 
         try:
             fileSD.validateDirAccess(self.getMountObj().getRecord().fs_file)


--
To view, visit http://gerrit.ovirt.org/8695
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I91b11d11a6e3402fe40607847ee24b1fb539df22
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to