-
Notifications
You must be signed in to change notification settings - Fork 678
cr-service: Refactor RPC config parsing #2728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cr-service: Refactor RPC config parsing #2728
Conversation
8e1b574 to
247c479
Compare
247c479 to
91cdf5d
Compare
|
Could you explain why we need to parse it twice? Why do we need to handle log-file, workdir before parsing other options? Why we can't handle these option on the second run? |
|
@avagin The only information I found are the following commit messages: cr-service: add support for configuration files in RPC mode
Fix RPC configuration file handling
@adrianreber Do you remember by any chance why we need to parse the RPC configuration file twice? |
I think we need to rework how these options are handled. |
91cdf5d to
aab4344
Compare
@avagin I've updated the pull request with these changes. |
|
Concerning this line from the commit:
This is not true. Probably better to remove that line. Because you will be loosing early log messages with this change. Output from a couple of functions ( |
|
Thanks for the comments Adrian!
Early log messages are still preserved with this change. We handle these in log_init() with |
That is good to know. Maybe add that as a comment in the code or commit. |
aab4344 to
cb984b6
Compare
9d89004 to
bdfedae
Compare
bdfedae to
c945890
Compare
When an additional configuration file is specified via RPC, this file is parsed twice: first at an early stage to load options such as --log-file, --work-dir, and --images-dir; and again after all RPC options and configuration files have been evaluated. This allows users to overwrite options specified via RPC by the container runtime (e.g., --tcp-established). However, processing the RPC config file twice leads to silently duplicating the values of repeatable options such as `--action-script`. To address this problem, we adjust the order of options parsing so that the RPC config file is evaluated only once. This change should not introduce any functional changes. Note that this change does not affect the logging functionality, as early log messages are temporarily buffered and only written to the log file once it has been initialized (see commit 1ff2333 "Printout early log messages"). Fixes checkpoint-restore#2727 Suggested-by: Andrei Vagin <avagin@google.com> Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Extend the test for overwriting config options via RPC with repeatable option (--action-script) and verify that the value will not be silently duplicated. Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
c945890 to
659a158
Compare
When an additional configuration file is specified via RPC, this file is parsed twice: first at an early stage to load options such as
--log-file,--work-dir, and--images-dir; and again after all RPC options and configuration files have been evaluated.This allows users to overwrite options specified via RPC by the container runtime (e.g.,
--tcp-established). However, processing the RPC config file twice leads to silently duplicating the values of repeatable options such as--action-script.To address this problem, we adjust the order of options parsing so that the RPC config file is evaluated only once. This does not introduce any functional changes.
Fixes #2727