Line 1: |
Line 1: |
− | This page describes the CRiu Image Tool. CRIT is a feature-rich replacement for existing "criu show". | + | ''This page describes the CRIT Python tool. For the Go library, see [[CRIT (Go library)]]''. |
| + | |
| + | CRiu Image Tool is a feature-rich replacement for existing "criu show". |
| It is written completely in Python, so it is quite easy to read the code and extend its features. | | It is written completely in Python, so it is quite easy to read the code and extend its features. |
| | | |
Line 23: |
Line 25: |
| === Pretty output === | | === Pretty output === |
| | | |
− | Command <decode> prints JSON text in one line. This can be read by any further JSON-aware tool for parsing. For human eyes it's more convenient to read JSON multi-line with indentation. CRIT can do this when using the <code>show</code> action or the <code>--pretty</code> option.
| + | <code>crit decode</code> prints JSON text in one line. This can be read by any further JSON-aware tool for parsing. For human eyes it's more convenient to read JSON multi-line with indentation. CRIT can do this when using the <code>show</code> action or the <code>--pretty</code> option. |
| | | |
| Wend doing pretty optput CRIT does a little bit more, than just multiline indented JSON. | | Wend doing pretty optput CRIT does a little bit more, than just multiline indented JSON. |
Line 44: |
Line 46: |
| == Functionality == | | == Functionality == |
| | | |
− | === Convert images to JSON From IMG === | + | === Convert images from IMG to JSON === |
| | | |
| | | |
− | This is the replacement for (rather nasty) <code>criu show</code> code. Also this is the way to edit the images before restoring from them.
| + | <code>crit decode</code> is the replacement for the (rather nasty) <code>criu show</code> code. This is also the way to edit the images before restoring from them. |
| | | |
| 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. | | 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. |
Line 417: |
Line 419: |
| | | |
| <pre> | | <pre> |
− | cat "core-5679.json" | crit decode | + | cat "core-5679.img" | crit decode |
| </pre> | | </pre> |
| | | |
− | === Convert images from Json to IMG === | + | === Convert images from JSON to IMG === |
| | | |
− | This Converts the image from Json to IMG.Standard usage would look like
| + | <code>crit encode</code> converts the image from JSON to IMG. Standard usage would look like: |
| | | |
| <pre> | | <pre> |
Line 434: |
Line 436: |
| </pre> | | </pre> |
| | | |
− | Incase a "-o" Flag is not specified the input is piped out to STDOUT. | + | Incase a "-o" flag is not specified the input is piped out to STDOUT. |
| | | |
| === Generate core files out of task images === | | === Generate core files out of task images === |
Line 442: |
Line 444: |
| === Show images statistics === | | === Show images statistics === |
| | | |
− | E.g. -- total number of processes, files, memory, sockets, etc. | + | <code>crit x</code> allows you to explore image statistics. |
− | Use
| + | E.g. Total number of processes, files, memory, sockets, etc. |
| + | |
| <pre> | | <pre> |
| crit x $directory_with_images <explore type> | | crit x $directory_with_images <explore type> |
Line 477: |
Line 480: |
| === 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. For details, see https://github.com/xemul/criu/issues/59. | + | There's an idea to make CRIU spawn CRIT and read images "through" it, to allow for at-the-restore-time modifications. For details, see https://github.com/checkpoint-restore/criu/issues/59. |
| | | |
| === Convert between different image versions === | | === Convert between different image versions === |
Line 489: |
Line 492: |
| * the inter-images IDs are in consistent state | | * the inter-images IDs are in consistent state |
| | | |
− | For details, see https://github.com/xemul/criu/issues/44. | + | For details, see https://github.com/checkpoint-restore/criu/issues/44. |
| | | |
| === [[Anonymize image files]] === | | === [[Anonymize image files]] === |