[prev in list] [next in list] [prev in thread] [next in thread]
List: klik-devel
Subject: [klik-devel] [klikclient commit] r1609 -
From: codesite-noreply () google ! com
Date: 2008-07-08 13:33:53
Message-ID: 0016e64355e43a65870451833ed8 () google ! com
[Download RAW message or body]
Author: lionel.tricon
Date: Tue Jul 8 06:33:25 2008
New Revision: 1609
Modified:
trunk/client/trunk/klikclient/lib/klik/fuse.py
Log:
Issue 276 :
o Ask fusioniso to quit properly the first time and 3 seconds after
unmount it in a lazy mode
o Use os.rmdir() instead of shutil.rmtree() (too dangerous ; there are
some situations where we can lost data)
Modified: trunk/client/trunk/klikclient/lib/klik/fuse.py
==============================================================================
--- trunk/client/trunk/klikclient/lib/klik/fuse.py (original)
+++ trunk/client/trunk/klikclient/lib/klik/fuse.py Tue Jul 8 06:33:25 2008
@@ -150,31 +150,39 @@
# always wait until mount is not being used before attempting to unmount
self.__wait_for_processes_using_mount(mount_point_path)
- # Unmount the cmg, attempt this at least three times
- # This aggressive approach is much better than leaving still
mounted cmgs
- # polluting the system...
- #try:
- attempt = 0
- while attempt < 3:
-
- # TODO : Check __is_last_client here ?
- if not os.path.exists(mount_point_path):
- break
-
- attempt = attempt + 1
-
- command = ["fusermount", "-z", "-u", mount_point_path]
- p = Popen(command) #, stderr=open(os.devnull, "w")
- p.wait()
-
- # Wait 1 second before attempting again
- if p.returncode != 0:
- time.sleep(1)
- else:
- shutil.rmtree(os.path.abspath(os.path.join(mount_point_path,
os.path.pardir)), True)
- break;
+ # ask fusioniso to unmount properly its mount point
+ command = ["fusermount", "-u", mount_point_path]
+ p = Popen(command) #, stderr=open(os.devnull, "w")
+ p.wait()
- if attempt == 3:
+ # Unmount the cmg, attempt this at least three times
+ # This aggressive approach is much
better than leaving still mounted cmgs
+ # polluting the system...
+ #try:
+ attempt = 0
+ while attempt < 6:
+
+ # Wait 1 second before attempting again
+ time.sleep(1)
+
+ # TODO : Check __is_last_client here ?
+ if not os.path.exists(mount_point_path):
+ break
+
+ # try an aggressive approach is the
previous one fails
+ if attempt == 3:
+ command =
["fusermount", "-z", "-u", mount_point_path]
+ p = Popen(command) #, stderr=open(os.devnull, "w")
+ p.wait()
+
+ # try to remove mount point (only if empty)
+ ret =
os.rmdir(os.path.abspath(os.path.join(mount_point_path, os.path.pardir)))
+ if ret == 0:
+ break
+ else:
+ attempt = attempt + 1
+
+ if attempt == 6:
raise ExecuteException("3rd attempt failed - could not unmount cmg
using fusermount\n\nPath:\n" + mount_point_path)
#except:
# raise ExecuteException("! Could not unmount cmg using
fusermount\n\nPath:\n" + mount_point_path)
_______________________________________________
klik-devel mailing list
klik-devel@kde.org
https://mail.kde.org/mailman/listinfo/klik-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic