crit: Introduce 'info' action

This should print some information about image file itself, e.g.
statistical information. Right now print magic and the number of
object written in the file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov 2015-09-16 16:16:24 +03:00
parent e3f900f954
commit d2f8f481c7
2 changed files with 56 additions and 12 deletions

11
crit
View file

@ -41,6 +41,11 @@ def encode(opts):
img = json.load(inf(opts))
pycriu.images.dump(img, outf(opts))
def info(opts):
infs = pycriu.images.info(inf(opts))
json.dump(infs, sys.stdout, indent = 4)
print
def main():
desc = 'CRiu Image Tool'
parser = argparse.ArgumentParser(description=desc,
@ -73,6 +78,12 @@ def main():
help = 'where to put criu image in binary format (stdout by default)')
encode_parser.set_defaults(func=encode)
# Info
info_parser = subparsers.add_parser('info',
help = 'show info about image')
info_parser.add_argument("in")
info_parser.set_defaults(func=info)
# Show
show_parser = subparsers.add_parser('show',
help = "convert criu image from binary to human-readable json")