From 12dc0ad1014d600c16c7240c27b5a99c35d0da04 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 17 Jul 2012 10:00:59 -0700 Subject: [PATCH] ceph: archive mon data to a .tgz Saves bandwidth, time, and space. --- teuthology/misc.py | 21 +++++++++++++++++++++ teuthology/task/ceph.py | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index bc025ee02c07a..f09486a9ba7ae 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -286,6 +286,27 @@ def pull_directory(remote, remotedir, localdir): continue proc.exitstatus.get() +def pull_directory_tarball(remote, remotedir, localfile): + """ + Copy a remote directory to a local tarball. + """ + log.debug('Transferring archived files from %s:%s to %s', + remote.shortname, remotedir, localfile) + out = open(localfile, 'w') + proc = remote.run( + args=[ + 'tar', + 'cz', + '-f', '-', + '-C', remotedir, + '--', + '.', + ], + stdout=out, + wait=False, + ) + proc.exitstatus.get() + def get_scratch_devices(remote): """ Read the scratch disk list from remote host diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 5477372c252d8..9f6f9713461f4 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -763,9 +763,9 @@ def cluster(ctx, config): for remote, roles in mons.remotes.iteritems(): for role in roles: if role.startswith('mon.'): - teuthology.pull_directory(remote, + teuthology.pull_directory_tarball(remote, '/tmp/cephtest/data/%s' % role, - path + '/' + role) + path + '/' + role + '.tgz') log.info('Cleaning ceph cluster...') run.wait( -- 2.39.5