summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-07-11 18:59:43 +1200
committerLars Wirzenius <liw@liw.fi>2010-07-11 18:59:43 +1200
commita2f18bf60ab4bdf843c832f101fc8d6481263993 (patch)
tree0ae72486356184d76b96d50b8e4433f52b142825
parent192a800d58d2677091cf2b5316ed87f237f41acd (diff)
downloadobnam-a2f18bf60ab4bdf843c832f101fc8d6481263993.tar.gz
When VFS closes, log I/O stats.
-rw-r--r--obnamlib/plugins/backup_plugin.py1
-rw-r--r--obnamlib/plugins/sftp_plugin.py2
-rw-r--r--obnamlib/vfs_local.py5
3 files changed, 8 insertions, 0 deletions
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index 53159e9e..a67ac1a5 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -107,6 +107,7 @@ class BackupPlugin(obnamlib.ObnamPlugin):
if self.fs:
self.fs.close()
self.store.commit_host()
+ storefs.close()
logging.debug('backup finished')
diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py
index 65655d11..93e0b81b 100644
--- a/obnamlib/plugins/sftp_plugin.py
+++ b/obnamlib/plugins/sftp_plugin.py
@@ -106,6 +106,8 @@ class SftpFS(obnamlib.VirtualFileSystem):
self.sftp.close()
self.transport.close()
self.sftp = None
+ logging.info('VFS %s closing down; bytes_read=%d bytes_written=%d' %
+ (self.baseurl, self.bytes_read, self.bytes_written))
def reinit(self, baseurl):
scheme, netloc, path, query, fragment = urlparse.urlsplit(baseurl)
diff --git a/obnamlib/vfs_local.py b/obnamlib/vfs_local.py
index e4ce3d92..e9d9517e 100644
--- a/obnamlib/vfs_local.py
+++ b/obnamlib/vfs_local.py
@@ -16,6 +16,7 @@
import errno
+import logging
import os
import tempfile
@@ -38,6 +39,10 @@ class LocalFS(obnamlib.VirtualFileSystem):
# unit tests. To do this, we store the baseurl as the cwd.
self.cwd = os.path.abspath(baseurl)
+ def close(self):
+ logging.info('VFS %s closing down; bytes_read=%d bytes_written=%d' %
+ (self.baseurl, self.bytes_read, self.bytes_written))
+
def getcwd(self):
return self.cwd