X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=cumulus-util;h=6bb474992406c67e060d0ac8ff6fc153a5d84bd8;hb=92488d46a0deca6d031d07852c3b79214280ab6d;hp=59c5fc77adaee7ea3565f78c175f393137435571;hpb=260aaf269765b6fdf0c74ec51615e38a70b27fa3;p=cumulus.git diff --git a/cumulus-util b/cumulus-util index 59c5fc7..6bb4749 100755 --- a/cumulus-util +++ b/cumulus-util @@ -4,7 +4,16 @@ import getpass, os, stat, sys, time from optparse import OptionParser -import lbs + +# Automatically set Python path, based on script directory. This should be +# removed if the tools are properly installed somewhere. +script_directory = os.path.dirname(sys.argv[0]) +sys.path.append(os.path.join(script_directory, 'python')) + +import cumulus + +# Compatibility +lbs = cumulus # We support up to "LBS Snapshot v0.8" formats, but are also limited by the lbs # module. @@ -80,17 +89,26 @@ def cmd_list_snapshot_sizes(): for s in sorted(lowlevel.list_snapshots()): d = lbs.parse_full(store.load_snapshot(s)) check_version(d['Format']) + + try: + intent = float(d['Backup-Intent']) + except: + intent = 1.0 + segments = d['Segments'].split() - (size, added, removed) = (0, 0, 0) + (size, added, removed, addcount, remcount) = (0, 0, 0, 0, 0) for seg in segments: segsize = lowlevel.lowlevel_stat(seg + ".tar.gpg")['size'] size += segsize - if seg not in previous: added += segsize + if seg not in previous: + added += segsize + addcount += 1 for seg in previous: if seg not in segments: removed += lowlevel.lowlevel_stat(seg + ".tar.gpg")['size'] + remcount += 1 previous = set(segments) - print "%s: %.3f +%.3f -%.3f" % (s, size / 1024.0**2, added / 1024.0**2, removed / 1024.0**2) + print "%s [%s]: %.3f +%.3f -%.3f (+%d/-%d segments)" % (s, intent, size / 1024.0**2, added / 1024.0**2, removed / 1024.0**2, addcount, remcount) # Build checksum list for objects in the given segments, or all segments if # none are specified.