Tree after restore

Revision as of 18:04, 20 September 2016 by Kir (talk | contribs) (Do not abuse "definition list" for something that should be handled by subsections; English, formatting etc)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The restore command has several options on how to restore the process tree.

Types of restoreEdit

DefaultEdit

CRIU just forks the root task and all other tasks, restores the tasks, then waits for it to exit and after it exits itself. The process tree right after restore is shown on the picture below.

 


DetachedEdit

An option --restore-detached makes CRIU exit right after restoring the tree thus causing it to get reparented to the init process.

 


SiblingEdit

An option --restore-sibling makes CRIU create root task as its own sibling and thus as caller's child. After restore is complete CRIU also exits thus leaving the restored tree being a pure child of the caller.

 


Doing execv() in CRIUEdit

In the default restore case it's possible to replace CRIU hanging between the caller process and the root one with something more useful. The --exec-cmd option makes CRIU call execv() with arguments that are to be given at the very end of the CLI after -- argument. For example:

criu restore --images-dir img/ --exec-cmd -v4 -o restore.log -- my_waiter --my-waiter-arg

In this case the restored tree will look like in the default case, but with the custom binary instead of the CRIU process.

 

Getting PID of the treeEdit

In case the process tree lives in namespaces or is restored in new namespaces, the real PID of the root task is not predefined. A way to obtain its value depends on the API used.

CLIEdit

In CLI, --pidfile path option can be used for CRIU to write the PID of the root task to a path file.

RPCEdit

In case of RPC, the real PID of the restored root task is reported back in the criu_resp.restore.pid field of the message.

See alsoEdit