Difference between revisions of "Action scripts"

From CRIU
Jump to navigation Jump to search
Line 1: Line 1:
The criu can call your hooks on various stages of dumping/restoring. Cooks can be one of
+
With the --action-script command line option, CRIU can call your action scripts (also known as hooks) at various stages of dumping/restoring. Hooks can be one of
  
 
;network-lock
 
;network-lock
Line 9: Line 9:
 
;post-dump
 
;post-dump
 
: called when CRIU finished dumping tasks before unfreezing them
 
: called when CRIU finished dumping tasks before unfreezing them
 +
 +
;post-restore
 +
: called when CRIU has finished restoring tasks before unlocking the network
  
 
;setup-namespaces
 
;setup-namespaces

Revision as of 18:33, 30 December 2014

With the --action-script command line option, CRIU can call your action scripts (also known as hooks) at various stages of dumping/restoring. Hooks can be one of

network-lock
request to lock an LXC container network
network-unlock
requested to unlock an LXC container network
post-dump
called when CRIU finished dumping tasks before unfreezing them
post-restore
called when CRIU has finished restoring tasks before unlocking the network
setup-namespaces
called when the root task is alive and new set of namespaces is created to set them up


CLI

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.

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 criu_req message having notify_success = true.

Library

When using a library one can setup a callback using the criu_set_notify routine.