[CRIU] [PATCH 0/7] CRiu Image Tool(crit), v4

Pavel Emelyanov xemul at parallels.com
Mon Jan 12 07:06:30 PST 2015


OK, I like what is there in the set :) Let's do a set of incremental changes
and I'll apply the set. Or, if you prefer, just rework the whole set. So.

1. In order to print the contents of the file on the screen in
human readable format the CLI I should use is

# ./crit convert -i test/dump/static/env00/4300/1/reg-files.img

This is strange, as "convert" generally means converting from one
format _to_ _another_ and in this case we always convert to json and
no other format.

>From my perspective we should either rename action name from convert to
"show", "decode" or smth like this or require the target format to be
explicitly specified. The former is more preferable from my perspective.

2. Let's look at the output of inventory.img

{
    "magic": "INVENTORY", 
    "entries": [
        {
            "payload": {
                "root_cg_set": "1", 
                "ns_per_id": "true", 
                "fdinfo_per_id": "true", 
                "root_ids": {
                    "sighand_id": "1", 
                    "pid_ns_id": "1", 
                    "uts_ns_id": "4", 
                    "net_ns_id": "2", 
                    "files_id": "1", 
                    "user_ns_id": "6", 
                    "ipc_ns_id": "3", 
                    "fs_id": "1", 
                    "mnt_ns_id": "5", 
                    "vm_id": "1"
                }, 
                "img_version": "1"
            }
        }
    ]
}[root at localhost criu]#

I have the following concerns about it.

a) No newline after the last }
b) The "payload" field is obfuscating, there's no such thing in the pb images.
c) Why all the values are in ""-s?

3. Let's now look at reg-files.img

{
    "magic": "REG_FILES", 
    "entries": [
        {
            "payload": {
                "fown": {
                    "pid_type": "0", 
                    "signum": "0", 
                    "pid": "0", 
                    "uid": "0", 
                    "euid": "0"
                }, 
                "flags": "32770", 
                "id": "1", 
                "name": "\"/dev/null\"", 
                "pos": "0"
            }
        }, 
        {
            "payload": {
                "name": "\"/\"", 
                "fown": {
                    "pid_type": "0", 
                    "signum": "0", 
                    "pid": "0", 
                    "uid": "0", 
                    "euid": "0"
                }, 
                "pos": "0", 
                "flags": "33793", 
                "id": "2", 
                "size": "0"
            }
        }, 

Other than those from inventory, the concerns here are:

a) The order of fields differs from entry to entry.
b) The name of the 2nd entry is just /, but in the output it takes 7 characters to print one.

4. Next the pagemap.img

{
    "magic": "PAGEMAP", 
    "entries": [
        {
            "payload": {
                "pages_id": "1"
            }, 
            "extra": [
                {
                    "nr_pages": "1", 
                    "vaddr": "4194304"
                }, 

Similar to the inventory, field "extra" is obfuscating.

5. And the last one is pages.img. The output is

Traceback (most recent call last):
  File "./crit", line 76, in <module>
    main()
  File "./crit", line 73, in main
    cmds[opts['command']](opts)
  File "./crit", line 45, in convert_img
    img = pycriu.images.loads(in_str)
  File "/root/src/criu/pycriu/images/images.py", line 271, in loads
    return load(f)
  File "/root/src/criu/pycriu/images/images.py", line 254, in load
    raise Exception("Unknown magic "+str(img_magic))
Exception: Unknown magic 1179403647

Can we catch this exception and print something meaningful?

Thanks,
Pavel



More information about the CRIU mailing list