projects
/
cumulus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement metadata caching for S3 backend.
[cumulus.git]
/
cumulus-util
diff --git
a/cumulus-util
b/cumulus-util
index
f5d5fa3
..
6bb4749
100755
(executable)
--- a/
cumulus-util
+++ b/
cumulus-util
@@
-4,6
+4,12
@@
import getpass, os, stat, sys, time
from optparse import OptionParser
import getpass, os, stat, sys, time
from optparse import OptionParser
+
+# 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
import cumulus
# Compatibility
@@
-83,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'])
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()
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
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']
for seg in previous:
if seg not in segments:
removed += lowlevel.lowlevel_stat(seg + ".tar.gpg")['size']
+ remcount += 1
previous = set(segments)
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.
# Build checksum list for objects in the given segments, or all segments if
# none are specified.