Difference between revisions of "Configuration files"

From CRIU
Jump to navigation Jump to search
Line 1: Line 1:
== This Page Is Work In Progress - Not Ready ==
+
== This Page Is Work In Progress - Not Ready - Not Merged into master ==
  
 
Many of CRIU's command-line options can also be influenced via configuration files. Configuration files are evaluated in [[CLI]] and [[RPC]] mode. It is important to know that configuration files are evaluated before the options set via CLI or RPC. This means that whatever is configured in the configuration files will be overwritten by explicitly set values via CLI or RPC.
 
Many of CRIU's command-line options can also be influenced via configuration files. Configuration files are evaluated in [[CLI]] and [[RPC]] mode. It is important to know that configuration files are evaluated before the options set via CLI or RPC. This means that whatever is configured in the configuration files will be overwritten by explicitly set values via CLI or RPC.
Line 26: Line 26:
 
=== Configuration Files in RPC Mode ===
 
=== Configuration Files in RPC Mode ===
 
As configuration file settings are overridden by CLI and RPC mode, there is a special RPC options which lets configuration file settings override RPC settings. This is different than the normal sequence and can lead to situation which break the RPC client -> CRIU setup. As this can lead to broken setups the RPC client has to explicitly enable this mode: <code>opts.prefer_config_file = True</code>.
 
As configuration file settings are overridden by CLI and RPC mode, there is a special RPC options which lets configuration file settings override RPC settings. This is different than the normal sequence and can lead to situation which break the RPC client -> CRIU setup. As this can lead to broken setups the RPC client has to explicitly enable this mode: <code>opts.prefer_config_file = True</code>.
 +
 +
=== Related ==
 +
* [https://github.com/checkpoint-restore/criu/issues/278 CRIU issue #278 : Add /etc/criu.conf and/or /etc/criu.d/ dir]
 +
* [https://github.com/checkpoint-restore/criu/issues/506 CRIU issue #506 : Pass options from docker cli to criu]
  
 
[[Category:CLI]]
 
[[Category:CLI]]
 
[[Category:API]]
 
[[Category:API]]

Revision as of 11:41, 4 July 2018

This Page Is Work In Progress - Not Ready - Not Merged into master

Many of CRIU's command-line options can also be influenced via configuration files. Configuration files are evaluated in CLI and RPC mode. It is important to know that configuration files are evaluated before the options set via CLI or RPC. This means that whatever is configured in the configuration files will be overwritten by explicitly set values via CLI or RPC.

Configuration File Location

The default configuration files parsed by CRIU, it they are present on the system, are first /etc/criu/default.conf and then $HOME/.criu/default.conf. Settings in the file /etc/criu/default.conf are overridden by settings in $HOME/.criu/default.conf.

Without any additional parameters CRIU configuration file parsing works like this:

  1. /etc/criu/default.conf; these values can be overridden by
  2. $HOME/.criu/default.conf; these values can be overridden by
  3. CLI or RPC configuration options

The user can tell CRIU to completely ignore any configuration file in one of the default locations with the --no-default-config option. In this case the user can still tell CRIU to use a configuration file with the --config FILENAME option. CRIU also honours the environment variable CRIU_CONFIG_FILE just as --config FILENAME option.

Configuration File Syntax

Comments are supported using the '#' character. The rest of the line is ignored. Options are the same as command line options without the '--' prefix, use one option per line (with corresponding argument if applicable, divided by whitespaces). If needed, the argument can be provided in double quotes (this should be needed only if the argument contains whitespaces). In case this type of argument contains a literal double quote as well, it can be escaped using the '\' character. Usage of commands is disallowed and all other escape sequences are interpreted literally.

Example of Configuration File

$ cat ~/.criu/default.conf
tcp-established
work-dir "/home/USERNAME/criu/my \"work\" directory"
#this is a comment
no-restore-sibling   # this is another comment

Configuration Files in RPC Mode

As configuration file settings are overridden by CLI and RPC mode, there is a special RPC options which lets configuration file settings override RPC settings. This is different than the normal sequence and can lead to situation which break the RPC client -> CRIU setup. As this can lead to broken setups the RPC client has to explicitly enable this mode: opts.prefer_config_file = True.

= Related