[CRIU] [PATCH 0/4 v4] Implementation of configuration files

vkabatov at redhat.com vkabatov at redhat.com
Fri Jun 16 18:17:17 MSK 2017


From: Veronika Kabatova <vkabatov at redhat.com>

This patchset addresses GitHub issue #278 - add support for configuration files.
Configuration files allow users to write their most used options into a file
and reuse them instead of typing them all the time on the command line. Two
methods for configuration file usage are introduced:
    -- passing a specific file with --config FILEPATH
    -- configuration files /etc/criu/default.conf and $HOME/.criu/default.conf
       are parsed (in this order) by default if present (can be disabled by
       --no-default-config option)

Configuration file hierarchy aims to be consistent with command line usage (no
difference between using configuration files and command line with the right
order of options), which allows overriding of boolean options and partial
specification when using options which can be used more times.

Configuration file format allows comments and uses long options syntax,
therefore a long version for verbosity option needed to be introduced first for
users who would wish to specify verbosity settings in the configuration files.

The test suite was modified to use --no-default-config to not break when run
on system which would be using default configuration files and a simple test
is added to check option parsing is working properly.

Changes since v1:
   - code cleanup (mostly variable naming and indexing)
   - move #defines from header
   - fix bug with comparison branching
   - add comment to explain allocation of config init value
   - remove default switch branch
   - move all declaration to beginning of functions
   - move most of config-related stuff to separate functions and keep only
     minimum of code in main()

Changes since v2:
   - implementation of fscanf() on my machine does not trigger warning about
     ignored return value (glibc-headers-2.23.1-11.fc24.x86_64)

Changes since v3:
   - address avagin's comments
     - rework parser to accept arguments with spaces
     - rename configuration directories to criu and .criu instead of criu.d
       and .criu.d, respectively
     - merge functions for --help and --no-default-config detection to reduce
       number of iterations through argv (merging with --config NAME retrieval
       is not really possible due to the type of return value)
     - minor code changes (static function, move of xmalloc call, error
       reporting and fail)
     - removal of code for memory cleanup

Veronika Kabatova (4):
  Add long option for verbosity changes
  Add support for configuration files
  Add documentation for configuration files
  Modify and add test for configuration file functionality

 Documentation/criu.txt                     |  44 +++++-
 criu/Makefile                              |   7 +
 criu/crtools.c                             | 236 +++++++++++++++++++++++++++--
 test/Makefile                              |   2 +-
 test/zdtm.py                               |   7 +-
 test/zdtm/static/Makefile                  |   1 +
 test/zdtm/static/config_inotify_irmap.c    |  91 +++++++++++
 test/zdtm/static/config_inotify_irmap.desc |   3 +
 8 files changed, 374 insertions(+), 17 deletions(-)
 create mode 100644 test/zdtm/static/config_inotify_irmap.c
 create mode 100644 test/zdtm/static/config_inotify_irmap.desc

-- 
2.7.4



More information about the CRIU mailing list