On 8/18/25 11:20, Stefan Kober wrote:
> Similar to the QEMU driver, the ch driver receives support for
> configuration files that allows doing certain configuration on the
> virtchd daemon.
>
> The initial use case will be setting the verbosity of the cloud
> hypervisor instances started by virtchd, but the implementation allows
> for adding further options.
>
> Signed-off-by: Stefan Kober <[email protected]>
> ---
> src/ch/ch.conf | 3 +++
> src/ch/ch_conf.c | 22 ++++++++++++++++++++++
> src/ch/ch_conf.h | 3 +++
> src/ch/ch_driver.c | 6 ++++++
> src/ch/libvirtd_ch.aug | 40 ++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 74 insertions(+)
> create mode 100644 src/ch/ch.conf
> create mode 100644 src/ch/libvirtd_ch.aug
>
> diff --git a/src/ch/ch.conf b/src/ch/ch.conf
> new file mode 100644
> index 0000000000..8ce987f675
> --- /dev/null
> +++ b/src/ch/ch.conf
> @@ -0,0 +1,3 @@
> +# Master configuration file for the QEMU driver.
s/QEMU/CH/
> +# All settings described here are optional - if omitted, sensible
> +# defaults are used.
> diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c
> index cab97639c4..7d3f600707 100644
> --- a/src/ch/ch_conf.c
> +++ b/src/ch/ch_conf.c
> @@ -22,6 +22,7 @@
>
> #include "configmake.h"
> #include "vircommand.h"
> +#include "virconf.h"
> #include "virfile.h"
> #include "virlog.h"
> #include "virobject.h"
> @@ -81,6 +82,25 @@ virCaps *virCHDriverCapsInit(void)
> return g_steal_pointer(&caps);
> }
>
> +int virCHDriverConfigLoadFile(virCHDriverConfig *cfg,
This is unused, yet. G_GNUC_UNUSED annotation should be added here, only
to be removed in the next patch.
> + const char *filename)
> +{
> + g_autoptr(virConf) conf = NULL;
> +
> + /* Just check the file is readable before opening it, otherwise
> + * libvirt emits an error.
> + */
> + if (access(filename, R_OK) == -1) {
> + VIR_INFO("Could not read ch config file %s", filename);
> + return 0;
> + }
> +
> + if (!(conf = virConfReadFile(filename, 0)))
> + return -1;
> +
> + return 0;
> +}
> +
Michal