Changes

1,234 bytes added ,  16:31, 4 November 2022
m
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 40: Line 42:     
; Device numbers
 
; Device numbers
: If the field is known to be of <code>dev_t</code> type, it's printed in the <code>major:minor</code manner
+
: If the field is known to be of <code>dev_t</code> type, it's printed in the <code>major:minor</code> manner
    
== Functionality ==
 
== Functionality ==
   −
=== Convert images to JSON and back ===
+
=== 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 413: Line 415:  
</div>
 
</div>
 
</div>
 
</div>
 +
 +
Decode also supports input via STDIN instead of the "-i" flag.
 +
 +
<pre>
 +
cat "core-5679.img" | crit decode
 +
</pre>
 +
 +
=== Convert images from JSON to IMG ===
 +
 +
<code>crit encode</code> converts the image from JSON to IMG. Standard usage would look like:
 +
 +
<pre>
 +
crit encode -i core-5679.json -o core-5679.img
 +
</pre>
 +
 +
Encode also supports input via STDIN instead of the "-i" flag.
 +
 +
<pre>
 +
cat "core-5679.json" | crit encode
 +
</pre>
 +
 +
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 420: 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 435: Line 460:  
;'mems'
 
;'mems'
 
:to show memory mappings info
 
:to show memory mappings info
 +
 +
=== Show images Info ===
 +
 +
Image of a info such as its "COUNT" and "MAGIC" can be displayed using the INFO command.
 +
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
 +
<b>Example("crit info core-5679.img")</b>
 +
<div class="mw-collapsible-content">
 +
<pre>
 +
{
 +
    "count": 1,
 +
    "magic": "CORE"
 +
}
 +
</pre>
 +
</div>
 +
</div>
    
== Planned functionality ==
 
== Planned functionality ==
Line 440: 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
+
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.
 
  −
[https://github.com/xemul/criu/issues/59]
      
=== Convert between different image versions ===
 
=== Convert between different image versions ===
Line 454: Line 492:  
* the inter-images IDs are in consistent state
 
* the inter-images IDs are in consistent state
   −
[https://github.com/xemul/criu/issues/44]
+
For details, see https://github.com/checkpoint-restore/criu/issues/44.
 +
 
 +
=== [[Anonymize image files]] ===
 +
 
 +
Since images contain raw memory dumps people may refuse to send us images for debugging. Need to anonymize them, i.e. -- remove this sensitive information.
    
[[Category:Images]]
 
[[Category:Images]]
 
[[Category:API]]
 
[[Category:API]]
5

edits