Difference between revisions of "Configuration files"

From CRIU
Jump to: navigation, search
(Initial configuration file page)
 
Line 12: Line 12:
 
# CLI or RPC configuration options
 
# CLI or RPC configuration options
  
 +
The user can tell CRIU to completely ignore any configuration file in one of the default locations with the <code>--no-default-config</code> option. In this case the user can still tell CRIU to use a configuration file with the <code>--config FILENAME</code> option. CRIU also honours the environment variable <code>CRIU_CONFIG_FILE</code> just as <code>--config FILENAME</code> 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 ====
 +
<pre>$ 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</pre>
  
 
+
=== 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>.
 
 
  
 
[[Category:CLI]]
 
[[Category:CLI]]
 
[[Category:API]]
 
[[Category:API]]

Revision as of 20:40, 1 July 2018

This Page Is Work In Progress - Not Ready

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.