]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology: do not compress tarballs when pulling dir 1824/head
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 22 Mar 2023 14:48:43 +0000 (10:48 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 28 Mar 2023 15:08:25 +0000 (11:08 -0400)
Where we use this, it's for pulling log files that are already
compressed. Do not waste time double compressing!

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
teuthology/misc.py
teuthology/orchestra/remote.py

index 55b22b6fc4dcfa6737da81e647df679ec7628742..267630edda45fd07a3a121cf02143b48f6727982 100644 (file)
@@ -745,8 +745,8 @@ def pull_directory(remote, remotedir, localdir, write_to=copy_fileobj):
               remote.shortname, remotedir, localdir)
     if not os.path.exists(localdir):
         os.mkdir(localdir)
-    r = remote.get_tar_stream(remotedir, sudo=True)
-    tar = tarfile.open(mode='r|gz', fileobj=r.stdout)
+    r = remote.get_tar_stream(remotedir, sudo=True, compress=False)
+    tar = tarfile.open(mode='r|', fileobj=r.stdout)
     while True:
         ti = tar.next()
         if ti is None:
index 963f82da795b1bd17c4f35d9c2026e6de389d710..af5e139f7b33bced5b9c71ffa69405b3e6c7c41b 100644 (file)
@@ -622,7 +622,7 @@ class Remote(RemoteShell):
             self.remove(path)
         return local_path
 
-    def get_tar(self, path, to_path, sudo=False):
+    def get_tar(self, path, to_path, sudo=False, compress=True):
         """
         Tar a remote directory and copy it locally
         """
@@ -632,7 +632,7 @@ class Remote(RemoteShell):
             args.append('sudo')
         args.extend([
             'tar',
-            'cz',
+            'cz' if compress else 'c',
             '-f', '-',
             '-C', path,
             '--',
@@ -645,7 +645,7 @@ class Remote(RemoteShell):
         self._sftp_get_file(remote_temp_path, to_path)
         self.remove(remote_temp_path)
 
-    def get_tar_stream(self, path, sudo=False):
+    def get_tar_stream(self, path, sudo=False, compress=True):
         """
         Tar-compress a remote directory and return the RemoteProcess
         for streaming
@@ -655,7 +655,7 @@ class Remote(RemoteShell):
             args.append('sudo')
         args.extend([
             'tar',
-            'cz',
+            'cz' if compress else 'c',
             '-f', '-',
             '-C', path,
             '--',