X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=cumulus-util;h=ce80ff6dbeb3d119e92bb0d8f1028224e2df4835;hb=682c41cb7eeb03676a44e3d51891d57e5e16bb48;hp=5425bca982d539402cf9f3c6bcbb2ffdc1888887;hpb=92b5f76843193e75e23f449a298824d4e63bbdad;p=cumulus.git diff --git a/cumulus-util b/cumulus-util index 5425bca..ce80ff6 100755 --- a/cumulus-util +++ b/cumulus-util @@ -4,11 +4,20 @@ import getpass, os, stat, sys, time from optparse import OptionParser -import lbs -# We support up to "LBS Snapshot v0.6" formats, but are also limited by the 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. -FORMAT_VERSION = min(lbs.FORMAT_VERSION, (0, 6)) +FORMAT_VERSION = min(lbs.FORMAT_VERSION, (0, 8)) def check_version(format): ver = lbs.parse_metadata_version(format) @@ -80,6 +89,12 @@ 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) for seg in segments: @@ -90,7 +105,7 @@ def cmd_list_snapshot_sizes(): if seg not in segments: removed += lowlevel.lowlevel_stat(seg + ".tar.gpg")['size'] 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" % (s, intent, size / 1024.0**2, added / 1024.0**2, removed / 1024.0**2) # Build checksum list for objects in the given segments, or all segments if # none are specified.