Changes

1,150 bytes added ,  22:48, 28 February 2020
m
→‎Library: Replace 'criu_set_notify' with 'criu_set_notify_cb'
Line 1: Line 1: −
The criu can call your hooks on various stages of dumping/restoring. These hooks are added with the --action-script shell-code-to-execute option. When called, the CRTOOLS_SCRIPT_ACTION environment is set to a value determining which type of action is performed. It can be one of
+
With the <code>--action-script</code> command line option, CRIU can call your action scripts (also known as hooks) at various stages of dumping/restoring. The following hooks are available:
   −
;network-lock
+
;<code>pre-dump</code>
: request to lock an [[LXC]] container network
+
: called before the beginning of dump
   −
;network-unlock
+
;<code>post-dump</code>
: requested to unlock an [[LXC]] container network
+
: called when CRIU finished dumping tasks and before unfreezing them
   −
;post-dump
+
;<code>pre-restore</code>
: called when CRIU finished dumping tasks before unfreezing them
+
: called before the beginning of restore
   −
;setup-namespaces
+
;<code>post-restore</code>
 +
: called when CRIU has finished restoring tasks and before unlocking the network
 +
 
 +
;<code>network-lock</code>
 +
: request to lock a container network (used by [[Docker]] and [[LXC]])
 +
 
 +
;<code>network-unlock</code>
 +
: requested to unlock a container network (used by Docker and LXC)
 +
 
 +
;<code>setup-namespaces</code>
 
: called when the root task is alive and new set of namespaces is created to set them up
 
: called when the root task is alive and new set of namespaces is created to set them up
 +
 +
;<code>post-setup-namespaces</code>
 +
: called after namespaces are configured
 +
 +
;<code>pre-resume</code>
 +
: called at the moment when processes and resources are already restored but not yet in running state
 +
 +
;<code>post-resume</code>
 +
: called at the very end, when everything is restored and processes were resumed
 +
 +
;<code>orphan-pts-master</code>
 +
: called after master pty is opened and unlocked (used by Docker). Used only in RPC mode, and the notification message contains a file descriptor for the master pty.
 +
 +
== CLI ==
 +
 +
These hooks are added with the <code>--action-script ''shell-code-to-execute''</code> option. When called, the <code>CRTOOLS_SCRIPT_ACTION</code> environment is set to a value determining which type of action is performed.
    
== RPC ==
 
== RPC ==
   −
In case or RPC, action scripts are implemented as notifications -- once CRIU service wants to execute a script it send an RPC message to caller and waits for it to respond with <code>criu_req</code> message having <code>notify_success = true</code>.
+
In case of RPC, action scripts are implemented as notifications. Once CRIU service wants to execute a script, it sends an RPC message to the caller and waits for it to respond with <code>criu_req</code> message having <code>notify_success = true</code>.
 +
 
 +
== Library ==
 +
 
 +
When using a library, one can set up a callback using the <code>criu_set_notify_cb</code> routine.
 +
 
 +
[[Category:HOWTO]]
 +
[[Category:API]]
327

edits