From nobody Mon Sep 8 16:46:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=cyberus-technology.de Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1755508959717809.3635333934743; Mon, 18 Aug 2025 02:22:39 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0012DBAD; Mon, 18 Aug 2025 05:22:38 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A624FA5B; Mon, 18 Aug 2025 05:21:27 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EE821B3A; Mon, 18 Aug 2025 05:21:17 -0400 (EDT) Received: from BEUP281CU002.outbound.protection.outlook.com (mail-germanynorthazon11020110.outbound.protection.outlook.com [52.101.169.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3E8A09FC for ; Mon, 18 Aug 2025 05:21:08 -0400 (EDT) Received: from BEZP281MB1973.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:46::5) by FR0P281MB3097.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:50::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9031.24; Mon, 18 Aug 2025 09:21:03 +0000 Received: from BEZP281MB1973.DEUP281.PROD.OUTLOOK.COM ([fe80::7272:f32d:eb8d:e401]) by BEZP281MB1973.DEUP281.PROD.OUTLOOK.COM ([fe80::7272:f32d:eb8d:e401%5]) with mapi id 15.20.9031.023; Mon, 18 Aug 2025 09:21:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FORGED_SPF_HELO,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.4 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V1XBA70QtKhdD6GpqmXacP0yGdSXw7dztO9Z8LaQMH5PHggYnDR/hOpSkBFGYLoIU9Q9QANp5FNsf/EPc37oaXmGhAFrJsqzqZ4vgwSXpluVmXsU0hYg74prGGlH2qsA3irkI7m50T7kjIvJ98mioeQfu0m9ROpufMw+YqP+JGkAEJzdSkO6IOUoz9KPWI2T87by4KyPOBSqQT0PSeMsZMNfQhPeDkqTKVa9SBuxp+tWOnqVDqlBws1m4Fsedm6yqxGXDNS2KlKpqQCgat2TasP+CACkqmNyxy8yZbSfYy9DR3M44bBFvfPDAVzPhm8cSJQq5kHHWmJLeU6csGk82Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2L5YS/jD0R7lrytYaFAXJq0NTW8h0WeBlgKZLTCcZQk=; b=VqmYFYv5OHQF9BkI4gnajSwoyMTTnPtu90E1hfF0x887TCBla16sfyo3576+i7yj/E17ShF6OngG8LI8sPEgrvR7r2BLoIayq+CNhrklwPxpza596dbomuUlvyiCAI72U6I/JDKUGocHdBjqgrJ8H0Fewt9PB1itcV5ZHy6kQ2jZ+JUcZi4Gs4cl4Uw/uKJY2kStzxHeDMzyRac3N89/b6Zm62rtfuJJSImca4CCHAiRoiWPo9RWEacMbb/HZoW8oZJLpIcyk1yvmyWZayXbtH81iLwORRhNaYCqpxA/WwHpGOwOphDpfySqT0aaXPVMEMZVZmUzV8ZNWXY5S6B7vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cyberus-technology.de; dmarc=pass action=none header.from=cyberus-technology.de; dkim=pass header.d=cyberus-technology.de; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cyberus-technology.de; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2L5YS/jD0R7lrytYaFAXJq0NTW8h0WeBlgKZLTCcZQk=; b=mfhWYEHquDAiyrzGkBGRrDQEJZl2/HX8Rw7+g/QE0EeiYo+d/pyjN7e04HdHveQL/BJBrHDkcIuZn65fbu5seKjzeoP/NCtmEIU6o9zxJTQVajnukLREx/7LnE+yTViKaHk7bLk4QPuFSN8IVxEGJZhwKXTzc3UjUB9ixuxLq3KansQG4P7OklkEeRXsxTKzbdNTE01ulnY9QMAROF6xyia7e2TPXt4R7cSMGJehqhh8S8P58VqD/ZSn7nn6/UnhtLMSMMqwDBYhvY2DcvlkJGVqIM1XECpqFymRSY1+IiY0oOQaMvAatE11Yd8LUI/TGUZFKaDBpoln+RH9jdtdWQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cyberus-technology.de; From: Stefan Kober To: devel@lists.libvirt.org Subject: [PATCH v4 1/3] ch: Add config file support Date: Mon, 18 Aug 2025 11:20:53 +0200 Message-ID: <20250818092055.6539-2-stefan.kober@cyberus-technology.de> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250818092055.6539-1-stefan.kober@cyberus-technology.de> References: <20250818092055.6539-1-stefan.kober@cyberus-technology.de> X-ClientProxiedBy: FR2P281CA0165.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:99::7) To BEZP281MB1973.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:46::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BEZP281MB1973:EE_|FR0P281MB3097:EE_ X-MS-Office365-Filtering-Correlation-Id: f5d5f398-c9b5-4ca2-bb59-08ddde388d49 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|10070799003|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?s0cnmlOnND0cpN7SeXlLHOV1Gb8YNJ6KcxLpTzyWMij15gCYzdMHz44h1kz1?= =?us-ascii?Q?HpDAQOXQ0pMr1fzcveEas4HaBynYLZygQGbm/CJ1yIOCHnrwK1W9/+tl/irO?= =?us-ascii?Q?H1fcwrffLOdmmEP50/0v+qDzBbgJBGRSjvL9W04oXI2Vzb93qodEPi1Ekaol?= =?us-ascii?Q?qTESzThlSK5/Oo++ASyw8Cn/c0S4q/mIzp+ivJK8NBFvmXd75MJHpj3FhznN?= =?us-ascii?Q?12NoNUNDCjLV+aV5PjbfBJMNvSagjJVyg61GTTrBOzItTpITkHPKV0+r7qh/?= =?us-ascii?Q?VFQQILXG9Hv00trmgtURIA66l7FU45bPfRW6xbppTEQUaU2J8oPWt4MYJWYb?= =?us-ascii?Q?nYSdV82ugatpjLTi414uD6esgfviIPWUVDB5blGqu6kKQDHozQH9Z40Vxy9y?= =?us-ascii?Q?VYEh2gbIO6tI8z7b4JiJMoz0wbsa6vbIJXsSC603SzuYN1oVPl42Sqkqp/8P?= =?us-ascii?Q?qRsiC75BbNE4UtG5h17G+u6p8hjcm+ceU1/HXgUyXnrxe0JWryvXoNG0flqV?= =?us-ascii?Q?qLIN9bBPV61d816oB+hlZW/WCwQd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ii?Q?+7gSUAcvtiw=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BEZP281MB1973.DEUP281.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(10070799003)(1800799024)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xzqGoWMcpt34qPDETqVBVbf+vZqid1jG84/LgOEd6/5BmsvaMTKECTrTrysc?= =?us-ascii?Q?CZk8OPma4a8m12mVH3wKll/hRB//eSoK7IUPQAWy5iAr7WcqXR4nSscGIVT1?= =?us-ascii?Q?TqTdlqp4pNJvmf8uDfmpjQvdVEfjJC9h1mlliCtdB0TlygG1+mCVXdyvfVOj?= =?us-ascii?Q?oG/+8XCEkKk1o/Jsb51odbsYh0rkv+slXj4Z3TC3EMIk/aMeVD35FNS1QIJB?= =?us-ascii?Q?IEWbHdt+gcwnaKqUzu2GQ8YiVlfX2frOtqqGqo6sZ7IMX8pvSxHAPRs/IQPL?= =?us-ascii?Q?dV8LzU3e3pgnIXPBjwQ6qkIvddKbONLXXDkkn/cZh88oJ8tgPpzCtV2HzVJP?= =?us-ascii?Q?h0e9VTT85Fw8LZv59f4sCIVZYO+DrbSK4Wp0fi8PGNJOldWXoky1miJ+7gZA?= =?us-ascii?Q?eYshTHx0LwNzmrXVLJAavMjDO+7Mf88mNOPHitnDr1iEv6RfFHaAdbwbrpV/?= =?us-ascii?Q?R9q9EoQxEPCaIT13FAyvFCz3y6loIRt+7fivdTAZ/9xmtZuh9UDig1Gmm3Dp?= =?us-ascii?Q?GNdkAHpMrU+K890k5Ou+emAPjX1rmAWsMpcKUEn2Wx0RBpuIlI3c6DuUC09r?= =?us-ascii?Q?9J4LDfsgcZrYlZz+bFu625UPEgmUAAQuduLEZAYDIy0DIU9hgSEfJbbypvrm?= =?us-ascii?Q?2hUL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vG3bZnpfjPIe8T?= =?us-ascii?Q?guJEb/5q8t/nTBicaG3w7C1+QCfU9kGWHT7xVfaYZd9BthVfJ+xs8uR0rYgN?= =?us-ascii?Q?8khvrINtk21QIcjqCpLqMrR7CdGk71uZcdEtH1TmkLIg?= X-OriginatorOrg: cyberus-technology.de X-MS-Exchange-CrossTenant-Network-Message-Id: f5d5f398-c9b5-4ca2-bb59-08ddde388d49 X-MS-Exchange-CrossTenant-AuthSource: BEZP281MB1973.DEUP281.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2025 09:21:02.7791 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f4e0f4e0-9d68-4bd6-a95b-0cba36dbac2e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sWNNEIe2S7ljVKdFHCXEc/ul+/uj4KmPvu2GxVmCAnCw6rwbKgjMg16TxsFq85ndADiMm7kCm6YJ2aRm/vMxiKg/maPO+uJ1xpBG1Dsizwf8xS/pBeYN3v0xgXj34xFi X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR0P281MB3097 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XCEXV4TE33D63R56HZFE5JKH2MUU5YTX X-Message-ID-Hash: XCEXV4TE33D63R56HZFE5JKH2MUU5YTX X-MailFrom: stefan.kober@cyberus-technology.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Kober X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1755508961624124100 Content-Type: text/plain; charset="utf-8" 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 --- 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. +# 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 @@ =20 #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); } =20 +int virCHDriverConfigLoadFile(virCHDriverConfig *cfg, + const char *filename) +{ + g_autoptr(virConf) conf =3D NULL; + + /* Just check the file is readable before opening it, otherwise + * libvirt emits an error. + */ + if (access(filename, R_OK) =3D=3D -1) { + VIR_INFO("Could not read ch config file %s", filename); + return 0; + } + + if (!(conf =3D virConfReadFile(filename, 0))) + return -1; + + return 0; +} + /** * virCHDriverGetCapabilities: * @@ -149,6 +169,7 @@ virCHDriverConfigNew(bool privileged) cfg->logDir =3D g_strdup_printf("%s/log/libvirt/ch", LOCALSTATEDIR= ); cfg->stateDir =3D g_strdup_printf("%s/libvirt/ch", RUNSTATEDIR); cfg->saveDir =3D g_strdup_printf("%s/lib/libvirt/ch/save", LOCALST= ATEDIR); + cfg->configDir =3D g_strdup_printf("%s/lib/libvirt/ch", LOCALSTATE= DIR); =20 } else { g_autofree char *rundir =3D NULL; @@ -164,6 +185,7 @@ virCHDriverConfigNew(bool privileged) =20 configbasedir =3D virGetUserConfigDirectory(); cfg->saveDir =3D g_strdup_printf("%s/ch/save", configbasedir); + cfg->configDir =3D g_strdup_printf("%s/ch", configbasedir); } =20 return cfg; diff --git a/src/ch/ch_conf.h b/src/ch/ch_conf.h index b08573476e..2f0d090d35 100644 --- a/src/ch/ch_conf.h +++ b/src/ch/ch_conf.h @@ -38,6 +38,7 @@ struct _virCHDriverConfig { GObject parent; =20 char *stateDir; + char *configDir; char *logDir; char *saveDir; =20 @@ -103,6 +104,8 @@ struct _CHSaveXMLHeader { uint32_t unused[11]; }; =20 +int virCHDriverConfigLoadFile(virCHDriverConfig *cfg, + const char *filename); virCaps *virCHDriverCapsInit(void); virCaps *virCHDriverGetCapabilities(virCHDriver *driver, bool refresh); diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 3bdcf66ebd..cf6874f22e 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -1411,6 +1411,7 @@ chStateInitialize(bool privileged, virStateInhibitCallback callback G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { + g_autofree char *driverConf =3D NULL; int ret =3D VIR_DRV_STATE_INIT_ERROR; int rv; =20 @@ -1447,6 +1448,11 @@ chStateInitialize(bool privileged, if (!(ch_driver->config =3D virCHDriverConfigNew(privileged))) goto cleanup; =20 + driverConf =3D g_strdup_printf("%s/ch.conf", ch_driver->config->config= Dir); + + if (virCHDriverConfigLoadFile(ch_driver->config, driverConf) < 0) + goto cleanup; + if (!(ch_driver->hostdevMgr =3D virHostdevManagerGetDefault())) goto cleanup; =20 diff --git a/src/ch/libvirtd_ch.aug b/src/ch/libvirtd_ch.aug new file mode 100644 index 0000000000..d0b0964987 --- /dev/null +++ b/src/ch/libvirtd_ch.aug @@ -0,0 +1,40 @@ +(* /etc/libvirt/ch.conf *) + +module Libvirtd_ch =3D + autoload xfm + + let eol =3D del /[ \t]*\n/ "\n" + let value_sep =3D del /[ \t]*=3D[ \t]*/ " =3D " + let indent =3D del /[ \t]*/ "" + + let array_sep =3D del /,[ \t\n]*/ ", " + let array_start =3D del /\[[ \t\n]*/ "[ " + let array_end =3D del /\]/ "]" + + let str_val =3D del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\"" + let bool_val =3D store /0|1/ + let int_val =3D store /[0-9]+/ + let str_array_element =3D [ seq "el" . str_val ] . del /[ \t\n]*/ "" + let str_array_val =3D counter "el" . array_start . ( str_array_element = . ( array_sep . str_array_element ) * ) ? . array_end + + let str_entry (kw:string) =3D [ key kw . value_sep . str_val ] + let bool_entry (kw:string) =3D [ key kw . value_sep . bool_val ] + let int_entry (kw:string) =3D [ key kw . value_sep . int_val ] + let str_array_entry (kw:string) =3D [ key kw . value_sep . str_array_va= l ] + + (* Config entry grouped by function - same order as example config *) + let config_entry =3D bool_entry "placeholder" + + (* Each entry in the config is one of the following three ... *) + let entry =3D config_entry + let comment =3D [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \= t\n][^\n]*)?/ . del /\n/ "\n" ] + let empty =3D [ label "#empty" . eol ] + + let record =3D indent . entry . eol + + let lns =3D ( record | comment | empty ) * + + let filter =3D incl "/etc/libvirt/ch.conf" + . Util.stdexcl + + let xfm =3D transform lns filter --=20 2.50.1