Rev 6095: (jelmer) Add a -Dhpss_client_no_vfs debug flag which prevents client-side in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Aug 24 20:33:16 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6095 [merge]
revision-id: pqm at pqm.ubuntu.com-20110824203301-6lg9swwyae8kpshj
parent: pqm at pqm.ubuntu.com-20110824171334-rmma92i0w6umipi6
parent: jelmer at samba.org-20110821134930-4eft65lbqeeec2zs
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-08-24 20:33:01 +0000
message:
(jelmer) Add a -Dhpss_client_no_vfs debug flag which prevents client-side
VFS calls. (Jelmer Vernooij)
modified:
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2011-08-10 13:26:27 +0000
+++ b/bzrlib/errors.py 2011-08-21 13:49:30 +0000
@@ -3324,3 +3324,13 @@
def __init__(self, source, target):
self.source = source
self.target = target
+
+
+class HpssVfsRequestNotAllowed(BzrError):
+
+ _fmt = ("VFS requests over the smart server are not allowed. Encountered: "
+ "%(method)s, %(arguments)s.")
+
+ def __init__(self, method, arguments):
+ self.method = method
+ self.arguments = arguments
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py 2011-04-07 10:36:24 +0000
+++ b/bzrlib/smart/medium.py 2011-08-21 13:45:27 +0000
@@ -490,6 +490,25 @@
return self._medium._get_line()
+class _VfsRefuser(object):
+ """An object that refuses all VFS requests.
+
+ """
+
+ def __init__(self):
+ client._SmartClient.hooks.install_named_hook(
+ 'call', self.check_vfs, 'vfs refuser')
+
+ def check_vfs(self, params):
+ try:
+ request_method = request.request_handlers.get(params.method)
+ except KeyError:
+ # A method we don't know about doesn't count as a VFS method.
+ return
+ if issubclass(request_method, vfs.VfsRequest):
+ raise errors.HpssVfsRequestNotAllowed(params.method, params.args)
+
+
class _DebugCounter(object):
"""An object that counts the HPSS calls made to each client medium.
@@ -550,6 +569,7 @@
self.done(ref)
_debug_counter = None
+_vfs_refuser = None
class SmartClientMedium(SmartMedium):
@@ -572,6 +592,10 @@
if _debug_counter is None:
_debug_counter = _DebugCounter()
_debug_counter.track(self)
+ if 'hpss_client_no_vfs' in debug.debug_flags:
+ global _vfs_refuser
+ if _vfs_refuser is None:
+ _vfs_refuser = _VfsRefuser()
def _is_remote_before(self, version_tuple):
"""Is it possible the remote side supports RPCs for a given version?
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt 2011-08-24 17:13:34 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt 2011-08-24 20:33:01 +0000
@@ -204,6 +204,10 @@
.. Major internal changes, unlikely to be visible to users or plugin
developers, but interesting for bzr developers.
+* A new debug flags ``hpss_client_no_vfs`` will now cause the HPSS client
+ to raise a ``HpssVfsRequestNotAllowed`` exception when a VFS request
+ is attempted. (Jelmer Vernooij)
+
* New method ``ControlDir._get_selected_branch`` which returns the
colocated branch selected using path segment parameters.
(Jelmer Vernooij, #380871)
More information about the bazaar-commits
mailing list