crit: Show no payload for image objects

In some images there can be quite a long "payload" -- some
raw data that is represented by base64 encoding. If we want
to explore huge images reading tons of base64 symbols can
be quite time consuming :) E.g. I a 1.5 gigs image with sysv
shmem was sent to me some time ago for investigation %)

So here is the --nopl argument for show action (decode should
produce encode-able image, so payload there is needed) that
just shows the amount of bytes in payload (if any).

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Pavel Emelyanov 2016-05-19 13:04:00 +03:00
parent f77cb85806
commit 4ead159258
2 changed files with 68 additions and 6 deletions

View file

@ -25,7 +25,7 @@ def decode(opts):
indent = None
try:
img = pycriu.images.load(inf(opts), opts['pretty'])
img = pycriu.images.load(inf(opts), opts['pretty'], opts['nopl'])
except pycriu.images.MagicException as exc:
print >>sys.stderr, "Unknown magic %#x.\n"\
"Maybe you are feeding me an image with "\
@ -265,6 +265,7 @@ def main():
show_parser = subparsers.add_parser('show',
help = "convert criu image from binary to human-readable json")
show_parser.add_argument("in")
show_parser.add_argument('--nopl', help = 'do not show entry payload (if exists)', action = 'store_true')
show_parser.set_defaults(func=decode, pretty=True, out=None)
opts = vars(parser.parse_args())