| Line 1: |
Line 1: |
| | This page describes the CRiu Image Tool. | | This page describes the CRiu Image Tool. |
| | + | {{Note|As for now(24 Nov 2014) it is not added to the official repo, but you could checkout it [https://github.com/efiop/criu/tree/crit-test here].}} |
| | + | |
| | + | == Usage == |
| | + | <pre>Usage: crit [-h] [-i IN] [-o OUT] [-f {raw,nice}] [-t {json}] {convert} |
| | + | |
| | + | CRiu Image Tool |
| | + | |
| | + | positional arguments: |
| | + | {convert} use "covert" to convert CRIU image to/from human- |
| | + | readable format |
| | + | |
| | + | optional arguments: |
| | + | -h, --help show this help message and exit |
| | + | -i IN, --in IN input file (stdin by default) |
| | + | -o OUT, --out OUT output file (stdout by default |
| | + | -f {raw,nice}, --format {raw,nice} |
| | + | well-formated output (by default: raw for files and |
| | + | nice for stdout) |
| | + | -t {json}, --type {json} |
| | + | Type of output file (by default img is converted to |
| | + | txt and vice versa) |
| | + | </pre> |
| | | | |
| | == Functionality == | | == Functionality == |
| | | | |
| | === Convert images to human-readable and back === | | === Convert images to human-readable and back === |
| | + | This is the replacement for (rather nasty) criu show code. Also this is the way to edit the images before restoring from them. |
| | + | |
| | + | '''Status: Ready'''<br> |
| | + | It uses [https://developers.google.com/protocol-buffers/docs/reference/python/google.protobuf.text_format-module text_format] as a human-readable format for protobuf messages. |
| | + | Output file is structured like: |
| | + | With "--format raw": |
| | + | <pre> |
| | + | #<magic value> |
| | + | #0 |
| | + | <pb entry in text_format> |
| | + | .... |
| | + | #N |
| | + | <pb entry in text_format> |
| | + | </pre> |
| | + | With "--format nice": |
| | + | <pre> |
| | + | #<magic name> |
| | + | #0 <pb entry name> |
| | + | <pb entry in text_format with tabs> |
| | + | .... |
| | + | #N <pb entry name> |
| | + | <pb entry in text_format with tabs> |
| | + | </pre> |
| | | | |
| − | This is the replacement for (rather nasty) criu show code. Also this is the way to edit the images before restoring from them.
| + | So, here is how core file will look like with --format nice: |
| | + | <pre> |
| | + | #CORE |
| | + | #0 core_entry |
| | + | mtype: X86_64 |
| | + | thread_info { |
| | + | clear_tid_addr: 0 |
| | + | gpregs { |
| | + | r15: 0 |
| | + | r14: 19884608 |
| | + | r13: 1 |
| | + | r12: 0 |
| | + | bp: 19879232 |
| | + | bx: 0 |
| | + | r11: 582 |
| | + | r10: 0 |
| | + | r9: 0 |
| | + | r8: 19879232 |
| | + | ax: 61 |
| | + | cx: 18446744073709551615 |
| | + | dx: 0 |
| | + | si: 140733241187376 |
| | + | di: 18446744073709551615 |
| | + | orig_ax: 61 |
| | + | ip: 213251769082 |
| | + | cs: 51 |
| | + | flags: 582 |
| | + | sp: 140733241187336 |
| | + | ss: 43 |
| | + | fs_base: 140140334651200 |
| | + | gs_base: 0 |
| | + | ds: 0 |
| | + | es: 0 |
| | + | fs: 0 |
| | + | gs: 0 |
| | + | } |
| | + | fpregs { |
| | + | cwd: 895 |
| | + | swd: 0 |
| | + | twd: 0 |
| | + | fop: 0 |
| | + | rip: 0 |
| | + | rdp: 0 |
| | + | mxcsr: 8064 |
| | + | mxcsr_mask: 65535 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | st_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 4294967295 |
| | + | xmm_space: 4294967295 |
| | + | xmm_space: 16777215 |
| | + | xmm_space: 16843009 |
| | + | xmm_space: 16843009 |
| | + | xmm_space: 16843009 |
| | + | xmm_space: 4478800 |
| | + | xmm_space: 661857632 |
| | + | xmm_space: 1869488186 |
| | + | xmm_space: 543236212 |
| | + | xmm_space: 1970037624 |
| | + | xmm_space: 1680696676 |
| | + | xmm_space: 775778921 |
| | + | xmm_space: 544500071 |
| | + | xmm_space: 2019896621 |
| | + | xmm_space: 1685417059 |
| | + | xmm_space: 1768172901 |
| | + | xmm_space: 1747860850 |
| | + | xmm_space: 809328999 |
| | + | xmm_space: 909327153 |
| | + | xmm_space: 1932405306 |
| | + | xmm_space: 809334896 |
| | + | xmm_space: 909327153 |
| | + | xmm_space: 2016291386 |
| | + | xmm_space: 1030123635 |
| | + | xmm_space: 859517232 |
| | + | xmm_space: 14902 |
| | + | xmm_space: 0 |
| | + | xmm_space: 65 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 4294967295 |
| | + | xmm_space: 4294967295 |
| | + | xmm_space: 4294967295 |
| | + | xmm_space: 4294967295 |
| | + | xmm_space: 4294967040 |
| | + | xmm_space: 4294967295 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | xmm_space: 0 |
| | + | } |
| | + | } |
| | + | tc { |
| | + | task_state: 1 |
| | + | exit_code: 0 |
| | + | personality: 0 |
| | + | flags: 1077960704 |
| | + | blk_sigset: 65536 |
| | + | comm: "loop.sh" |
| | + | timers { |
| | + | real { |
| | + | isec: 0 |
| | + | iusec: 0 |
| | + | vsec: 0 |
| | + | vusec: 0 |
| | + | } |
| | + | virt { |
| | + | isec: 0 |
| | + | iusec: 0 |
| | + | vsec: 0 |
| | + | vusec: 0 |
| | + | } |
| | + | prof { |
| | + | isec: 0 |
| | + | iusec: 0 |
| | + | vsec: 0 |
| | + | vusec: 0 |
| | + | } |
| | + | } |
| | + | rlimits { |
| | + | rlimits { |
| | + | cur: 18446744073709551615 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | rlimits { |
| | + | cur: 18446744073709551615 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | rlimits { |
| | + | cur: 18446744073709551615 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | rlimits { |
| | + | cur: 8388608 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | rlimits { |
| | + | cur: 0 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | rlimits { |
| | + | cur: 18446744073709551615 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | rlimits { |
| | + | cur: 3898 |
| | + | max: 3898 |
| | + | } |
| | + | rlimits { |
| | + | cur: 1024 |
| | + | max: 4096 |
| | + | } |
| | + | rlimits { |
| | + | cur: 65536 |
| | + | max: 65536 |
| | + | } |
| | + | rlimits { |
| | + | cur: 18446744073709551615 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | rlimits { |
| | + | cur: 18446744073709551615 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | rlimits { |
| | + | cur: 3898 |
| | + | max: 3898 |
| | + | } |
| | + | rlimits { |
| | + | cur: 819200 |
| | + | max: 819200 |
| | + | } |
| | + | rlimits { |
| | + | cur: 0 |
| | + | max: 0 |
| | + | } |
| | + | rlimits { |
| | + | cur: 0 |
| | + | max: 0 |
| | + | } |
| | + | rlimits { |
| | + | cur: 18446744073709551615 |
| | + | max: 18446744073709551615 |
| | + | } |
| | + | } |
| | + | cg_set: 1 |
| | + | signals_s { |
| | + | } |
| | + | } |
| | + | thread_core { |
| | + | futex_rla: 0 |
| | + | futex_rla_len: 24 |
| | + | sched_nice: 0 |
| | + | sched_policy: 0 |
| | + | sas { |
| | + | ss_sp: 0 |
| | + | ss_size: 0 |
| | + | ss_flags: 2 |
| | + | } |
| | + | signals_p { |
| | + | } |
| | + | } |
| | + | </pre> |
| | | | |
| | === Convert to json (and back) === | | === Convert to json (and back) === |
| Line 11: |
Line 309: |
| | Same as before, but the human-readable format is JSON | | Same as before, but the human-readable format is JSON |
| | | | |
| | + | '''Status: Ready'''<br> |
| | + | For now, it does it in a dumb way, by just wrapping text_format in brackets and adding ";" where needed. |
| | + | Example: |
| | + | <pre> |
| | + | { |
| | + | "magic": "CORE", |
| | + | "0": { |
| | + | "mtype": "X86_64", |
| | + | "thread_core": { |
| | + | "futex_rla_len": "24", |
| | + | "sched_policy": "0", |
| | + | "sched_nice": "0", |
| | + | "futex_rla": "0", |
| | + | "signals_p": {}, |
| | + | "sas": { |
| | + | "ss_size": "0", |
| | + | "ss_sp": "0", |
| | + | "ss_flags": "2" |
| | + | } |
| | + | }, |
| | + | "pbtype": "core_entry", |
| | + | "thread_info": { |
| | + | "fpregs": { |
| | + | "st_space": [ |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0" |
| | + | ], |
| | + | "fop": "0", |
| | + | "rdp": "0", |
| | + | "twd": "0", |
| | + | "mxcsr": "8064", |
| | + | "swd": "0", |
| | + | "rip": "0", |
| | + | "xmm_space": [ |
| | + | "0", |
| | + | "0", |
| | + | "4294967295", |
| | + | "4294967295", |
| | + | "16777215", |
| | + | "16843009", |
| | + | "16843009", |
| | + | "16843009", |
| | + | "4478800", |
| | + | "661857632", |
| | + | "1869488186", |
| | + | "543236212", |
| | + | "1970037624", |
| | + | "1680696676", |
| | + | "775778921", |
| | + | "544500071", |
| | + | "2019896621", |
| | + | "1685417059", |
| | + | "1768172901", |
| | + | "1747860850", |
| | + | "809328999", |
| | + | "909327153", |
| | + | "1932405306", |
| | + | "809334896", |
| | + | "909327153", |
| | + | "2016291386", |
| | + | "1030123635", |
| | + | "859517232", |
| | + | "14902", |
| | + | "0", |
| | + | "65", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "4294967295", |
| | + | "4294967295", |
| | + | "4294967295", |
| | + | "4294967295", |
| | + | "4294967040", |
| | + | "4294967295", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0", |
| | + | "0" |
| | + | ], |
| | + | "cwd": "895", |
| | + | "mxcsr_mask": "65535" |
| | + | }, |
| | + | "clear_tid_addr": "0", |
| | + | "gpregs": { |
| | + | "gs": "0", |
| | + | "ip": "213251769082", |
| | + | "cx": "18446744073709551615", |
| | + | "cs": "51", |
| | + | "ax": "61", |
| | + | "orig_ax": "61", |
| | + | "di": "18446744073709551615", |
| | + | "es": "0", |
| | + | "gs_base": "0", |
| | + | "r14": "19884608", |
| | + | "r15": "0", |
| | + | "r12": "0", |
| | + | "r13": "1", |
| | + | "r10": "0", |
| | + | "r11": "582", |
| | + | "fs_base": "140140334651200", |
| | + | "bp": "19879232", |
| | + | "dx": "0", |
| | + | "bx": "0", |
| | + | "ds": "0", |
| | + | "ss": "43", |
| | + | "sp": "140733241187336", |
| | + | "r8": "19879232", |
| | + | "r9": "0", |
| | + | "fs": "0", |
| | + | "si": "140733241187376", |
| | + | "flags": "582" |
| | + | } |
| | + | }, |
| | + | "tc": { |
| | + | "timers": { |
| | + | "real": { |
| | + | "isec": "0", |
| | + | "vusec": "0", |
| | + | "iusec": "0", |
| | + | "vsec": "0" |
| | + | }, |
| | + | "virt": { |
| | + | "isec": "0", |
| | + | "vusec": "0", |
| | + | "iusec": "0", |
| | + | "vsec": "0" |
| | + | }, |
| | + | "prof": { |
| | + | "isec": "0", |
| | + | "vusec": "0", |
| | + | "iusec": "0", |
| | + | "vsec": "0" |
| | + | } |
| | + | }, |
| | + | "cg_set": "1", |
| | + | "signals_s": {}, |
| | + | "blk_sigset": "65536", |
| | + | "exit_code": "0", |
| | + | "rlimits": { |
| | + | "rlimits": [ |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "18446744073709551615" |
| | + | }, |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "18446744073709551615" |
| | + | }, |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "18446744073709551615" |
| | + | }, |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "8388608" |
| | + | }, |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "0" |
| | + | }, |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "18446744073709551615" |
| | + | }, |
| | + | { |
| | + | "max": "3898", |
| | + | "cur": "3898" |
| | + | }, |
| | + | { |
| | + | "max": "4096", |
| | + | "cur": "1024" |
| | + | }, |
| | + | { |
| | + | "max": "65536", |
| | + | "cur": "65536" |
| | + | }, |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "18446744073709551615" |
| | + | }, |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "18446744073709551615" |
| | + | }, |
| | + | { |
| | + | "max": "3898", |
| | + | "cur": "3898" |
| | + | }, |
| | + | { |
| | + | "max": "819200", |
| | + | "cur": "819200" |
| | + | }, |
| | + | { |
| | + | "max": "0", |
| | + | "cur": "0" |
| | + | }, |
| | + | { |
| | + | "max": "0", |
| | + | "cur": "0" |
| | + | }, |
| | + | { |
| | + | "max": "18446744073709551615", |
| | + | "cur": "18446744073709551615" |
| | + | } |
| | + | ] |
| | + | }, |
| | + | "comm": "\"loop.sh\"", |
| | + | "flags": "1077960704", |
| | + | "task_state": "1", |
| | + | "personality": "0" |
| | + | } |
| | + | } |
| | + | } |
| | + | </pre> |
| | === Generate core files out of task images === | | === Generate core files out of task images === |
| | | | |
| | All the needed information is in core-$pid.img and pagemap-$pid.img | | All the needed information is in core-$pid.img and pagemap-$pid.img |
| | + | |
| | + | '''Status: Not ready''' |
| | | | |
| | === On-the-fly conversion === | | === On-the-fly conversion === |
| | | | |
| | There's an idea to make CRIU spawn CRIT and read images "through" it, to allow for at-the-restore-time modifications | | There's an idea to make CRIU spawn CRIT and read images "through" it, to allow for at-the-restore-time modifications |
| | + | |
| | + | '''Status: Not ready''' |
| | | | |
| | === Convert between different image versions === | | === Convert between different image versions === |
| | | | |
| | Right now we store the images version in inventory.img and collect info about [[what's bad with V1 images]]. If some day we have v2, CRIT will convert from v1. And for backward compatibility we'll use on-the-fly conversion when restoring from old images. | | Right now we store the images version in inventory.img and collect info about [[what's bad with V1 images]]. If some day we have v2, CRIT will convert from v1. And for backward compatibility we'll use on-the-fly conversion when restoring from old images. |
| | + | |
| | + | '''Status: Not ready''' |
| | | | |
| | === Show images statistics === | | === Show images statistics === |
| | | | |
| | E.g. -- total number of processes, files, memory, sockets, etc. | | E.g. -- total number of processes, files, memory, sockets, etc. |
| | + | |
| | + | Status: Not ready |
| | | | |
| | === Check/validate images === | | === Check/validate images === |
| Line 32: |
Line 602: |
| | * all images are present | | * all images are present |
| | * the inter-images IDs are in consistent state | | * the inter-images IDs are in consistent state |
| | + | |
| | + | '''Status: Not ready''' |