From: Dan Mick Date: Wed, 2 Nov 2016 04:21:16 +0000 (-0700) Subject: Add orchestra.remote.get_tar_stream(); like get_tar but no tmpfile X-Git-Tag: 1.1.0~511^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9dff8577bc4322354c098c5ff4df57b0d2d444bb;p=teuthology.git Add orchestra.remote.get_tar_stream(); like get_tar but no tmpfile Avoid creating a temporary file either on the remote or on the local host; just open a connection to a remote tar and let 'er rip. Intended to be used by get_directory to avoid temp files and local read/write hammering. Signed-off-by: Dan Mick --- diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 276de88a6..ed840d253 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -369,6 +369,24 @@ class Remote(object): self._sftp_get_file(remote_temp_path, to_path) self.remove(remote_temp_path) + def get_tar_stream(self, path, sudo=False): + """ + Tar-compress a remote directory and return the RemoteProcess + for streaming + """ + args = [] + if sudo: + args.append('sudo') + args.extend([ + 'tar', + 'cz', + '-f', '-', + '-C', path, + '--', + '.', + ]) + return self.run(args=args, wait=False, stdout=run.PIPE) + @property def os(self): if not hasattr(self, '_os'):