libvirt-10.10.0-9.el9
- util: introduce object for holding a system inhibitor lock (RHEL-83064) - src: convert drivers over to new virInhibitor APIs (RHEL-83064) - rpc: remove logind support for virNetDaemon (RHEL-83064) - util: fix off-by-1 in inhibitor constants (RHEL-83064) - util: don't attempt to acquire logind inhibitor if not requested (RHEL-83064) - network: Free inhibitor in networkStateCleanup() (RHEL-83064) - conf: introduce support for multiple ACPI tables (RHEL-81041) - src: validate permitted ACPI table types in libxl/qemu drivers (RHEL-81041) - src: introduce 'raw' and 'rawset' ACPI table types (RHEL-81041) - qemu: support 'raw' ACPI table type (RHEL-81041) - libxl: support 'rawset' ACPI table type (RHEL-81041) - conf: support MSDM ACPI table type (RHEL-81041) - qemu: support MSDM ACPI table type (RHEL-81041) - qemuxmlconftest: Include shared memory 'net-vhostuser' test cases (RHEL-84133) - qemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces (RHEL-84133) - qemu: process: Remove un-updated 'qemuProcessStartWarnShmem' (RHEL-84133) Resolves: RHEL-81041, RHEL-83064, RHEL-84133
This commit is contained in:
parent
84b9f25cb1
commit
8026296455
422
libvirt-conf-introduce-support-for-multiple-ACPI-tables.patch
Normal file
422
libvirt-conf-introduce-support-for-multiple-ACPI-tables.patch
Normal file
@ -0,0 +1,422 @@
|
|||||||
|
From f4dffda866c49db8cd905d7fb4d35a70c996fa89 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <f4dffda866c49db8cd905d7fb4d35a70c996fa89.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Mon, 17 Feb 2025 16:30:07 +0000
|
||||||
|
Subject: [PATCH] conf: introduce support for multiple ACPI tables
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Currently we parse
|
||||||
|
|
||||||
|
<os>
|
||||||
|
<acpi>
|
||||||
|
<table type="slic">...path...</table>
|
||||||
|
</acpi>
|
||||||
|
</os>
|
||||||
|
|
||||||
|
into a flat 'char *slic_table' field which is rather an anti-pattern
|
||||||
|
as it has special cased a single attribute type.
|
||||||
|
|
||||||
|
This rewrites the internal design to permit multiple table types to
|
||||||
|
be parsed, should we add more in future. Each type is currently
|
||||||
|
permitted to only appear once.
|
||||||
|
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit 55f48d38522a4657815668dae9ed9184c8870766)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-81041
|
||||||
|
---
|
||||||
|
src/conf/domain_conf.c | 92 +++++++++++++++++++++++----------
|
||||||
|
src/conf/domain_conf.h | 21 +++++++-
|
||||||
|
src/libvirt_private.syms | 2 +
|
||||||
|
src/libxl/libxl_conf.c | 5 +-
|
||||||
|
src/libxl/xen_xl.c | 15 ++++--
|
||||||
|
src/qemu/qemu_command.c | 13 +++--
|
||||||
|
src/security/security_dac.c | 18 ++++---
|
||||||
|
src/security/security_selinux.c | 16 +++---
|
||||||
|
src/security/virt-aa-helper.c | 5 +-
|
||||||
|
9 files changed, 134 insertions(+), 53 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||||
|
index 095b9bbaa2..b0628da279 100644
|
||||||
|
--- a/src/conf/domain_conf.c
|
||||||
|
+++ b/src/conf/domain_conf.c
|
||||||
|
@@ -1456,6 +1456,11 @@ VIR_ENUM_IMPL(virDomainOsDefFirmwareFeature,
|
||||||
|
"secure-boot",
|
||||||
|
);
|
||||||
|
|
||||||
|
+VIR_ENUM_IMPL(virDomainOsACPITable,
|
||||||
|
+ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST,
|
||||||
|
+ "slic",
|
||||||
|
+);
|
||||||
|
+
|
||||||
|
VIR_ENUM_IMPL(virDomainCFPC,
|
||||||
|
VIR_DOMAIN_CFPC_LAST,
|
||||||
|
"none",
|
||||||
|
@@ -3890,6 +3895,15 @@ virDomainSecDefFree(virDomainSecDef *def)
|
||||||
|
g_free(def);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void virDomainOSACPITableDefFree(virDomainOSACPITableDef *def)
|
||||||
|
+{
|
||||||
|
+ if (!def)
|
||||||
|
+ return;
|
||||||
|
+ g_free(def->path);
|
||||||
|
+ g_free(def);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
virDomainOSDefClear(virDomainOSDef *os)
|
||||||
|
{
|
||||||
|
@@ -3915,7 +3929,9 @@ virDomainOSDefClear(virDomainOSDef *os)
|
||||||
|
g_free(os->cmdline);
|
||||||
|
g_free(os->dtb);
|
||||||
|
g_free(os->root);
|
||||||
|
- g_free(os->slic_table);
|
||||||
|
+ for (i = 0; i < os->nacpiTables; i++)
|
||||||
|
+ virDomainOSACPITableDefFree(os->acpiTables[i]);
|
||||||
|
+ g_free(os->acpiTables);
|
||||||
|
virDomainLoaderDefFree(os->loader);
|
||||||
|
g_free(os->bootloader);
|
||||||
|
g_free(os->bootloaderArgs);
|
||||||
|
@@ -17849,40 +17865,57 @@ virDomainDefParseBootAcpiOptions(virDomainDef *def,
|
||||||
|
int n;
|
||||||
|
g_autofree xmlNodePtr *nodes = NULL;
|
||||||
|
g_autofree char *tmp = NULL;
|
||||||
|
+ size_t ntables = 0;
|
||||||
|
+ virDomainOSACPITableDef **tables = NULL;
|
||||||
|
+ size_t i;
|
||||||
|
|
||||||
|
if ((n = virXPathNodeSet("./os/acpi/table", ctxt, &nodes)) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
- if (n > 1) {
|
||||||
|
- virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
- _("Only one acpi table is supported"));
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
+ if (n == 0)
|
||||||
|
+ return 0;
|
||||||
|
|
||||||
|
- if (n == 1) {
|
||||||
|
- tmp = virXMLPropString(nodes[0], "type");
|
||||||
|
+ tables = g_new0(virDomainOSACPITableDef *, n);
|
||||||
|
+ for (i = 0; i < n; i++) {
|
||||||
|
+ g_autofree char *path = virXMLNodeContentString(nodes[i]);
|
||||||
|
+ virDomainOsACPITable type;
|
||||||
|
+ size_t j;
|
||||||
|
|
||||||
|
- if (!tmp) {
|
||||||
|
- virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
- _("Missing acpi table type"));
|
||||||
|
- return -1;
|
||||||
|
+ if (!path)
|
||||||
|
+ goto error;
|
||||||
|
+
|
||||||
|
+ if (virXMLPropEnum(nodes[i], "type",
|
||||||
|
+ virDomainOsACPITableTypeFromString,
|
||||||
|
+ VIR_XML_PROP_REQUIRED,
|
||||||
|
+ &type) < 0)
|
||||||
|
+ goto error;
|
||||||
|
+
|
||||||
|
+ for (j = 0; j < i; j++) {
|
||||||
|
+ if (tables[j]->type == type) {
|
||||||
|
+ virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
+ _("ACPI table type '%1$s' may only appear once"),
|
||||||
|
+ virDomainOsACPITableTypeToString(type));
|
||||||
|
+ goto error;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (STREQ_NULLABLE(tmp, "slic")) {
|
||||||
|
- VIR_FREE(tmp);
|
||||||
|
- if (!(tmp = virXMLNodeContentString(nodes[0])))
|
||||||
|
- return -1;
|
||||||
|
-
|
||||||
|
- def->os.slic_table = virFileSanitizePath(tmp);
|
||||||
|
- } else {
|
||||||
|
- virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
- _("Unknown acpi table type: %1$s"),
|
||||||
|
- tmp);
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
+ tables[ntables] = g_new0(virDomainOSACPITableDef, 1);
|
||||||
|
+ tables[ntables]->type = type;
|
||||||
|
+ tables[ntables]->path = virFileSanitizePath(path);
|
||||||
|
+ ntables++;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ def->os.nacpiTables = ntables;
|
||||||
|
+ def->os.acpiTables = tables;
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
+
|
||||||
|
+ error:
|
||||||
|
+ for (i = 0; i < ntables; i++) {
|
||||||
|
+ virDomainOSACPITableDefFree(tables[i]);
|
||||||
|
+ }
|
||||||
|
+ g_free(tables);
|
||||||
|
+ return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -28447,11 +28480,16 @@ virDomainDefFormatInternalSetRootName(virDomainDef *def,
|
||||||
|
def->os.dtb);
|
||||||
|
virBufferEscapeString(buf, "<root>%s</root>\n",
|
||||||
|
def->os.root);
|
||||||
|
- if (def->os.slic_table) {
|
||||||
|
+
|
||||||
|
+ if (def->os.nacpiTables) {
|
||||||
|
virBufferAddLit(buf, "<acpi>\n");
|
||||||
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
- virBufferEscapeString(buf, "<table type='slic'>%s</table>\n",
|
||||||
|
- def->os.slic_table);
|
||||||
|
+ for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
+ virBufferAsprintf(buf, "<table type='%s'>",
|
||||||
|
+ virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
+ virBufferEscapeString(buf, "%s</table>\n",
|
||||||
|
+ def->os.acpiTables[i]->path);
|
||||||
|
+ }
|
||||||
|
virBufferAdjustIndent(buf, -2);
|
||||||
|
virBufferAddLit(buf, "</acpi>\n");
|
||||||
|
}
|
||||||
|
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||||
|
index 2d38e8fa51..f52b80caec 100644
|
||||||
|
--- a/src/conf/domain_conf.h
|
||||||
|
+++ b/src/conf/domain_conf.h
|
||||||
|
@@ -2462,6 +2462,24 @@ typedef enum {
|
||||||
|
|
||||||
|
VIR_ENUM_DECL(virDomainOsDefFirmwareFeature);
|
||||||
|
|
||||||
|
+typedef enum {
|
||||||
|
+ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC,
|
||||||
|
+
|
||||||
|
+ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST
|
||||||
|
+} virDomainOsACPITable;
|
||||||
|
+
|
||||||
|
+VIR_ENUM_DECL(virDomainOsACPITable);
|
||||||
|
+
|
||||||
|
+struct _virDomainOSACPITableDef {
|
||||||
|
+ virDomainOsACPITable type;
|
||||||
|
+ char *path;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+typedef struct _virDomainOSACPITableDef virDomainOSACPITableDef;
|
||||||
|
+void virDomainOSACPITableDefFree(virDomainOSACPITableDef *def);
|
||||||
|
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainOSACPITableDef, virDomainOSACPITableDefFree);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
struct _virDomainOSDef {
|
||||||
|
int type;
|
||||||
|
virDomainOsDefFirmware firmware;
|
||||||
|
@@ -2484,7 +2502,8 @@ struct _virDomainOSDef {
|
||||||
|
char *cmdline;
|
||||||
|
char *dtb;
|
||||||
|
char *root;
|
||||||
|
- char *slic_table;
|
||||||
|
+ size_t nacpiTables;
|
||||||
|
+ virDomainOSACPITableDef **acpiTables;
|
||||||
|
virDomainLoaderDef *loader;
|
||||||
|
char *bootloader;
|
||||||
|
char *bootloaderArgs;
|
||||||
|
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||||
|
index 727ab52cfe..be313ad67b 100644
|
||||||
|
--- a/src/libvirt_private.syms
|
||||||
|
+++ b/src/libvirt_private.syms
|
||||||
|
@@ -609,6 +609,8 @@ virDomainObjTaint;
|
||||||
|
virDomainObjUpdateModificationImpact;
|
||||||
|
virDomainObjWait;
|
||||||
|
virDomainObjWaitUntil;
|
||||||
|
+virDomainOsACPITableTypeFromString;
|
||||||
|
+virDomainOsACPITableTypeToString;
|
||||||
|
virDomainOsDefFirmwareTypeFromString;
|
||||||
|
virDomainOsDefFirmwareTypeToString;
|
||||||
|
virDomainOSTypeFromString;
|
||||||
|
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
|
||||||
|
index c404226e43..7d845b97ec 100644
|
||||||
|
--- a/src/libxl/libxl_conf.c
|
||||||
|
+++ b/src/libxl/libxl_conf.c
|
||||||
|
@@ -582,8 +582,9 @@ libxlMakeDomBuildInfo(virDomainDef *def,
|
||||||
|
VIR_TRISTATE_SWITCH_ON);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- /* copy SLIC table path to acpi_firmware */
|
||||||
|
- b_info->u.hvm.acpi_firmware = g_strdup(def->os.slic_table);
|
||||||
|
+ /* copy the table path to acpi_firmware */
|
||||||
|
+ if (def->os.nacpiTables)
|
||||||
|
+ b_info->u.hvm.acpi_firmware = g_strdup(def->os.acpiTables[0]->path);
|
||||||
|
|
||||||
|
if (def->nsounds > 0) {
|
||||||
|
/*
|
||||||
|
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
|
||||||
|
index 53f6871efc..062b753cea 100644
|
||||||
|
--- a/src/libxl/xen_xl.c
|
||||||
|
+++ b/src/libxl/xen_xl.c
|
||||||
|
@@ -106,6 +106,7 @@ xenParseXLOS(virConf *conf, virDomainDef *def, virCaps *caps)
|
||||||
|
g_autofree char *bios = NULL;
|
||||||
|
g_autofree char *bios_path = NULL;
|
||||||
|
g_autofree char *boot = NULL;
|
||||||
|
+ g_autofree char *slic = NULL;
|
||||||
|
int val = 0;
|
||||||
|
|
||||||
|
if (xenConfigGetString(conf, "bios", &bios, NULL) < 0)
|
||||||
|
@@ -133,8 +134,15 @@ xenParseXLOS(virConf *conf, virDomainDef *def, virCaps *caps)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (xenConfigCopyStringOpt(conf, "acpi_firmware", &def->os.slic_table) < 0)
|
||||||
|
+ if (xenConfigCopyStringOpt(conf, "acpi_firmware", &slic) < 0)
|
||||||
|
return -1;
|
||||||
|
+ if (slic != NULL) {
|
||||||
|
+ def->os.nacpiTables = 1;
|
||||||
|
+ def->os.acpiTables = g_new0(virDomainOSACPITableDef *, 1);
|
||||||
|
+ def->os.acpiTables[0] = g_new0(virDomainOSACPITableDef, 1);
|
||||||
|
+ def->os.acpiTables[0]->type = VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC;
|
||||||
|
+ def->os.acpiTables[0]->path = g_steal_pointer(&slic);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (xenConfigCopyStringOpt(conf, "kernel", &def->os.kernel) < 0)
|
||||||
|
return -1;
|
||||||
|
@@ -1134,8 +1142,9 @@ xenFormatXLOS(virConf *conf, virDomainDef *def)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (def->os.slic_table &&
|
||||||
|
- xenConfigSetString(conf, "acpi_firmware", def->os.slic_table) < 0)
|
||||||
|
+ if (def->os.nacpiTables &&
|
||||||
|
+ xenConfigSetString(conf, "acpi_firmware",
|
||||||
|
+ def->os.acpiTables[0]->path) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (def->os.kernel &&
|
||||||
|
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||||
|
index 24dac0ce0f..756dd2168b 100644
|
||||||
|
--- a/src/qemu/qemu_command.c
|
||||||
|
+++ b/src/qemu/qemu_command.c
|
||||||
|
@@ -127,6 +127,11 @@ VIR_ENUM_IMPL(qemuNumaPolicy,
|
||||||
|
"restrictive",
|
||||||
|
);
|
||||||
|
|
||||||
|
+VIR_ENUM_DECL(qemuACPITableSIG);
|
||||||
|
+VIR_ENUM_IMPL(qemuACPITableSIG,
|
||||||
|
+ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST,
|
||||||
|
+ "SLIC");
|
||||||
|
+
|
||||||
|
|
||||||
|
const char *
|
||||||
|
qemuAudioDriverTypeToString(virDomainAudioType type)
|
||||||
|
@@ -5968,6 +5973,7 @@ qemuBuildBootCommandLine(virCommand *cmd,
|
||||||
|
{
|
||||||
|
g_auto(virBuffer) boot_buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
g_autofree char *boot_opts_str = NULL;
|
||||||
|
+ size_t i;
|
||||||
|
|
||||||
|
if (def->os.bootmenu) {
|
||||||
|
if (def->os.bootmenu == VIR_TRISTATE_BOOL_YES)
|
||||||
|
@@ -6001,11 +6007,12 @@ qemuBuildBootCommandLine(virCommand *cmd,
|
||||||
|
virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
|
||||||
|
if (def->os.dtb)
|
||||||
|
virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
|
||||||
|
- if (def->os.slic_table) {
|
||||||
|
+ for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
virCommandAddArg(cmd, "-acpitable");
|
||||||
|
- virBufferAddLit(&buf, "sig=SLIC,file=");
|
||||||
|
- virQEMUBuildBufferEscapeComma(&buf, def->os.slic_table);
|
||||||
|
+ virBufferAsprintf(&buf, "sig=%s,file=",
|
||||||
|
+ qemuACPITableSIGTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
+ virQEMUBuildBufferEscapeComma(&buf, def->os.acpiTables[i]->path);
|
||||||
|
virCommandAddArgBuffer(cmd, &buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
|
||||||
|
index 0505f4e4a3..b4d61bc576 100644
|
||||||
|
--- a/src/security/security_dac.c
|
||||||
|
+++ b/src/security/security_dac.c
|
||||||
|
@@ -2050,9 +2050,10 @@ virSecurityDACRestoreAllLabel(virSecurityManager *mgr,
|
||||||
|
virSecurityDACRestoreFileLabel(mgr, def->os.dtb) < 0)
|
||||||
|
rc = -1;
|
||||||
|
|
||||||
|
- if (def->os.slic_table &&
|
||||||
|
- virSecurityDACRestoreFileLabel(mgr, def->os.slic_table) < 0)
|
||||||
|
- rc = -1;
|
||||||
|
+ for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
+ if (virSecurityDACRestoreFileLabel(mgr, def->os.acpiTables[i]->path) < 0)
|
||||||
|
+ rc = -1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (def->pstore &&
|
||||||
|
virSecurityDACRestoreFileLabel(mgr, def->pstore->path) < 0)
|
||||||
|
@@ -2300,11 +2301,12 @@ virSecurityDACSetAllLabel(virSecurityManager *mgr,
|
||||||
|
user, group, true) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
- if (def->os.slic_table &&
|
||||||
|
- virSecurityDACSetOwnership(mgr, NULL,
|
||||||
|
- def->os.slic_table,
|
||||||
|
- user, group, true) < 0)
|
||||||
|
- return -1;
|
||||||
|
+ for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
+ if (virSecurityDACSetOwnership(mgr, NULL,
|
||||||
|
+ def->os.acpiTables[i]->path,
|
||||||
|
+ user, group, true) < 0)
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (def->pstore &&
|
||||||
|
virSecurityDACSetOwnership(mgr, NULL,
|
||||||
|
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
|
||||||
|
index cdc32d9b34..b8659e33d6 100644
|
||||||
|
--- a/src/security/security_selinux.c
|
||||||
|
+++ b/src/security/security_selinux.c
|
||||||
|
@@ -3013,9 +3013,10 @@ virSecuritySELinuxRestoreAllLabel(virSecurityManager *mgr,
|
||||||
|
virSecuritySELinuxRestoreFileLabel(mgr, def->os.dtb, true) < 0)
|
||||||
|
rc = -1;
|
||||||
|
|
||||||
|
- if (def->os.slic_table &&
|
||||||
|
- virSecuritySELinuxRestoreFileLabel(mgr, def->os.slic_table, true) < 0)
|
||||||
|
- rc = -1;
|
||||||
|
+ for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
+ if (virSecuritySELinuxRestoreFileLabel(mgr, def->os.acpiTables[i]->path, true) < 0)
|
||||||
|
+ rc = -1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (def->pstore &&
|
||||||
|
virSecuritySELinuxRestoreFileLabel(mgr, def->pstore->path, true) < 0)
|
||||||
|
@@ -3443,10 +3444,11 @@ virSecuritySELinuxSetAllLabel(virSecurityManager *mgr,
|
||||||
|
data->content_context, true) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
- if (def->os.slic_table &&
|
||||||
|
- virSecuritySELinuxSetFilecon(mgr, def->os.slic_table,
|
||||||
|
- data->content_context, true) < 0)
|
||||||
|
- return -1;
|
||||||
|
+ for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
+ if (virSecuritySELinuxSetFilecon(mgr, def->os.acpiTables[i]->path,
|
||||||
|
+ data->content_context, true) < 0)
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (def->pstore &&
|
||||||
|
virSecuritySELinuxSetFilecon(mgr, def->pstore->path,
|
||||||
|
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
|
||||||
|
index e82b5de2b4..e68e908994 100644
|
||||||
|
--- a/src/security/virt-aa-helper.c
|
||||||
|
+++ b/src/security/virt-aa-helper.c
|
||||||
|
@@ -1002,9 +1002,10 @@ get_files(vahControl * ctl)
|
||||||
|
if (vah_add_file(&buf, ctl->def->os.dtb, "r") != 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
- if (ctl->def->os.slic_table)
|
||||||
|
- if (vah_add_file(&buf, ctl->def->os.slic_table, "r") != 0)
|
||||||
|
+ for (i = 0; i < ctl->def->os.nacpiTables; i++) {
|
||||||
|
+ if (vah_add_file(&buf, ctl->def->os.acpiTables[i]->path, "r") != 0)
|
||||||
|
goto cleanup;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (ctl->def->pstore)
|
||||||
|
if (vah_add_file(&buf, ctl->def->pstore->path, "rw") != 0)
|
||||||
|
--
|
||||||
|
2.49.0
|
119
libvirt-conf-support-MSDM-ACPI-table-type.patch
Normal file
119
libvirt-conf-support-MSDM-ACPI-table-type.patch
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
From bfde8a471a604ddc3bfe7ee5baddbedc379ddf34 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <bfde8a471a604ddc3bfe7ee5baddbedc379ddf34.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Mon, 17 Feb 2025 16:58:27 +0000
|
||||||
|
Subject: [PATCH] conf: support MSDM ACPI table type
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The MSDM ACPI table is an alternative for the SLIC table type,
|
||||||
|
sometimes used by Microsoft for Windows Licensing checks:
|
||||||
|
|
||||||
|
https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653305(v=vs.85)
|
||||||
|
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit 32765cd14e99411dfd14a230be86f2aecf7e9a7a)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-81041
|
||||||
|
---
|
||||||
|
docs/formatdomain.rst | 4 ++++
|
||||||
|
src/conf/domain_conf.c | 1 +
|
||||||
|
src/conf/domain_conf.h | 1 +
|
||||||
|
src/conf/schemas/domaincommon.rng | 1 +
|
||||||
|
src/libxl/libxl_domain.c | 1 +
|
||||||
|
src/qemu/qemu_command.c | 3 ++-
|
||||||
|
src/qemu/qemu_validate.c | 1 +
|
||||||
|
7 files changed, 11 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
|
||||||
|
index b03b5317aa..c144851b62 100644
|
||||||
|
--- a/docs/formatdomain.rst
|
||||||
|
+++ b/docs/formatdomain.rst
|
||||||
|
@@ -497,6 +497,10 @@ These options apply to any form of booting of the guest OS.
|
||||||
|
software licensing information. The ACPI table signature in the
|
||||||
|
header will be forced to ``SLIC`` (:since:`Since 1.3.5 (QEMU)`,
|
||||||
|
mis-interpreted as ``rawset`` :since:`Since 5.9.0 (Xen)`).
|
||||||
|
+ * ``msdm``: a single ACPI table with header and data, providing
|
||||||
|
+ Microsoft Data Management information. The ACPI table signature
|
||||||
|
+ in the header will be forced to ``MSDM``
|
||||||
|
+ (:since:`Since 11.2.0`).
|
||||||
|
|
||||||
|
Each type may be used only once, except for ``raw`` which can
|
||||||
|
appear multiple times.
|
||||||
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||||
|
index 2ee0403c86..f6d3d849eb 100644
|
||||||
|
--- a/src/conf/domain_conf.c
|
||||||
|
+++ b/src/conf/domain_conf.c
|
||||||
|
@@ -1461,6 +1461,7 @@ VIR_ENUM_IMPL(virDomainOsACPITable,
|
||||||
|
"raw",
|
||||||
|
"rawset",
|
||||||
|
"slic",
|
||||||
|
+ "msdm",
|
||||||
|
);
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virDomainCFPC,
|
||||||
|
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||||
|
index bc3f42888e..961b7b056c 100644
|
||||||
|
--- a/src/conf/domain_conf.h
|
||||||
|
+++ b/src/conf/domain_conf.h
|
||||||
|
@@ -2466,6 +2466,7 @@ typedef enum {
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW,
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET,
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC,
|
||||||
|
+ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM,
|
||||||
|
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST
|
||||||
|
} virDomainOsACPITable;
|
||||||
|
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
|
||||||
|
index 99bcc90d4f..d46eb44588 100644
|
||||||
|
--- a/src/conf/schemas/domaincommon.rng
|
||||||
|
+++ b/src/conf/schemas/domaincommon.rng
|
||||||
|
@@ -7192,6 +7192,7 @@
|
||||||
|
<value>raw</value>
|
||||||
|
<value>rawset</value>
|
||||||
|
<value>slic</value>
|
||||||
|
+ <value>msdm</value>
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
<ref name="absFilePath"/>
|
||||||
|
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
|
||||||
|
index e31d92d903..c5a556ec78 100644
|
||||||
|
--- a/src/libxl/libxl_domain.c
|
||||||
|
+++ b/src/libxl/libxl_domain.c
|
||||||
|
@@ -339,6 +339,7 @@ libxlDomainDefValidate(const virDomainDef *def,
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW:
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM:
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("ACPI table type '%1$s' is not supported"),
|
||||||
|
virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||||
|
index adf7b21b14..9fe191d3b9 100644
|
||||||
|
--- a/src/qemu/qemu_command.c
|
||||||
|
+++ b/src/qemu/qemu_command.c
|
||||||
|
@@ -132,7 +132,8 @@ VIR_ENUM_IMPL(qemuACPITableSIG,
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST,
|
||||||
|
"", /* raw */
|
||||||
|
"", /* rawset */
|
||||||
|
- "SLIC");
|
||||||
|
+ "SLIC",
|
||||||
|
+ "");
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||||
|
index b088e54dd0..378f502ea7 100644
|
||||||
|
--- a/src/qemu/qemu_validate.c
|
||||||
|
+++ b/src/qemu/qemu_validate.c
|
||||||
|
@@ -734,6 +734,7 @@ qemuValidateDomainDefBoot(const virDomainDef *def,
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET:
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM:
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("ACPI table type '%1$s' is not supported"),
|
||||||
|
virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
--
|
||||||
|
2.49.0
|
85
libvirt-libxl-support-rawset-ACPI-table-type.patch
Normal file
85
libvirt-libxl-support-rawset-ACPI-table-type.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
From fb8c22b5606b2c3d0881df8df05ad1c909b247b2 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <fb8c22b5606b2c3d0881df8df05ad1c909b247b2.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Wed, 26 Feb 2025 19:10:42 +0000
|
||||||
|
Subject: [PATCH] libxl: support 'rawset' ACPI table type
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This fixes representation of the 'acpi_firmware' config in the Xen
|
||||||
|
driver, which repesents a concatenation of tables of any type.
|
||||||
|
|
||||||
|
Use of 'type=slic' is accepted on input for backwards compatibility.
|
||||||
|
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit dac6ecba6f75bff11fbddb2bce8ca9b576ea6a74)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-81041
|
||||||
|
---
|
||||||
|
docs/formatdomain.rst | 2 +-
|
||||||
|
src/libxl/libxl_domain.c | 5 +++--
|
||||||
|
src/libxl/xen_xl.c | 2 +-
|
||||||
|
tests/xlconfigdata/test-fullvirt-acpi-slic.xml | 2 +-
|
||||||
|
4 files changed, 6 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
|
||||||
|
index ff06efb69f..b03b5317aa 100644
|
||||||
|
--- a/docs/formatdomain.rst
|
||||||
|
+++ b/docs/formatdomain.rst
|
||||||
|
@@ -492,7 +492,7 @@ These options apply to any form of booting of the guest OS.
|
||||||
|
signature auto-detected from header (:since:`Since 11.2.0 (QEMU)`).
|
||||||
|
* ``rawset``: concatenation of multiple ACPI tables with header
|
||||||
|
and data, each with any ACPI signature, auto-detected from header
|
||||||
|
- (:since:`Since 11.2.0`).
|
||||||
|
+ (:since:`Since 11.2.0 (Xen)`).
|
||||||
|
* ``slic``: a single ACPI table with header and data, providing
|
||||||
|
software licensing information. The ACPI table signature in the
|
||||||
|
header will be forced to ``SLIC`` (:since:`Since 1.3.5 (QEMU)`,
|
||||||
|
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
|
||||||
|
index e564d9e5fe..e31d92d903 100644
|
||||||
|
--- a/src/libxl/libxl_domain.c
|
||||||
|
+++ b/src/libxl/libxl_domain.c
|
||||||
|
@@ -333,11 +333,12 @@ libxlDomainDefValidate(const virDomainDef *def,
|
||||||
|
|
||||||
|
for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
switch (def->os.acpiTables[i]->type) {
|
||||||
|
- case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC:
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC: /* Back compat for historical mistake,
|
||||||
|
+ * functionally the same as 'rawset' */
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW:
|
||||||
|
- case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET:
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("ACPI table type '%1$s' is not supported"),
|
||||||
|
virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
|
||||||
|
index 062b753cea..9d06315661 100644
|
||||||
|
--- a/src/libxl/xen_xl.c
|
||||||
|
+++ b/src/libxl/xen_xl.c
|
||||||
|
@@ -140,7 +140,7 @@ xenParseXLOS(virConf *conf, virDomainDef *def, virCaps *caps)
|
||||||
|
def->os.nacpiTables = 1;
|
||||||
|
def->os.acpiTables = g_new0(virDomainOSACPITableDef *, 1);
|
||||||
|
def->os.acpiTables[0] = g_new0(virDomainOSACPITableDef, 1);
|
||||||
|
- def->os.acpiTables[0]->type = VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC;
|
||||||
|
+ def->os.acpiTables[0]->type = VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET;
|
||||||
|
def->os.acpiTables[0]->path = g_steal_pointer(&slic);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/tests/xlconfigdata/test-fullvirt-acpi-slic.xml b/tests/xlconfigdata/test-fullvirt-acpi-slic.xml
|
||||||
|
index 366d877624..bf617e5e05 100644
|
||||||
|
--- a/tests/xlconfigdata/test-fullvirt-acpi-slic.xml
|
||||||
|
+++ b/tests/xlconfigdata/test-fullvirt-acpi-slic.xml
|
||||||
|
@@ -8,7 +8,7 @@
|
||||||
|
<type arch='x86_64' machine='xenfv'>hvm</type>
|
||||||
|
<loader type='rom' format='raw'>/usr/lib/xen/boot/hvmloader</loader>
|
||||||
|
<acpi>
|
||||||
|
- <table type='slic'>/sys/firmware/acpi/tables/SLIC</table>
|
||||||
|
+ <table type='rawset'>/sys/firmware/acpi/tables/SLIC</table>
|
||||||
|
</acpi>
|
||||||
|
<boot dev='cdrom'/>
|
||||||
|
</os>
|
||||||
|
--
|
||||||
|
2.49.0
|
44
libvirt-network-Free-inhibitor-in-networkStateCleanup.patch
Normal file
44
libvirt-network-Free-inhibitor-in-networkStateCleanup.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From 2ea12b6f6eed044dd7100ed19565319227f7384f Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <2ea12b6f6eed044dd7100ed19565319227f7384f.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Date: Thu, 13 Mar 2025 13:01:19 +0100
|
||||||
|
Subject: [PATCH] network: Free inhibitor in networkStateCleanup()
|
||||||
|
|
||||||
|
The shutdown inhibitor is created in networkStateInitialize() but
|
||||||
|
corresponding call to virInhibitorFree() is missing in
|
||||||
|
networkStateCleanup() leading to a memleak:
|
||||||
|
|
||||||
|
116 (72 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 1,769 of 1,998
|
||||||
|
at 0x484CEF3: calloc (vg_replace_malloc.c:1675)
|
||||||
|
by 0x4F0E7A9: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.8000.5)
|
||||||
|
by 0x4993B9B: virInhibitorNew (virinhibitor.c:152)
|
||||||
|
by 0x5279394: networkStateInitialize (bridge_driver.c:654)
|
||||||
|
by 0x4CC74DC: virStateInitialize (libvirt.c:665)
|
||||||
|
by 0x15B719: daemonRunStateInit (remote_daemon.c:613)
|
||||||
|
by 0x49F2B44: virThreadHelper (virthread.c:256)
|
||||||
|
by 0x5356662: start_thread (in /usr/lib64/libc.so.6)
|
||||||
|
by 0x53D7DA3: clone (in /usr/lib64/libc.so.6)
|
||||||
|
|
||||||
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
(cherry picked from commit 8701ba4feb528109da8b72fa48a8ada50a235807)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-83064
|
||||||
|
---
|
||||||
|
src/network/bridge_driver.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
|
||||||
|
index ce793c12ef..adcff6f34f 100644
|
||||||
|
--- a/src/network/bridge_driver.c
|
||||||
|
+++ b/src/network/bridge_driver.c
|
||||||
|
@@ -802,6 +802,8 @@ networkStateCleanup(void)
|
||||||
|
network_driver->lockFD);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ virInhibitorFree(network_driver->inhibitor);
|
||||||
|
+
|
||||||
|
virObjectUnref(network_driver->config);
|
||||||
|
virObjectUnref(network_driver->dnsmasqCaps);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.49.0
|
@ -0,0 +1,94 @@
|
|||||||
|
From f61b747b0420d71efe33f836a1117d4741ecd716 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <f61b747b0420d71efe33f836a1117d4741ecd716.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
Date: Tue, 11 Mar 2025 09:04:18 +0100
|
||||||
|
Subject: [PATCH] qemu: process: Remove un-updated 'qemuProcessStartWarnShmem'
|
||||||
|
|
||||||
|
The checks in qemuProcessStartWarnShmem are no longer current. Since
|
||||||
|
previous patch made it fatal for vhost-user interfaces to be configured
|
||||||
|
without shared memory this warning code can be deleted.
|
||||||
|
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-80533
|
||||||
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
(cherry picked from commit 080c7fd341619a3d1986a00265addaf45b63aacf)
|
||||||
|
|
||||||
|
https://issues.redhat.com/browse/RHEL-84133
|
||||||
|
---
|
||||||
|
src/qemu/qemu_process.c | 54 -----------------------------------------
|
||||||
|
1 file changed, 54 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||||
|
index 722e982b9e..fac5678439 100644
|
||||||
|
--- a/src/qemu/qemu_process.c
|
||||||
|
+++ b/src/qemu/qemu_process.c
|
||||||
|
@@ -5406,56 +5406,6 @@ qemuProcessMakeDir(virQEMUDriver *driver,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-static void
|
||||||
|
-qemuProcessStartWarnShmem(virDomainObj *vm)
|
||||||
|
-{
|
||||||
|
- size_t i;
|
||||||
|
- bool check_shmem = false;
|
||||||
|
- bool shmem = vm->def->nshmems;
|
||||||
|
-
|
||||||
|
- /*
|
||||||
|
- * For vhost-user to work, the domain has to have some type of
|
||||||
|
- * shared memory configured. We're not the proper ones to judge
|
||||||
|
- * whether shared hugepages or shm are enough and will be in the
|
||||||
|
- * future, so we'll just warn in case neither is configured.
|
||||||
|
- * Moreover failing would give the false illusion that libvirt is
|
||||||
|
- * really checking that everything works before running the domain
|
||||||
|
- * and not only we are unable to do that, but it's also not our
|
||||||
|
- * aim to do so.
|
||||||
|
- */
|
||||||
|
- for (i = 0; i < vm->def->nnets; i++) {
|
||||||
|
- if (virDomainNetGetActualType(vm->def->nets[i]) ==
|
||||||
|
- VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
|
||||||
|
- check_shmem = true;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (!check_shmem)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- /*
|
||||||
|
- * This check is by no means complete. We merely check
|
||||||
|
- * whether there are *some* hugepages enabled and *some* NUMA
|
||||||
|
- * nodes with shared memory access.
|
||||||
|
- */
|
||||||
|
- if (!shmem && vm->def->mem.nhugepages) {
|
||||||
|
- for (i = 0; i < virDomainNumaGetNodeCount(vm->def->numa); i++) {
|
||||||
|
- if (virDomainNumaGetNodeMemoryAccessMode(vm->def->numa, i) ==
|
||||||
|
- VIR_DOMAIN_MEMORY_ACCESS_SHARED) {
|
||||||
|
- shmem = true;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (!shmem) {
|
||||||
|
- VIR_WARN("Detected vhost-user interface without any shared memory, "
|
||||||
|
- "the interface might not be operational");
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
static int
|
||||||
|
qemuProcessStartValidateGraphics(virDomainObj *vm)
|
||||||
|
{
|
||||||
|
@@ -5690,10 +5640,6 @@ qemuProcessStartValidate(virQEMUDriver *driver,
|
||||||
|
if (qemuProcessStartValidateTSC(driver, vm) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
- VIR_DEBUG("Checking for any possible (non-fatal) issues");
|
||||||
|
-
|
||||||
|
- qemuProcessStartWarnShmem(vm);
|
||||||
|
-
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.49.0
|
108
libvirt-qemu-support-MSDM-ACPI-table-type.patch
Normal file
108
libvirt-qemu-support-MSDM-ACPI-table-type.patch
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
From d50549c9b0e601bc3a6ae5ee97d1ff2f75645f57 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <d50549c9b0e601bc3a6ae5ee97d1ff2f75645f57.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Mon, 17 Feb 2025 16:58:27 +0000
|
||||||
|
Subject: [PATCH] qemu: support MSDM ACPI table type
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The MSDM ACPI table is a replacement for the SLIC table type, now
|
||||||
|
sometimes used by Microsoft for Windows Licensing checks:
|
||||||
|
|
||||||
|
https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653305(v=vs.85)
|
||||||
|
|
||||||
|
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/748
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit 288f90feb32e38dfd246cbfb68f38caca43cef70)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-81041
|
||||||
|
---
|
||||||
|
docs/formatdomain.rst | 2 +-
|
||||||
|
src/qemu/qemu_command.c | 2 +-
|
||||||
|
src/qemu/qemu_validate.c | 2 +-
|
||||||
|
tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args | 1 +
|
||||||
|
tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml | 1 +
|
||||||
|
tests/qemuxmlconfdata/acpi-table-many.xml | 1 +
|
||||||
|
6 files changed, 6 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
|
||||||
|
index c144851b62..961d20a41d 100644
|
||||||
|
--- a/docs/formatdomain.rst
|
||||||
|
+++ b/docs/formatdomain.rst
|
||||||
|
@@ -500,7 +500,7 @@ These options apply to any form of booting of the guest OS.
|
||||||
|
* ``msdm``: a single ACPI table with header and data, providing
|
||||||
|
Microsoft Data Management information. The ACPI table signature
|
||||||
|
in the header will be forced to ``MSDM``
|
||||||
|
- (:since:`Since 11.2.0`).
|
||||||
|
+ (:since:`Since 11.2.0 (QEMU)`).
|
||||||
|
|
||||||
|
Each type may be used only once, except for ``raw`` which can
|
||||||
|
appear multiple times.
|
||||||
|
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||||
|
index 9fe191d3b9..b7d61edd19 100644
|
||||||
|
--- a/src/qemu/qemu_command.c
|
||||||
|
+++ b/src/qemu/qemu_command.c
|
||||||
|
@@ -133,7 +133,7 @@ VIR_ENUM_IMPL(qemuACPITableSIG,
|
||||||
|
"", /* raw */
|
||||||
|
"", /* rawset */
|
||||||
|
"SLIC",
|
||||||
|
- "");
|
||||||
|
+ "MSDM");
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||||
|
index 378f502ea7..f814ee8c0d 100644
|
||||||
|
--- a/src/qemu/qemu_validate.c
|
||||||
|
+++ b/src/qemu/qemu_validate.c
|
||||||
|
@@ -731,10 +731,10 @@ qemuValidateDomainDefBoot(const virDomainDef *def,
|
||||||
|
switch (def->os.acpiTables[i]->type) {
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW:
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC:
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET:
|
||||||
|
- case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_MSDM:
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("ACPI table type '%1$s' is not supported"),
|
||||||
|
virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
diff --git a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args
|
||||||
|
index 4d5d02cb3c..2b0b433258 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args
|
||||||
|
+++ b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args
|
||||||
|
@@ -30,6 +30,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
|
||||||
|
-acpitable file=/var/lib/libvirt/acpi/exm2.dat \
|
||||||
|
-acpitable file=/var/lib/libvirt/acpi/exm3.dat \
|
||||||
|
-acpitable sig=SLIC,file=/var/lib/libvirt/acpi/slic.dat \
|
||||||
|
+-acpitable sig=MSDM,file=/var/lib/libvirt/acpi/msdm.dat \
|
||||||
|
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
|
||||||
|
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||||
|
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
||||||
|
diff --git a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml
|
||||||
|
index b7f7e18d28..084bb4cda3 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml
|
||||||
|
+++ b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
<table type='raw'>/var/lib/libvirt/acpi/exm2.dat</table>
|
||||||
|
<table type='raw'>/var/lib/libvirt/acpi/exm3.dat</table>
|
||||||
|
<table type='slic'>/var/lib/libvirt/acpi/slic.dat</table>
|
||||||
|
+ <table type='msdm'>/var/lib/libvirt/acpi/msdm.dat</table>
|
||||||
|
</acpi>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
diff --git a/tests/qemuxmlconfdata/acpi-table-many.xml b/tests/qemuxmlconfdata/acpi-table-many.xml
|
||||||
|
index cc75011990..890078d4c3 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/acpi-table-many.xml
|
||||||
|
+++ b/tests/qemuxmlconfdata/acpi-table-many.xml
|
||||||
|
@@ -12,6 +12,7 @@
|
||||||
|
<table type='raw'>/var/lib/libvirt/acpi/exm2.dat</table>
|
||||||
|
<table type='raw'>/var/lib/libvirt/acpi/exm3.dat</table>
|
||||||
|
<table type='slic'>/var/lib/libvirt/acpi/slic.dat</table>
|
||||||
|
+ <table type='msdm'>/var/lib/libvirt/acpi/msdm.dat</table>
|
||||||
|
</acpi>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
--
|
||||||
|
2.49.0
|
218
libvirt-qemu-support-raw-ACPI-table-type.patch
Normal file
218
libvirt-qemu-support-raw-ACPI-table-type.patch
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
From b83e3e1644dc33a41fa4ccd62407aeca218bbd4c Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <b83e3e1644dc33a41fa4ccd62407aeca218bbd4c.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Wed, 26 Feb 2025 19:10:42 +0000
|
||||||
|
Subject: [PATCH] qemu: support 'raw' ACPI table type
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This allows passing a single ACPI table of any type through to QEMU with
|
||||||
|
the signture autodetected from the header.
|
||||||
|
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit fe0cf62e0f8a6c4bbc2f297f46761f41691e3193)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-81041
|
||||||
|
---
|
||||||
|
docs/formatdomain.rst | 2 +-
|
||||||
|
src/qemu/qemu_command.c | 6 ++-
|
||||||
|
src/qemu/qemu_validate.c | 2 +-
|
||||||
|
.../acpi-table-many.x86_64-latest.args | 36 ++++++++++++++++
|
||||||
|
.../acpi-table-many.x86_64-latest.xml | 41 +++++++++++++++++++
|
||||||
|
tests/qemuxmlconfdata/acpi-table-many.xml | 33 +++++++++++++++
|
||||||
|
tests/qemuxmlconftest.c | 1 +
|
||||||
|
7 files changed, 117 insertions(+), 4 deletions(-)
|
||||||
|
create mode 100644 tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args
|
||||||
|
create mode 100644 tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml
|
||||||
|
create mode 100644 tests/qemuxmlconfdata/acpi-table-many.xml
|
||||||
|
|
||||||
|
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
|
||||||
|
index b6e162235c..ff06efb69f 100644
|
||||||
|
--- a/docs/formatdomain.rst
|
||||||
|
+++ b/docs/formatdomain.rst
|
||||||
|
@@ -489,7 +489,7 @@ These options apply to any form of booting of the guest OS.
|
||||||
|
file:
|
||||||
|
|
||||||
|
* ``raw``: a single ACPI table with header and data, with ACPI
|
||||||
|
- signature auto-detected from header (:since:`Since 11.2.0`).
|
||||||
|
+ signature auto-detected from header (:since:`Since 11.2.0 (QEMU)`).
|
||||||
|
* ``rawset``: concatenation of multiple ACPI tables with header
|
||||||
|
and data, each with any ACPI signature, auto-detected from header
|
||||||
|
(:since:`Since 11.2.0`).
|
||||||
|
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||||
|
index 94fb7fc4c2..adf7b21b14 100644
|
||||||
|
--- a/src/qemu/qemu_command.c
|
||||||
|
+++ b/src/qemu/qemu_command.c
|
||||||
|
@@ -6011,9 +6011,11 @@ qemuBuildBootCommandLine(virCommand *cmd,
|
||||||
|
virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
|
||||||
|
for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
+ const char *sig = qemuACPITableSIGTypeToString(def->os.acpiTables[i]->type);
|
||||||
|
virCommandAddArg(cmd, "-acpitable");
|
||||||
|
- virBufferAsprintf(&buf, "sig=%s,file=",
|
||||||
|
- qemuACPITableSIGTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
+ if (*sig != '\0')
|
||||||
|
+ virBufferAsprintf(&buf, "sig=%s,", sig);
|
||||||
|
+ virBufferAddLit(&buf, "file=");
|
||||||
|
virQEMUBuildBufferEscapeComma(&buf, def->os.acpiTables[i]->path);
|
||||||
|
virCommandAddArgBuffer(cmd, &buf);
|
||||||
|
}
|
||||||
|
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||||
|
index 8ef0257d73..b088e54dd0 100644
|
||||||
|
--- a/src/qemu/qemu_validate.c
|
||||||
|
+++ b/src/qemu/qemu_validate.c
|
||||||
|
@@ -729,10 +729,10 @@ qemuValidateDomainDefBoot(const virDomainDef *def,
|
||||||
|
|
||||||
|
for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
switch (def->os.acpiTables[i]->type) {
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW:
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC:
|
||||||
|
break;
|
||||||
|
|
||||||
|
- case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW:
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET:
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("ACPI table type '%1$s' is not supported"),
|
||||||
|
diff --git a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..4d5d02cb3c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.args
|
||||||
|
@@ -0,0 +1,36 @@
|
||||||
|
+LC_ALL=C \
|
||||||
|
+PATH=/bin \
|
||||||
|
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
|
||||||
|
+USER=test \
|
||||||
|
+LOGNAME=test \
|
||||||
|
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
|
||||||
|
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
|
||||||
|
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
|
||||||
|
+/usr/bin/qemu-system-x86_64 \
|
||||||
|
+-name guest=QEMUGuest1,debug-threads=on \
|
||||||
|
+-S \
|
||||||
|
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
|
||||||
|
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on \
|
||||||
|
+-accel tcg \
|
||||||
|
+-cpu qemu64 \
|
||||||
|
+-m size=219136k \
|
||||||
|
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
|
||||||
|
+-overcommit mem-lock=off \
|
||||||
|
+-smp 1,sockets=1,cores=1,threads=1 \
|
||||||
|
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||||
|
+-display none \
|
||||||
|
+-no-user-config \
|
||||||
|
+-nodefaults \
|
||||||
|
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
|
||||||
|
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||||
|
+-rtc base=utc \
|
||||||
|
+-no-shutdown \
|
||||||
|
+-boot strict=on \
|
||||||
|
+-acpitable file=/var/lib/libvirt/acpi/exm1.dat \
|
||||||
|
+-acpitable file=/var/lib/libvirt/acpi/exm2.dat \
|
||||||
|
+-acpitable file=/var/lib/libvirt/acpi/exm3.dat \
|
||||||
|
+-acpitable sig=SLIC,file=/var/lib/libvirt/acpi/slic.dat \
|
||||||
|
+-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
|
||||||
|
+-audiodev '{"id":"audio1","driver":"none"}' \
|
||||||
|
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
||||||
|
+-msg timestamp=on
|
||||||
|
diff --git a/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..b7f7e18d28
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/qemuxmlconfdata/acpi-table-many.x86_64-latest.xml
|
||||||
|
@@ -0,0 +1,41 @@
|
||||||
|
+<domain type='qemu'>
|
||||||
|
+ <name>QEMUGuest1</name>
|
||||||
|
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
+ <memory unit='KiB'>219136</memory>
|
||||||
|
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||||
|
+ <vcpu placement='static'>1</vcpu>
|
||||||
|
+ <os>
|
||||||
|
+ <type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
+ <acpi>
|
||||||
|
+ <table type='raw'>/var/lib/libvirt/acpi/exm1.dat</table>
|
||||||
|
+ <table type='raw'>/var/lib/libvirt/acpi/exm2.dat</table>
|
||||||
|
+ <table type='raw'>/var/lib/libvirt/acpi/exm3.dat</table>
|
||||||
|
+ <table type='slic'>/var/lib/libvirt/acpi/slic.dat</table>
|
||||||
|
+ </acpi>
|
||||||
|
+ <boot dev='hd'/>
|
||||||
|
+ </os>
|
||||||
|
+ <features>
|
||||||
|
+ <acpi/>
|
||||||
|
+ </features>
|
||||||
|
+ <cpu mode='custom' match='exact' check='none'>
|
||||||
|
+ <model fallback='forbid'>qemu64</model>
|
||||||
|
+ </cpu>
|
||||||
|
+ <clock offset='utc'/>
|
||||||
|
+ <on_poweroff>destroy</on_poweroff>
|
||||||
|
+ <on_reboot>restart</on_reboot>
|
||||||
|
+ <on_crash>destroy</on_crash>
|
||||||
|
+ <devices>
|
||||||
|
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
+ <controller type='usb' index='0' model='piix3-uhci'>
|
||||||
|
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||||
|
+ </controller>
|
||||||
|
+ <controller type='ide' index='0'>
|
||||||
|
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||||
|
+ </controller>
|
||||||
|
+ <controller type='pci' index='0' model='pci-root'/>
|
||||||
|
+ <input type='mouse' bus='ps2'/>
|
||||||
|
+ <input type='keyboard' bus='ps2'/>
|
||||||
|
+ <audio id='1' type='none'/>
|
||||||
|
+ <memballoon model='none'/>
|
||||||
|
+ </devices>
|
||||||
|
+</domain>
|
||||||
|
diff --git a/tests/qemuxmlconfdata/acpi-table-many.xml b/tests/qemuxmlconfdata/acpi-table-many.xml
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..cc75011990
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/qemuxmlconfdata/acpi-table-many.xml
|
||||||
|
@@ -0,0 +1,33 @@
|
||||||
|
+<domain type='qemu'>
|
||||||
|
+ <name>QEMUGuest1</name>
|
||||||
|
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
+ <memory unit='KiB'>219136</memory>
|
||||||
|
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||||
|
+ <vcpu placement='static'>1</vcpu>
|
||||||
|
+ <os>
|
||||||
|
+ <type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
+ <boot dev='hd'/>
|
||||||
|
+ <acpi>
|
||||||
|
+ <table type='raw'>/var/lib/libvirt/acpi/exm1.dat</table>
|
||||||
|
+ <table type='raw'>/var/lib/libvirt/acpi/exm2.dat</table>
|
||||||
|
+ <table type='raw'>/var/lib/libvirt/acpi/exm3.dat</table>
|
||||||
|
+ <table type='slic'>/var/lib/libvirt/acpi/slic.dat</table>
|
||||||
|
+ </acpi>
|
||||||
|
+ </os>
|
||||||
|
+ <features>
|
||||||
|
+ <acpi/>
|
||||||
|
+ </features>
|
||||||
|
+ <clock offset='utc'/>
|
||||||
|
+ <on_poweroff>destroy</on_poweroff>
|
||||||
|
+ <on_reboot>restart</on_reboot>
|
||||||
|
+ <on_crash>destroy</on_crash>
|
||||||
|
+ <devices>
|
||||||
|
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
+ <controller type='usb' index='0'/>
|
||||||
|
+ <controller type='ide' index='0'/>
|
||||||
|
+ <controller type='pci' index='0' model='pci-root'/>
|
||||||
|
+ <input type='mouse' bus='ps2'/>
|
||||||
|
+ <input type='keyboard' bus='ps2'/>
|
||||||
|
+ <memballoon model='none'/>
|
||||||
|
+ </devices>
|
||||||
|
+</domain>
|
||||||
|
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
|
||||||
|
index 3947f508a2..2007944c29 100644
|
||||||
|
--- a/tests/qemuxmlconftest.c
|
||||||
|
+++ b/tests/qemuxmlconftest.c
|
||||||
|
@@ -2767,6 +2767,7 @@ mymain(void)
|
||||||
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("usb-too-long-port-path-invalid");
|
||||||
|
|
||||||
|
DO_TEST_CAPS_LATEST("acpi-table");
|
||||||
|
+ DO_TEST_CAPS_LATEST("acpi-table-many");
|
||||||
|
|
||||||
|
DO_TEST_CAPS_LATEST("intel-iommu");
|
||||||
|
DO_TEST_CAPS_LATEST("intel-iommu-caching-mode");
|
||||||
|
--
|
||||||
|
2.49.0
|
@ -0,0 +1,62 @@
|
|||||||
|
From 5337b43f308c025977311d700b2bd89dfc848b0c Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <5337b43f308c025977311d700b2bd89dfc848b0c.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
Date: Tue, 11 Mar 2025 09:01:12 +0100
|
||||||
|
Subject: [PATCH] qemuValidateDomainDeviceDefNetwork: Require shared memory for
|
||||||
|
all vhost-user interfaces
|
||||||
|
|
||||||
|
Currently we produce only a warning into the log if a non-passt
|
||||||
|
vhost-user interface is configured with shared memory.
|
||||||
|
|
||||||
|
Since we do make it fatal with all other vhost-user types, fix the check
|
||||||
|
to trigger also for normal-vhost-user interfaces.
|
||||||
|
|
||||||
|
Since passt-based vhost-user interfaces are checked separately the check
|
||||||
|
will no longer be required.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
(cherry picked from commit 0d20632179e1a61903f30986215bef53b0f912f6)
|
||||||
|
|
||||||
|
https://issues.redhat.com/browse/RHEL-84133
|
||||||
|
---
|
||||||
|
src/qemu/qemu_validate.c | 9 +++------
|
||||||
|
.../net-vhostuser-passt-no-shmem.x86_64-latest.err | 2 +-
|
||||||
|
2 files changed, 4 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||||
|
index f814ee8c0d..1c61038f93 100644
|
||||||
|
--- a/src/qemu/qemu_validate.c
|
||||||
|
+++ b/src/qemu/qemu_validate.c
|
||||||
|
@@ -1828,12 +1828,6 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
|
||||||
|
- net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
|
||||||
|
- if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "interface type=\"vhostuser\" backend type=\"passt\"") < 0)
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
|
||||||
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_VHOST_VDPA)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
@@ -1857,6 +1851,9 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
|
||||||
|
_("'reconnect' attribute is not supported when source mode='server' for <interface type='vhostuser'>"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "interface") < 0)
|
||||||
|
+ return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!virDomainNetIsVirtioModel(net)) {
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err b/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
|
||||||
|
index 274af5c722..babde17518 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
|
||||||
|
@@ -1 +1 @@
|
||||||
|
-unsupported configuration: 'interface type="vhostuser" backend type="passt"' requires shared memory
|
||||||
|
+unsupported configuration: 'interface' requires shared memory
|
||||||
|
--
|
||||||
|
2.49.0
|
@ -0,0 +1,144 @@
|
|||||||
|
From c8df999c2129645b26c043a81b051b330c05ba46 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <c8df999c2129645b26c043a81b051b330c05ba46.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
Date: Tue, 11 Mar 2025 09:01:03 +0100
|
||||||
|
Subject: [PATCH] qemuxmlconftest: Include shared memory 'net-vhostuser' test
|
||||||
|
cases
|
||||||
|
|
||||||
|
The vhost-user protocol requires shared memory support to work properly.
|
||||||
|
|
||||||
|
Our test XMLs didn't have it configured as for interface the check if
|
||||||
|
shared memory is present only produces a warning instead of a proper
|
||||||
|
error.
|
||||||
|
|
||||||
|
Upcoming patches will be moving the check to become fatal so the test
|
||||||
|
cases need to be fixed first.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
(cherry picked from commit 779a975355dcb34898abaefdf8968c214a66ebf1)
|
||||||
|
|
||||||
|
https://issues.redhat.com/browse/RHEL-84133
|
||||||
|
---
|
||||||
|
tests/qemuxmlconfdata/net-vhostuser-fail.x86_64-latest.xml | 3 +++
|
||||||
|
tests/qemuxmlconfdata/net-vhostuser-fail.xml | 3 +++
|
||||||
|
tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args | 2 +-
|
||||||
|
tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.xml | 3 +++
|
||||||
|
tests/qemuxmlconfdata/net-vhostuser-multiq.xml | 3 +++
|
||||||
|
tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args | 2 +-
|
||||||
|
tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.xml | 3 +++
|
||||||
|
tests/qemuxmlconfdata/net-vhostuser.xml | 3 +++
|
||||||
|
8 files changed, 20 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-fail.x86_64-latest.xml b/tests/qemuxmlconfdata/net-vhostuser-fail.x86_64-latest.xml
|
||||||
|
index 60e591001d..ce1ebf9462 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser-fail.x86_64-latest.xml
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-fail.x86_64-latest.xml
|
||||||
|
@@ -3,6 +3,9 @@
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219136</memory>
|
||||||
|
<currentMemory unit='KiB'>219136</currentMemory>
|
||||||
|
+ <memoryBacking>
|
||||||
|
+ <access mode='shared'/>
|
||||||
|
+ </memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-fail.xml b/tests/qemuxmlconfdata/net-vhostuser-fail.xml
|
||||||
|
index d50589af6f..b6b0b977d5 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser-fail.xml
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-fail.xml
|
||||||
|
@@ -3,6 +3,9 @@
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219136</memory>
|
||||||
|
<currentMemory unit='KiB'>219136</currentMemory>
|
||||||
|
+ <memoryBacking>
|
||||||
|
+ <access mode='shared'/>
|
||||||
|
+ </memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args b/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args
|
||||||
|
index 922758a034..4ea3d4eebd 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.args
|
||||||
|
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
|
||||||
|
-accel tcg \
|
||||||
|
-cpu qemu64 \
|
||||||
|
-m size=219136k \
|
||||||
|
--object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
|
||||||
|
+-object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
|
||||||
|
-overcommit mem-lock=off \
|
||||||
|
-smp 1,sockets=1,cores=1,threads=1 \
|
||||||
|
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.xml b/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.xml
|
||||||
|
index 5c2cf70a4b..93524c2864 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.xml
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-multiq.x86_64-latest.xml
|
||||||
|
@@ -3,6 +3,9 @@
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219136</memory>
|
||||||
|
<currentMemory unit='KiB'>219136</currentMemory>
|
||||||
|
+ <memoryBacking>
|
||||||
|
+ <access mode='shared'/>
|
||||||
|
+ </memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-multiq.xml b/tests/qemuxmlconfdata/net-vhostuser-multiq.xml
|
||||||
|
index ed492ea41a..fa324c9d17 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser-multiq.xml
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-multiq.xml
|
||||||
|
@@ -3,6 +3,9 @@
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219136</memory>
|
||||||
|
<currentMemory unit='KiB'>219136</currentMemory>
|
||||||
|
+ <memoryBacking>
|
||||||
|
+ <access mode='shared'/>
|
||||||
|
+ </memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args b/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args
|
||||||
|
index bc1de8c8ed..f5925c77fe 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.args
|
||||||
|
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
|
||||||
|
-accel tcg \
|
||||||
|
-cpu qemu64 \
|
||||||
|
-m size=219136k \
|
||||||
|
--object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
|
||||||
|
+-object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
|
||||||
|
-overcommit mem-lock=off \
|
||||||
|
-smp 1,sockets=1,cores=1,threads=1 \
|
||||||
|
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.xml b/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.xml
|
||||||
|
index c77d46147e..44bebef2c8 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.xml
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser.x86_64-latest.xml
|
||||||
|
@@ -3,6 +3,9 @@
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219136</memory>
|
||||||
|
<currentMemory unit='KiB'>219136</currentMemory>
|
||||||
|
+ <memoryBacking>
|
||||||
|
+ <access mode='shared'/>
|
||||||
|
+ </memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser.xml b/tests/qemuxmlconfdata/net-vhostuser.xml
|
||||||
|
index e55a30a54f..91d1abc027 100644
|
||||||
|
--- a/tests/qemuxmlconfdata/net-vhostuser.xml
|
||||||
|
+++ b/tests/qemuxmlconfdata/net-vhostuser.xml
|
||||||
|
@@ -3,6 +3,9 @@
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219136</memory>
|
||||||
|
<currentMemory unit='KiB'>219136</currentMemory>
|
||||||
|
+ <memoryBacking>
|
||||||
|
+ <access mode='shared'/>
|
||||||
|
+ </memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
--
|
||||||
|
2.49.0
|
202
libvirt-rpc-remove-logind-support-for-virNetDaemon.patch
Normal file
202
libvirt-rpc-remove-logind-support-for-virNetDaemon.patch
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
From 3c4c4271c77ffe624cae83f3cfec15bf0196b774 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <3c4c4271c77ffe624cae83f3cfec15bf0196b774.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Mon, 16 Dec 2024 16:37:52 +0000
|
||||||
|
Subject: [PATCH] rpc: remove logind support for virNetDaemon
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The virNetDaemon code now only concerns itself with preventing auto
|
||||||
|
shutdown of the local daemon. Logind is now handled by the new
|
||||||
|
virInhibitor object, for QEMU, LXC and LibXL. This fixes two notable
|
||||||
|
bugs
|
||||||
|
|
||||||
|
* Running virtual networks would prevent system shutdown
|
||||||
|
* Loaded ephemeral secrets would prevent system shutdown
|
||||||
|
|
||||||
|
Fixes 9e3cc0ff5e81ed2056a6a528893fd2cb5609d70b
|
||||||
|
Fixes 37800af9a400385801da6d73654249fdb51a93d8
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit 8575724aef4f48f3d66cb7beb4c61014992e31eb)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-83064
|
||||||
|
---
|
||||||
|
src/libxl/libxl_driver.c | 2 +-
|
||||||
|
src/lxc/lxc_driver.c | 2 +-
|
||||||
|
src/qemu/qemu_driver.c | 2 +-
|
||||||
|
src/rpc/virnetdaemon.c | 78 ----------------------------------------
|
||||||
|
4 files changed, 3 insertions(+), 81 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
|
||||||
|
index ecd6ea9fa8..2a4f31f93c 100644
|
||||||
|
--- a/src/libxl/libxl_driver.c
|
||||||
|
+++ b/src/libxl/libxl_driver.c
|
||||||
|
@@ -707,7 +707,7 @@ libxlStateInitialize(bool privileged,
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
libxl_driver->inhibitor = virInhibitorNew(
|
||||||
|
- VIR_INHIBITOR_WHAT_NONE,
|
||||||
|
+ VIR_INHIBITOR_WHAT_SHUTDOWN,
|
||||||
|
_("Libvirt Xen"),
|
||||||
|
_("Xen virtual machines are running"),
|
||||||
|
VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
|
||||||
|
index 9ee771c62a..72b950ac8a 100644
|
||||||
|
--- a/src/lxc/lxc_driver.c
|
||||||
|
+++ b/src/lxc/lxc_driver.c
|
||||||
|
@@ -1488,7 +1488,7 @@ lxcStateInitialize(bool privileged,
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
lxc_driver->inhibitor = virInhibitorNew(
|
||||||
|
- VIR_INHIBITOR_WHAT_NONE,
|
||||||
|
+ VIR_INHIBITOR_WHAT_SHUTDOWN,
|
||||||
|
_("Libvirt LXC"),
|
||||||
|
_("LXC containers are running"),
|
||||||
|
VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||||
|
index 5b911d5221..f8f3d2c725 100644
|
||||||
|
--- a/src/qemu/qemu_driver.c
|
||||||
|
+++ b/src/qemu/qemu_driver.c
|
||||||
|
@@ -673,7 +673,7 @@ qemuStateInitialize(bool privileged,
|
||||||
|
}
|
||||||
|
|
||||||
|
qemu_driver->inhibitor = virInhibitorNew(
|
||||||
|
- VIR_INHIBITOR_WHAT_NONE,
|
||||||
|
+ VIR_INHIBITOR_WHAT_SHUTDOWN,
|
||||||
|
_("Libvirt QEMU"),
|
||||||
|
_("QEMU/KVM virtual machines are running"),
|
||||||
|
VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
|
||||||
|
index 9795418126..e4c6261536 100644
|
||||||
|
--- a/src/rpc/virnetdaemon.c
|
||||||
|
+++ b/src/rpc/virnetdaemon.c
|
||||||
|
@@ -31,7 +31,6 @@
|
||||||
|
#include "virutil.h"
|
||||||
|
#include "virfile.h"
|
||||||
|
#include "virnetserver.h"
|
||||||
|
-#include "virgdbus.h"
|
||||||
|
#include "virhash.h"
|
||||||
|
#include "virprocess.h"
|
||||||
|
#include "virsystemd.h"
|
||||||
|
@@ -80,7 +79,6 @@ struct _virNetDaemon {
|
||||||
|
int autoShutdownTimerID;
|
||||||
|
bool autoShutdownTimerActive;
|
||||||
|
size_t autoShutdownInhibitions;
|
||||||
|
- int autoShutdownInhibitFd;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -109,7 +107,6 @@ virNetDaemonDispose(void *obj)
|
||||||
|
virEventRemoveHandle(dmn->sigwatch);
|
||||||
|
#endif /* !WIN32 */
|
||||||
|
|
||||||
|
- VIR_FORCE_CLOSE(dmn->autoShutdownInhibitFd);
|
||||||
|
g_free(dmn->stateStopThread);
|
||||||
|
|
||||||
|
g_clear_pointer(&dmn->servers, g_hash_table_unref);
|
||||||
|
@@ -150,7 +147,6 @@ virNetDaemonNew(void)
|
||||||
|
#endif /* !WIN32 */
|
||||||
|
|
||||||
|
dmn->privileged = geteuid() == 0;
|
||||||
|
- dmn->autoShutdownInhibitFd = -1;
|
||||||
|
|
||||||
|
virProcessActivateMaxFiles();
|
||||||
|
|
||||||
|
@@ -491,66 +487,6 @@ virNetDaemonAutoShutdown(virNetDaemon *dmn,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-#ifdef G_OS_UNIX
|
||||||
|
-/* As per: https://www.freedesktop.org/wiki/Software/systemd/inhibit */
|
||||||
|
-static void
|
||||||
|
-virNetDaemonCallInhibit(virNetDaemon *dmn,
|
||||||
|
- const char *what,
|
||||||
|
- const char *who,
|
||||||
|
- const char *why,
|
||||||
|
- const char *mode)
|
||||||
|
-{
|
||||||
|
- g_autoptr(GVariant) reply = NULL;
|
||||||
|
- g_autoptr(GUnixFDList) replyFD = NULL;
|
||||||
|
- g_autoptr(GVariant) message = NULL;
|
||||||
|
- GDBusConnection *systemBus;
|
||||||
|
- int fd;
|
||||||
|
- int rc;
|
||||||
|
-
|
||||||
|
- VIR_DEBUG("dmn=%p what=%s who=%s why=%s mode=%s",
|
||||||
|
- dmn, NULLSTR(what), NULLSTR(who), NULLSTR(why), NULLSTR(mode));
|
||||||
|
-
|
||||||
|
- if (virSystemdHasLogind() < 0)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- if (!(systemBus = virGDBusGetSystemBus()))
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- message = g_variant_new("(ssss)", what, who, why, mode);
|
||||||
|
-
|
||||||
|
- rc = virGDBusCallMethodWithFD(systemBus,
|
||||||
|
- &reply,
|
||||||
|
- G_VARIANT_TYPE("(h)"),
|
||||||
|
- &replyFD,
|
||||||
|
- NULL,
|
||||||
|
- "org.freedesktop.login1",
|
||||||
|
- "/org/freedesktop/login1",
|
||||||
|
- "org.freedesktop.login1.Manager",
|
||||||
|
- "Inhibit",
|
||||||
|
- message,
|
||||||
|
- NULL);
|
||||||
|
-
|
||||||
|
- if (rc < 0)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- if (g_unix_fd_list_get_length(replyFD) <= 0)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- fd = g_unix_fd_list_get(replyFD, 0, NULL);
|
||||||
|
- if (fd < 0)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- if (dmn->autoShutdownInhibitions) {
|
||||||
|
- dmn->autoShutdownInhibitFd = fd;
|
||||||
|
- VIR_DEBUG("Got inhibit FD %d", fd);
|
||||||
|
- } else {
|
||||||
|
- /* We stopped the last VM since we made the inhibit call */
|
||||||
|
- VIR_DEBUG("Closing inhibit FD %d", fd);
|
||||||
|
- VIR_FORCE_CLOSE(fd);
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
void
|
||||||
|
virNetDaemonAddShutdownInhibition(virNetDaemon *dmn)
|
||||||
|
{
|
||||||
|
@@ -559,15 +495,6 @@ virNetDaemonAddShutdownInhibition(virNetDaemon *dmn)
|
||||||
|
dmn->autoShutdownInhibitions++;
|
||||||
|
|
||||||
|
VIR_DEBUG("dmn=%p inhibitions=%zu", dmn, dmn->autoShutdownInhibitions);
|
||||||
|
-
|
||||||
|
-#ifdef G_OS_UNIX
|
||||||
|
- if (dmn->autoShutdownInhibitions == 1)
|
||||||
|
- virNetDaemonCallInhibit(dmn,
|
||||||
|
- "shutdown",
|
||||||
|
- _("Libvirt"),
|
||||||
|
- _("Virtual machines need to be saved"),
|
||||||
|
- "delay");
|
||||||
|
-#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -579,11 +506,6 @@ virNetDaemonRemoveShutdownInhibition(virNetDaemon *dmn)
|
||||||
|
dmn->autoShutdownInhibitions--;
|
||||||
|
|
||||||
|
VIR_DEBUG("dmn=%p inhibitions=%zu", dmn, dmn->autoShutdownInhibitions);
|
||||||
|
-
|
||||||
|
- if (dmn->autoShutdownInhibitions == 0) {
|
||||||
|
- VIR_DEBUG("Closing inhibit FD %d", dmn->autoShutdownInhibitFd);
|
||||||
|
- VIR_FORCE_CLOSE(dmn->autoShutdownInhibitFd);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
2.49.0
|
549
libvirt-src-convert-drivers-over-to-new-virInhibitor-APIs.patch
Normal file
549
libvirt-src-convert-drivers-over-to-new-virInhibitor-APIs.patch
Normal file
@ -0,0 +1,549 @@
|
|||||||
|
From 079d7a5d0a1dd198f96749d415295d8340476902 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <079d7a5d0a1dd198f96749d415295d8340476902.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Mon, 16 Dec 2024 16:28:48 +0000
|
||||||
|
Subject: [PATCH] src: convert drivers over to new virInhibitor APIs
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This initial conversion of the drivers switches them over to use
|
||||||
|
the virInhibitor APIs in local daemon only mode. Communication to
|
||||||
|
logind is still handled by the virNetDaemon class logic.
|
||||||
|
|
||||||
|
This mostly just replaces upto 3 fields in the driver state
|
||||||
|
with a single new virInhibitor object, but otherwise should not
|
||||||
|
change functionality besides replacing atomics with mutex protected
|
||||||
|
APIs.
|
||||||
|
|
||||||
|
The exception is the LXC driver which has been trying to inhibit
|
||||||
|
shutdown shutdown but silently failing to, since nothing ever
|
||||||
|
remembered to set the 'inhibitCallback' pointer in the driver
|
||||||
|
state struct.
|
||||||
|
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit 48f0b6dfa12563f0006d2de4b0f85599e20f9449)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-83064
|
||||||
|
---
|
||||||
|
src/libxl/libxl_conf.h | 9 +++----
|
||||||
|
src/libxl/libxl_domain.c | 6 ++---
|
||||||
|
src/libxl/libxl_driver.c | 15 +++++++----
|
||||||
|
src/lxc/lxc_conf.h | 9 +++----
|
||||||
|
src/lxc/lxc_driver.c | 13 +++++++--
|
||||||
|
src/lxc/lxc_process.c | 9 +++----
|
||||||
|
src/network/bridge_driver.c | 20 +++++++-------
|
||||||
|
src/network/bridge_driver_conf.h | 9 +++----
|
||||||
|
src/qemu/qemu_conf.h | 9 +++----
|
||||||
|
src/qemu/qemu_driver.c | 12 ++++++---
|
||||||
|
src/qemu/qemu_process.c | 9 +++----
|
||||||
|
src/secret/secret_driver.c | 46 +++++++++++++-------------------
|
||||||
|
12 files changed, 80 insertions(+), 86 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
|
||||||
|
index 7087b41079..0edcde079d 100644
|
||||||
|
--- a/src/libxl/libxl_conf.h
|
||||||
|
+++ b/src/libxl/libxl_conf.h
|
||||||
|
@@ -35,6 +35,7 @@
|
||||||
|
#include "virfirmware.h"
|
||||||
|
#include "libxl_capabilities.h"
|
||||||
|
#include "libxl_logger.h"
|
||||||
|
+#include "virinhibitor.h"
|
||||||
|
|
||||||
|
#define LIBXL_DRIVER_EXTERNAL_NAME "Xen"
|
||||||
|
/*
|
||||||
|
@@ -117,12 +118,8 @@ struct _libxlDriverPrivate {
|
||||||
|
/* pid file FD, ensures two copies of the driver can't use the same root */
|
||||||
|
int lockFD;
|
||||||
|
|
||||||
|
- /* Atomic inc/dec only */
|
||||||
|
- unsigned int nactive;
|
||||||
|
-
|
||||||
|
- /* Immutable pointers. Caller must provide locking */
|
||||||
|
- virStateInhibitCallback inhibitCallback;
|
||||||
|
- void *inhibitOpaque;
|
||||||
|
+ /* Immutable pointer, self-locking APIs */
|
||||||
|
+ virInhibitor *inhibitor;
|
||||||
|
|
||||||
|
/* Immutable pointer, self-locking APIs */
|
||||||
|
virDomainObjList *domains;
|
||||||
|
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
|
||||||
|
index 711e22b8df..6805160923 100644
|
||||||
|
--- a/src/libxl/libxl_domain.c
|
||||||
|
+++ b/src/libxl/libxl_domain.c
|
||||||
|
@@ -873,8 +873,7 @@ libxlDomainCleanup(libxlDriverPrivate *driver,
|
||||||
|
priv->deathW = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(false, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorRelease(driver->inhibitor);
|
||||||
|
|
||||||
|
/* Release auto-allocated graphics ports */
|
||||||
|
for (i = 0; i < vm->def->ngraphics; i++) {
|
||||||
|
@@ -1418,8 +1417,7 @@ libxlDomainStart(libxlDriverPrivate *driver,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
|
||||||
|
event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED,
|
||||||
|
restore_fd < 0 ?
|
||||||
|
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
|
||||||
|
index b670e697c6..ecd6ea9fa8 100644
|
||||||
|
--- a/src/libxl/libxl_driver.c
|
||||||
|
+++ b/src/libxl/libxl_driver.c
|
||||||
|
@@ -437,8 +437,7 @@ libxlReconnectDomain(virDomainObj *vm,
|
||||||
|
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
|
||||||
|
VIR_DOMAIN_RUNNING_UNKNOWN);
|
||||||
|
|
||||||
|
- if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
|
||||||
|
/* Enable domain death events */
|
||||||
|
libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->deathW);
|
||||||
|
@@ -514,6 +513,7 @@ libxlStateCleanup(void)
|
||||||
|
|
||||||
|
virObjectUnref(libxl_driver->domainEventState);
|
||||||
|
virSysinfoDefFree(libxl_driver->hostsysinfo);
|
||||||
|
+ virInhibitorFree(libxl_driver->inhibitor);
|
||||||
|
|
||||||
|
if (libxl_driver->lockFD != -1)
|
||||||
|
virPidFileRelease(libxl_driver->config->stateDir, "driver", libxl_driver->lockFD);
|
||||||
|
@@ -675,9 +675,6 @@ libxlStateInitialize(bool privileged,
|
||||||
|
return VIR_DRV_STATE_INIT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
- libxl_driver->inhibitCallback = callback;
|
||||||
|
- libxl_driver->inhibitOpaque = opaque;
|
||||||
|
-
|
||||||
|
/* Allocate bitmap for vnc port reservation */
|
||||||
|
if (!(libxl_driver->reservedGraphicsPorts =
|
||||||
|
virPortAllocatorRangeNew(_("VNC"),
|
||||||
|
@@ -709,6 +706,14 @@ libxlStateInitialize(bool privileged,
|
||||||
|
if (libxlDriverConfigLoadFile(cfg, driverConf) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
+ libxl_driver->inhibitor = virInhibitorNew(
|
||||||
|
+ VIR_INHIBITOR_WHAT_NONE,
|
||||||
|
+ _("Libvirt Xen"),
|
||||||
|
+ _("Xen virtual machines are running"),
|
||||||
|
+ VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
+ callback,
|
||||||
|
+ opaque);
|
||||||
|
+
|
||||||
|
/* Register the callbacks providing access to libvirt's event loop */
|
||||||
|
libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx);
|
||||||
|
|
||||||
|
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
|
||||||
|
index c0967ac63b..73c60c7ebf 100644
|
||||||
|
--- a/src/lxc/lxc_conf.h
|
||||||
|
+++ b/src/lxc/lxc_conf.h
|
||||||
|
@@ -30,6 +30,7 @@
|
||||||
|
#include "virsysinfo.h"
|
||||||
|
#include "virclosecallbacks.h"
|
||||||
|
#include "virhostdev.h"
|
||||||
|
+#include "virinhibitor.h"
|
||||||
|
|
||||||
|
#define LXC_DRIVER_NAME "LXC"
|
||||||
|
|
||||||
|
@@ -76,12 +77,8 @@ struct _virLXCDriver {
|
||||||
|
/* Immutable pointer, lockless APIs */
|
||||||
|
virSysinfoDef *hostsysinfo;
|
||||||
|
|
||||||
|
- /* Atomic inc/dec only */
|
||||||
|
- unsigned int nactive;
|
||||||
|
-
|
||||||
|
- /* Immutable pointers. Caller must provide locking */
|
||||||
|
- virStateInhibitCallback inhibitCallback;
|
||||||
|
- void *inhibitOpaque;
|
||||||
|
+ /* Immutable pointer, self-locking APIs */
|
||||||
|
+ virInhibitor *inhibitor;
|
||||||
|
|
||||||
|
/* Immutable pointer, self-locking APIs */
|
||||||
|
virDomainObjList *domains;
|
||||||
|
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
|
||||||
|
index 9609d7d10c..9ee771c62a 100644
|
||||||
|
--- a/src/lxc/lxc_driver.c
|
||||||
|
+++ b/src/lxc/lxc_driver.c
|
||||||
|
@@ -1433,8 +1433,8 @@ static virDrvStateInitResult
|
||||||
|
lxcStateInitialize(bool privileged,
|
||||||
|
const char *root,
|
||||||
|
bool monolithic G_GNUC_UNUSED,
|
||||||
|
- virStateInhibitCallback callback G_GNUC_UNUSED,
|
||||||
|
- void *opaque G_GNUC_UNUSED)
|
||||||
|
+ virStateInhibitCallback callback,
|
||||||
|
+ void *opaque)
|
||||||
|
{
|
||||||
|
virLXCDriverConfig *cfg = NULL;
|
||||||
|
bool autostart = true;
|
||||||
|
@@ -1487,6 +1487,14 @@ lxcStateInitialize(bool privileged,
|
||||||
|
if (virLXCLoadDriverConfig(cfg, SYSCONFDIR "/libvirt/lxc.conf") < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
+ lxc_driver->inhibitor = virInhibitorNew(
|
||||||
|
+ VIR_INHIBITOR_WHAT_NONE,
|
||||||
|
+ _("Libvirt LXC"),
|
||||||
|
+ _("LXC containers are running"),
|
||||||
|
+ VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
+ callback,
|
||||||
|
+ opaque);
|
||||||
|
+
|
||||||
|
if (!(lxc_driver->securityManager = lxcSecurityInit(cfg)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
@@ -1591,6 +1599,7 @@ static int lxcStateCleanup(void)
|
||||||
|
virObjectUnref(lxc_driver->caps);
|
||||||
|
virObjectUnref(lxc_driver->securityManager);
|
||||||
|
virObjectUnref(lxc_driver->xmlopt);
|
||||||
|
+ virInhibitorFree(lxc_driver->inhibitor);
|
||||||
|
|
||||||
|
if (lxc_driver->lockFD != -1)
|
||||||
|
virPidFileRelease(lxc_driver->config->stateDir, "driver", lxc_driver->lockFD);
|
||||||
|
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
|
||||||
|
index cd8bcfc282..c2982244f0 100644
|
||||||
|
--- a/src/lxc/lxc_process.c
|
||||||
|
+++ b/src/lxc/lxc_process.c
|
||||||
|
@@ -203,8 +203,7 @@ static void virLXCProcessCleanup(virLXCDriver *driver,
|
||||||
|
vm->pid = 0;
|
||||||
|
vm->def->id = -1;
|
||||||
|
|
||||||
|
- if (g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(false, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorRelease(driver->inhibitor);
|
||||||
|
|
||||||
|
virLXCDomainReAttachHostDevices(driver, vm->def);
|
||||||
|
|
||||||
|
@@ -1466,8 +1465,7 @@ int virLXCProcessStart(virLXCDriver * driver,
|
||||||
|
if (virCommandHandshakeNotify(cmd) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
- if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
|
||||||
|
/* The first synchronization point is when the controller creates CGroups. */
|
||||||
|
if (lxcContainerWaitForContinue(handshakefds[0]) < 0) {
|
||||||
|
@@ -1665,8 +1663,7 @@ virLXCProcessReconnectDomain(virDomainObj *vm,
|
||||||
|
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
|
||||||
|
VIR_DOMAIN_RUNNING_UNKNOWN);
|
||||||
|
|
||||||
|
- if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
|
||||||
|
if (!(priv->monitor = virLXCProcessConnectMonitor(driver, vm)))
|
||||||
|
goto error;
|
||||||
|
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
|
||||||
|
index e700a614a9..ce793c12ef 100644
|
||||||
|
--- a/src/network/bridge_driver.c
|
||||||
|
+++ b/src/network/bridge_driver.c
|
||||||
|
@@ -504,8 +504,7 @@ networkUpdateState(virNetworkObj *obj,
|
||||||
|
if (virNetworkObjIsActive(obj)) {
|
||||||
|
virNetworkObjPortForEach(obj, networkUpdatePort, obj);
|
||||||
|
|
||||||
|
- if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try and read dnsmasq pids of both active and inactive networks, just in
|
||||||
|
@@ -644,9 +643,6 @@ networkStateInitialize(bool privileged,
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
- network_driver->inhibitCallback = callback;
|
||||||
|
- network_driver->inhibitOpaque = opaque;
|
||||||
|
-
|
||||||
|
network_driver->privileged = privileged;
|
||||||
|
|
||||||
|
if (!(network_driver->xmlopt = networkDnsmasqCreateXMLConf()))
|
||||||
|
@@ -655,6 +651,14 @@ networkStateInitialize(bool privileged,
|
||||||
|
if (!(network_driver->config = cfg = virNetworkDriverConfigNew(privileged)))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
+ network_driver->inhibitor = virInhibitorNew(
|
||||||
|
+ VIR_INHIBITOR_WHAT_NONE,
|
||||||
|
+ _("Libvirt Network"),
|
||||||
|
+ _("Virtual networks are active"),
|
||||||
|
+ VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
+ callback,
|
||||||
|
+ opaque);
|
||||||
|
+
|
||||||
|
if ((network_driver->lockFD =
|
||||||
|
virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0)
|
||||||
|
goto error;
|
||||||
|
@@ -2432,8 +2436,7 @@ networkStartNetwork(virNetworkDriverState *driver,
|
||||||
|
obj, network_driver->xmlopt) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
- if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
|
||||||
|
virNetworkObjSetActive(obj, true);
|
||||||
|
VIR_INFO("Network '%s' started up", def->name);
|
||||||
|
@@ -2509,8 +2512,7 @@ networkShutdownNetwork(virNetworkDriverState *driver,
|
||||||
|
|
||||||
|
virNetworkObjSetActive(obj, false);
|
||||||
|
|
||||||
|
- if (g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(false, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorRelease(driver->inhibitor);
|
||||||
|
|
||||||
|
virNetworkObjUnsetDefTransient(obj);
|
||||||
|
return ret;
|
||||||
|
diff --git a/src/network/bridge_driver_conf.h b/src/network/bridge_driver_conf.h
|
||||||
|
index 1beed01efb..2a2e2bc16d 100644
|
||||||
|
--- a/src/network/bridge_driver_conf.h
|
||||||
|
+++ b/src/network/bridge_driver_conf.h
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
#include "virnetworkobj.h"
|
||||||
|
#include "object_event.h"
|
||||||
|
#include "virfirewall.h"
|
||||||
|
+#include "virinhibitor.h"
|
||||||
|
|
||||||
|
typedef struct _virNetworkDriverConfig virNetworkDriverConfig;
|
||||||
|
struct _virNetworkDriverConfig {
|
||||||
|
@@ -49,12 +50,8 @@ typedef struct _virNetworkDriverState virNetworkDriverState;
|
||||||
|
struct _virNetworkDriverState {
|
||||||
|
virMutex lock;
|
||||||
|
|
||||||
|
- /* Atomic inc/dec only */
|
||||||
|
- unsigned int nactive;
|
||||||
|
-
|
||||||
|
- /* Immutable pointers. Caller must provide locking */
|
||||||
|
- virStateInhibitCallback inhibitCallback;
|
||||||
|
- void *inhibitOpaque;
|
||||||
|
+ /* Immutable pointer, self-locking APIs */
|
||||||
|
+ virInhibitor *inhibitor;
|
||||||
|
|
||||||
|
/* Read-only */
|
||||||
|
bool privileged;
|
||||||
|
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
|
||||||
|
index 23a900193e..42cdb6f883 100644
|
||||||
|
--- a/src/qemu/qemu_conf.h
|
||||||
|
+++ b/src/qemu/qemu_conf.h
|
||||||
|
@@ -42,6 +42,7 @@
|
||||||
|
#include "virfile.h"
|
||||||
|
#include "virfilecache.h"
|
||||||
|
#include "virfirmware.h"
|
||||||
|
+#include "virinhibitor.h"
|
||||||
|
|
||||||
|
#define QEMU_DRIVER_NAME "QEMU"
|
||||||
|
|
||||||
|
@@ -257,16 +258,12 @@ struct _virQEMUDriver {
|
||||||
|
/* Atomic increment only */
|
||||||
|
int lastvmid;
|
||||||
|
|
||||||
|
- /* Atomic inc/dec only */
|
||||||
|
- unsigned int nactive;
|
||||||
|
-
|
||||||
|
/* Immutable values */
|
||||||
|
bool privileged;
|
||||||
|
char *embeddedRoot;
|
||||||
|
|
||||||
|
- /* Immutable pointers. Caller must provide locking */
|
||||||
|
- virStateInhibitCallback inhibitCallback;
|
||||||
|
- void *inhibitOpaque;
|
||||||
|
+ /* Immutable pointer, self-locking APIs */
|
||||||
|
+ virInhibitor *inhibitor;
|
||||||
|
|
||||||
|
/* Immutable pointer, self-locking APIs */
|
||||||
|
virDomainObjList *domains;
|
||||||
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||||
|
index 379f9fb74f..5b911d5221 100644
|
||||||
|
--- a/src/qemu/qemu_driver.c
|
||||||
|
+++ b/src/qemu/qemu_driver.c
|
||||||
|
@@ -573,9 +573,6 @@ qemuStateInitialize(bool privileged,
|
||||||
|
return VIR_DRV_STATE_INIT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
- qemu_driver->inhibitCallback = callback;
|
||||||
|
- qemu_driver->inhibitOpaque = opaque;
|
||||||
|
-
|
||||||
|
qemu_driver->privileged = privileged;
|
||||||
|
qemu_driver->hostarch = virArchFromHost();
|
||||||
|
if (root != NULL)
|
||||||
|
@@ -675,6 +672,14 @@ qemuStateInitialize(bool privileged,
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ qemu_driver->inhibitor = virInhibitorNew(
|
||||||
|
+ VIR_INHIBITOR_WHAT_NONE,
|
||||||
|
+ _("Libvirt QEMU"),
|
||||||
|
+ _("QEMU/KVM virtual machines are running"),
|
||||||
|
+ VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
+ callback,
|
||||||
|
+ opaque);
|
||||||
|
+
|
||||||
|
if ((qemu_driver->lockFD =
|
||||||
|
virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0)
|
||||||
|
goto error;
|
||||||
|
@@ -1065,6 +1070,7 @@ qemuStateCleanup(void)
|
||||||
|
ebtablesContextFree(qemu_driver->ebtables);
|
||||||
|
virObjectUnref(qemu_driver->domains);
|
||||||
|
virObjectUnref(qemu_driver->nbdkitCapsCache);
|
||||||
|
+ virInhibitorFree(qemu_driver->inhibitor);
|
||||||
|
|
||||||
|
if (qemu_driver->lockFD != -1)
|
||||||
|
virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_driver->lockFD);
|
||||||
|
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||||
|
index 7285fd5ce9..722e982b9e 100644
|
||||||
|
--- a/src/qemu/qemu_process.c
|
||||||
|
+++ b/src/qemu/qemu_process.c
|
||||||
|
@@ -5853,8 +5853,7 @@ qemuProcessInit(virQEMUDriver *driver,
|
||||||
|
qemuDomainSetFakeReboot(vm, false);
|
||||||
|
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_STARTING_UP);
|
||||||
|
|
||||||
|
- if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
|
||||||
|
/* Run an early hook to set-up missing devices */
|
||||||
|
if (qemuProcessStartHook(driver, vm,
|
||||||
|
@@ -8885,8 +8884,7 @@ void qemuProcessStop(virQEMUDriver *driver,
|
||||||
|
if (priv->eventThread)
|
||||||
|
g_object_unref(g_steal_pointer(&priv->eventThread));
|
||||||
|
|
||||||
|
- if (g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(false, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorRelease(driver->inhibitor);
|
||||||
|
|
||||||
|
/* Clear network bandwidth */
|
||||||
|
virDomainClearNetBandwidth(vm->def);
|
||||||
|
@@ -9644,8 +9642,7 @@ qemuProcessReconnect(void *opaque)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (g_atomic_int_add(&driver->nactive, 1) == 0 && driver->inhibitCallback)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (jobStarted)
|
||||||
|
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
|
||||||
|
index a2d6b879d0..04c3ca49f1 100644
|
||||||
|
--- a/src/secret/secret_driver.c
|
||||||
|
+++ b/src/secret/secret_driver.c
|
||||||
|
@@ -41,6 +41,7 @@
|
||||||
|
#include "viraccessapicheck.h"
|
||||||
|
#include "secret_event.h"
|
||||||
|
#include "virutil.h"
|
||||||
|
+#include "virinhibitor.h"
|
||||||
|
|
||||||
|
#define VIR_FROM_THIS VIR_FROM_SECRET
|
||||||
|
|
||||||
|
@@ -67,9 +68,8 @@ struct _virSecretDriverState {
|
||||||
|
/* Immutable pointer, self-locking APIs */
|
||||||
|
virObjectEventState *secretEventState;
|
||||||
|
|
||||||
|
- /* Immutable pointers. Caller must provide locking */
|
||||||
|
- virStateInhibitCallback inhibitCallback;
|
||||||
|
- void *inhibitOpaque;
|
||||||
|
+ /* Immutable pointer, self-locking APIs */
|
||||||
|
+ virInhibitor *inhibitor;
|
||||||
|
};
|
||||||
|
|
||||||
|
static virSecretDriverState *driver;
|
||||||
|
@@ -90,23 +90,6 @@ secretObjFromSecret(virSecretPtr secret)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-static bool
|
||||||
|
-secretNumOfEphemeralSecretsHelper(virConnectPtr conn G_GNUC_UNUSED,
|
||||||
|
- virSecretDef *def)
|
||||||
|
-{
|
||||||
|
- return def->isephemeral;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-static int
|
||||||
|
-secretNumOfEphemeralSecrets(void)
|
||||||
|
-{
|
||||||
|
- return virSecretObjListNumOfSecrets(driver->secrets,
|
||||||
|
- secretNumOfEphemeralSecretsHelper,
|
||||||
|
- NULL);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
/* Driver functions */
|
||||||
|
|
||||||
|
static int
|
||||||
|
@@ -271,6 +254,10 @@ secretDefineXML(virConnectPtr conn,
|
||||||
|
objDef->uuid,
|
||||||
|
objDef->usage_type,
|
||||||
|
objDef->usage_id);
|
||||||
|
+
|
||||||
|
+ if (objDef->isephemeral)
|
||||||
|
+ virInhibitorHold(driver->inhibitor);
|
||||||
|
+
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
restore_backup:
|
||||||
|
@@ -288,8 +275,6 @@ secretDefineXML(virConnectPtr conn,
|
||||||
|
virSecretDefFree(def);
|
||||||
|
virSecretObjEndAPI(&obj);
|
||||||
|
|
||||||
|
- if (secretNumOfEphemeralSecrets() > 0)
|
||||||
|
- driver->inhibitCallback(true, driver->inhibitOpaque);
|
||||||
|
|
||||||
|
virObjectEventStateQueue(driver->secretEventState, event);
|
||||||
|
|
||||||
|
@@ -440,6 +425,9 @@ secretUndefine(virSecretPtr secret)
|
||||||
|
VIR_SECRET_EVENT_UNDEFINED,
|
||||||
|
0);
|
||||||
|
|
||||||
|
+ if (def->isephemeral)
|
||||||
|
+ virInhibitorRelease(driver->inhibitor);
|
||||||
|
+
|
||||||
|
virSecretObjDeleteData(obj);
|
||||||
|
|
||||||
|
virSecretObjListRemove(driver->secrets, obj);
|
||||||
|
@@ -450,9 +438,6 @@ secretUndefine(virSecretPtr secret)
|
||||||
|
cleanup:
|
||||||
|
virSecretObjEndAPI(&obj);
|
||||||
|
|
||||||
|
- if (secretNumOfEphemeralSecrets() == 0)
|
||||||
|
- driver->inhibitCallback(false, driver->inhibitOpaque);
|
||||||
|
-
|
||||||
|
virObjectEventStateQueue(driver->secretEventState, event);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
@@ -469,6 +454,7 @@ secretStateCleanupLocked(void)
|
||||||
|
VIR_FREE(driver->configDir);
|
||||||
|
|
||||||
|
virObjectUnref(driver->secretEventState);
|
||||||
|
+ virInhibitorFree(driver->inhibitor);
|
||||||
|
|
||||||
|
if (driver->lockFD != -1)
|
||||||
|
virPidFileRelease(driver->stateDir, "driver", driver->lockFD);
|
||||||
|
@@ -502,8 +488,6 @@ secretStateInitialize(bool privileged,
|
||||||
|
driver->lockFD = -1;
|
||||||
|
driver->secretEventState = virObjectEventStateNew();
|
||||||
|
driver->privileged = privileged;
|
||||||
|
- driver->inhibitCallback = callback;
|
||||||
|
- driver->inhibitOpaque = opaque;
|
||||||
|
|
||||||
|
if (root) {
|
||||||
|
driver->embeddedRoot = g_strdup(root);
|
||||||
|
@@ -535,6 +519,14 @@ secretStateInitialize(bool privileged,
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ driver->inhibitor = virInhibitorNew(
|
||||||
|
+ VIR_INHIBITOR_WHAT_NONE,
|
||||||
|
+ _("Libvirt Secret"),
|
||||||
|
+ _("Ephemeral secrets are loaded"),
|
||||||
|
+ VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
+ callback,
|
||||||
|
+ opaque);
|
||||||
|
+
|
||||||
|
if ((driver->lockFD =
|
||||||
|
virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0)
|
||||||
|
goto error;
|
||||||
|
--
|
||||||
|
2.49.0
|
167
libvirt-src-introduce-raw-and-rawset-ACPI-table-types.patch
Normal file
167
libvirt-src-introduce-raw-and-rawset-ACPI-table-types.patch
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
From 27c5b0f2d04b700ef763ae1299143bca638c6d91 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <27c5b0f2d04b700ef763ae1299143bca638c6d91.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Wed, 26 Feb 2025 18:39:18 +0000
|
||||||
|
Subject: [PATCH] src: introduce 'raw' and 'rawset' ACPI table types
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The QEMU driver has only accepted type=slic even though QEMU is able to
|
||||||
|
accept individual tables of any type, without needing to specify a
|
||||||
|
signature. Introduce type=raw to address this usage scenario. Contrary
|
||||||
|
to other types, this one may appear multiple times.
|
||||||
|
|
||||||
|
The Xen driver has mistakenly accepted type=slic and use it to set the
|
||||||
|
Xen acpi_firmware setting, which performs a simple passthrough of
|
||||||
|
multiple concatenated data table. Introduce type=rawset to address
|
||||||
|
this usage scenario.
|
||||||
|
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit 513ef8f028e8b0acbad2c38b8db6507bd96484cc)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-81041
|
||||||
|
---
|
||||||
|
docs/formatdomain.rst | 19 ++++++++++++++++---
|
||||||
|
src/conf/domain_conf.c | 5 ++++-
|
||||||
|
src/conf/domain_conf.h | 2 ++
|
||||||
|
src/conf/schemas/domaincommon.rng | 6 +++++-
|
||||||
|
src/libxl/libxl_domain.c | 7 +++++++
|
||||||
|
src/qemu/qemu_command.c | 2 ++
|
||||||
|
src/qemu/qemu_validate.c | 7 +++++++
|
||||||
|
7 files changed, 43 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
|
||||||
|
index c077c09a39..b6e162235c 100644
|
||||||
|
--- a/docs/formatdomain.rst
|
||||||
|
+++ b/docs/formatdomain.rst
|
||||||
|
@@ -484,9 +484,22 @@ These options apply to any form of booting of the guest OS.
|
||||||
|
...
|
||||||
|
|
||||||
|
``acpi``
|
||||||
|
- The ``table`` element contains a fully-qualified path to the ACPI table. The
|
||||||
|
- ``type`` attribute contains the ACPI table type (currently only ``slic`` is
|
||||||
|
- supported) :since:`Since 1.3.5 (QEMU)` :since:`Since 5.9.0 (Xen)`
|
||||||
|
+ The ``table`` element contains a fully-qualified path to the ACPI table,
|
||||||
|
+ with the ``type`` attribute dictating what data must be present in the
|
||||||
|
+ file:
|
||||||
|
+
|
||||||
|
+ * ``raw``: a single ACPI table with header and data, with ACPI
|
||||||
|
+ signature auto-detected from header (:since:`Since 11.2.0`).
|
||||||
|
+ * ``rawset``: concatenation of multiple ACPI tables with header
|
||||||
|
+ and data, each with any ACPI signature, auto-detected from header
|
||||||
|
+ (:since:`Since 11.2.0`).
|
||||||
|
+ * ``slic``: a single ACPI table with header and data, providing
|
||||||
|
+ software licensing information. The ACPI table signature in the
|
||||||
|
+ header will be forced to ``SLIC`` (:since:`Since 1.3.5 (QEMU)`,
|
||||||
|
+ mis-interpreted as ``rawset`` :since:`Since 5.9.0 (Xen)`).
|
||||||
|
+
|
||||||
|
+ Each type may be used only once, except for ``raw`` which can
|
||||||
|
+ appear multiple times.
|
||||||
|
|
||||||
|
|
||||||
|
SMBIOS System Information
|
||||||
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||||
|
index b0628da279..2ee0403c86 100644
|
||||||
|
--- a/src/conf/domain_conf.c
|
||||||
|
+++ b/src/conf/domain_conf.c
|
||||||
|
@@ -1458,6 +1458,8 @@ VIR_ENUM_IMPL(virDomainOsDefFirmwareFeature,
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virDomainOsACPITable,
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST,
|
||||||
|
+ "raw",
|
||||||
|
+ "rawset",
|
||||||
|
"slic",
|
||||||
|
);
|
||||||
|
|
||||||
|
@@ -17891,7 +17893,8 @@ virDomainDefParseBootAcpiOptions(virDomainDef *def,
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
for (j = 0; j < i; j++) {
|
||||||
|
- if (tables[j]->type == type) {
|
||||||
|
+ if (tables[j]->type == type &&
|
||||||
|
+ type != VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("ACPI table type '%1$s' may only appear once"),
|
||||||
|
virDomainOsACPITableTypeToString(type));
|
||||||
|
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||||
|
index f52b80caec..bc3f42888e 100644
|
||||||
|
--- a/src/conf/domain_conf.h
|
||||||
|
+++ b/src/conf/domain_conf.h
|
||||||
|
@@ -2463,6 +2463,8 @@ typedef enum {
|
||||||
|
VIR_ENUM_DECL(virDomainOsDefFirmwareFeature);
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
+ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW,
|
||||||
|
+ VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET,
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC,
|
||||||
|
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST
|
||||||
|
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
|
||||||
|
index d433e95d8b..99bcc90d4f 100644
|
||||||
|
--- a/src/conf/schemas/domaincommon.rng
|
||||||
|
+++ b/src/conf/schemas/domaincommon.rng
|
||||||
|
@@ -7188,7 +7188,11 @@
|
||||||
|
<zeroOrMore>
|
||||||
|
<element name="table">
|
||||||
|
<attribute name="type">
|
||||||
|
- <value>slic</value>
|
||||||
|
+ <choice>
|
||||||
|
+ <value>raw</value>
|
||||||
|
+ <value>rawset</value>
|
||||||
|
+ <value>slic</value>
|
||||||
|
+ </choice>
|
||||||
|
</attribute>
|
||||||
|
<ref name="absFilePath"/>
|
||||||
|
</element>
|
||||||
|
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
|
||||||
|
index efd01840de..e564d9e5fe 100644
|
||||||
|
--- a/src/libxl/libxl_domain.c
|
||||||
|
+++ b/src/libxl/libxl_domain.c
|
||||||
|
@@ -336,6 +336,13 @@ libxlDomainDefValidate(const virDomainDef *def,
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC:
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW:
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET:
|
||||||
|
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
+ _("ACPI table type '%1$s' is not supported"),
|
||||||
|
+ virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
default:
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST:
|
||||||
|
virReportEnumRangeError(virDomainOsACPITable,
|
||||||
|
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||||
|
index 756dd2168b..94fb7fc4c2 100644
|
||||||
|
--- a/src/qemu/qemu_command.c
|
||||||
|
+++ b/src/qemu/qemu_command.c
|
||||||
|
@@ -130,6 +130,8 @@ VIR_ENUM_IMPL(qemuNumaPolicy,
|
||||||
|
VIR_ENUM_DECL(qemuACPITableSIG);
|
||||||
|
VIR_ENUM_IMPL(qemuACPITableSIG,
|
||||||
|
VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST,
|
||||||
|
+ "", /* raw */
|
||||||
|
+ "", /* rawset */
|
||||||
|
"SLIC");
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||||
|
index e500a5d314..8ef0257d73 100644
|
||||||
|
--- a/src/qemu/qemu_validate.c
|
||||||
|
+++ b/src/qemu/qemu_validate.c
|
||||||
|
@@ -732,6 +732,13 @@ qemuValidateDomainDefBoot(const virDomainDef *def,
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC:
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAW:
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_RAWSET:
|
||||||
|
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
+ _("ACPI table type '%1$s' is not supported"),
|
||||||
|
+ virDomainOsACPITableTypeToString(def->os.acpiTables[i]->type));
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
default:
|
||||||
|
case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST:
|
||||||
|
virReportEnumRangeError(virDomainOsACPITable,
|
||||||
|
--
|
||||||
|
2.49.0
|
@ -0,0 +1,94 @@
|
|||||||
|
From 39e946bdfdd15667379debea04d91fac43bde541 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <39e946bdfdd15667379debea04d91fac43bde541.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Mon, 17 Feb 2025 16:39:29 +0000
|
||||||
|
Subject: [PATCH] src: validate permitted ACPI table types in libxl/qemu
|
||||||
|
drivers
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This forces us to update the drivers when defining new table types
|
||||||
|
to avoid incorrectly accepting them by default.
|
||||||
|
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit 3d94587655696509f34492f75c2a31a7a93eb2f9)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-81041
|
||||||
|
---
|
||||||
|
src/libxl/libxl_domain.c | 19 +++++++++++++++++++
|
||||||
|
src/qemu/qemu_validate.c | 15 +++++++++++++++
|
||||||
|
2 files changed, 34 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
|
||||||
|
index 6805160923..efd01840de 100644
|
||||||
|
--- a/src/libxl/libxl_domain.c
|
||||||
|
+++ b/src/libxl/libxl_domain.c
|
||||||
|
@@ -306,6 +306,7 @@ libxlDomainDefValidate(const virDomainDef *def,
|
||||||
|
libxlDriverPrivate *driver = opaque;
|
||||||
|
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
|
||||||
|
bool reqSecureBoot = false;
|
||||||
|
+ size_t i;
|
||||||
|
|
||||||
|
if (!virCapabilitiesDomainSupported(cfg->caps, def->os.type,
|
||||||
|
def->os.arch,
|
||||||
|
@@ -330,6 +331,24 @@ libxlDomainDefValidate(const virDomainDef *def,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
+ switch (def->os.acpiTables[i]->type) {
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC:
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ default:
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST:
|
||||||
|
+ virReportEnumRangeError(virDomainOsACPITable,
|
||||||
|
+ def->os.acpiTables[i]->type);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (def->os.nacpiTables > 1) {
|
||||||
|
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
+ _("Only a single ACPI table is supported"));
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (def->nsounds > 0) {
|
||||||
|
virDomainSoundDef *snd = def->sounds[0];
|
||||||
|
|
||||||
|
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||||
|
index 289a3f94cc..e500a5d314 100644
|
||||||
|
--- a/src/qemu/qemu_validate.c
|
||||||
|
+++ b/src/qemu/qemu_validate.c
|
||||||
|
@@ -686,6 +686,8 @@ static int
|
||||||
|
qemuValidateDomainDefBoot(const virDomainDef *def,
|
||||||
|
virQEMUCaps *qemuCaps)
|
||||||
|
{
|
||||||
|
+ size_t i;
|
||||||
|
+
|
||||||
|
if (def->os.bootloader || def->os.bootloaderArgs) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("bootloader is not supported by QEMU"));
|
||||||
|
@@ -725,6 +727,19 @@ qemuValidateDomainDefBoot(const virDomainDef *def,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ for (i = 0; i < def->os.nacpiTables; i++) {
|
||||||
|
+ switch (def->os.acpiTables[i]->type) {
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_SLIC:
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ default:
|
||||||
|
+ case VIR_DOMAIN_OS_ACPI_TABLE_TYPE_LAST:
|
||||||
|
+ virReportEnumRangeError(virDomainOsACPITable,
|
||||||
|
+ def->os.acpiTables[i]->type);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.49.0
|
@ -0,0 +1,52 @@
|
|||||||
|
From ceeaa000473ddb72db453f7e38943b961ca16c22 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <ceeaa000473ddb72db453f7e38943b961ca16c22.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Wed, 8 Jan 2025 17:37:03 +0000
|
||||||
|
Subject: [PATCH] util: don't attempt to acquire logind inhibitor if not
|
||||||
|
requested
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
When VIR_INHIBITOR_WHAT_NONE is passed to virInhibitorNew, it is
|
||||||
|
an indication that daemon shutdown should be inhibited, but no
|
||||||
|
OS level inhibitors acquired. This is done by the virtnetworkd
|
||||||
|
daemon, for example, to prevent shutdown while running virtual
|
||||||
|
machines are present, without blocking / delaying OS shutdown.
|
||||||
|
|
||||||
|
Unfortunately the code forgot to skip the DBus call in this case,
|
||||||
|
resulting in errors being logged.
|
||||||
|
|
||||||
|
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit caa10431cdd1aa476637ff721f1947c4e0b53da1)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-83064
|
||||||
|
---
|
||||||
|
src/util/virinhibitor.c | 5 +++--
|
||||||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/util/virinhibitor.c b/src/util/virinhibitor.c
|
||||||
|
index 647bdc9fbb..a95021de5a 100644
|
||||||
|
--- a/src/util/virinhibitor.c
|
||||||
|
+++ b/src/util/virinhibitor.c
|
||||||
|
@@ -152,7 +152,7 @@ virInhibitor *virInhibitorNew(virInhibitorWhat what,
|
||||||
|
virInhibitor *inhibitor = g_new0(virInhibitor, 1);
|
||||||
|
|
||||||
|
inhibitor->fd = -1;
|
||||||
|
- inhibitor->what = virInhibitorWhatFormat(what);
|
||||||
|
+ inhibitor->what = what ? virInhibitorWhatFormat(what) : NULL;
|
||||||
|
inhibitor->who = g_strdup(who);
|
||||||
|
inhibitor->why = g_strdup(why);
|
||||||
|
inhibitor->mode = virInhibitorModeTypeToString(mode);
|
||||||
|
@@ -171,7 +171,8 @@ void virInhibitorHold(virInhibitor *inhibitor)
|
||||||
|
inhibitor->action(true, inhibitor->actionData);
|
||||||
|
}
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
- if (virInhibitorAcquire(
|
||||||
|
+ if (inhibitor->what &&
|
||||||
|
+ virInhibitorAcquire(
|
||||||
|
inhibitor->what, inhibitor->who, inhibitor->why,
|
||||||
|
inhibitor->mode, &inhibitor->fd) < 0) {
|
||||||
|
VIR_ERROR(_("Failed to acquire inhibitor: %1$s"),
|
||||||
|
--
|
||||||
|
2.49.0
|
46
libvirt-util-fix-off-by-1-in-inhibitor-constants.patch
Normal file
46
libvirt-util-fix-off-by-1-in-inhibitor-constants.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
From 593bba2d87b7e2bcfedd544d7d48eba936b7a212 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <593bba2d87b7e2bcfedd544d7d48eba936b7a212.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Tue, 7 Jan 2025 15:21:18 +0000
|
||||||
|
Subject: [PATCH] util: fix off-by-1 in inhibitor constants
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The inhibitor constant values were off-by-1, so when converted into
|
||||||
|
string format, we picked the wrong names
|
||||||
|
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit fc3a60d9d7b29283a0b2d57bb06d15fb597a5003)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-83064
|
||||||
|
---
|
||||||
|
src/util/virinhibitor.h | 14 +++++++-------
|
||||||
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/util/virinhibitor.h b/src/util/virinhibitor.h
|
||||||
|
index 0a1c445d41..49cf32fbeb 100644
|
||||||
|
--- a/src/util/virinhibitor.h
|
||||||
|
+++ b/src/util/virinhibitor.h
|
||||||
|
@@ -26,13 +26,13 @@ typedef struct _virInhibitor virInhibitor;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
VIR_INHIBITOR_WHAT_NONE = 0,
|
||||||
|
- VIR_INHIBITOR_WHAT_SLEEP = (1 << 1),
|
||||||
|
- VIR_INHIBITOR_WHAT_SHUTDOWN = (1 << 2),
|
||||||
|
- VIR_INHIBITOR_WHAT_IDLE = (1 << 3),
|
||||||
|
- VIR_INHIBITOR_WHAT_POWER_KEY = (1 << 4),
|
||||||
|
- VIR_INHIBITOR_WHAT_SUSPEND_KEY = (1 << 5),
|
||||||
|
- VIR_INHIBITOR_WHAT_HIBERNATE_KEY = (1 << 6),
|
||||||
|
- VIR_INHIBITOR_WHAT_LID_SWITCH = (1 << 7),
|
||||||
|
+ VIR_INHIBITOR_WHAT_SLEEP = (1 << 0),
|
||||||
|
+ VIR_INHIBITOR_WHAT_SHUTDOWN = (1 << 1),
|
||||||
|
+ VIR_INHIBITOR_WHAT_IDLE = (1 << 2),
|
||||||
|
+ VIR_INHIBITOR_WHAT_POWER_KEY = (1 << 3),
|
||||||
|
+ VIR_INHIBITOR_WHAT_SUSPEND_KEY = (1 << 4),
|
||||||
|
+ VIR_INHIBITOR_WHAT_HIBERNATE_KEY = (1 << 5),
|
||||||
|
+ VIR_INHIBITOR_WHAT_LID_SWITCH = (1 << 6),
|
||||||
|
} virInhibitorWhat;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
--
|
||||||
|
2.49.0
|
@ -0,0 +1,375 @@
|
|||||||
|
From 4c1429d270836f0e6ab04b052f1184d72d21193c Mon Sep 17 00:00:00 2001
|
||||||
|
Message-ID: <4c1429d270836f0e6ab04b052f1184d72d21193c.1742990721.git.jdenemar@redhat.com>
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Mon, 16 Dec 2024 15:19:34 +0000
|
||||||
|
Subject: [PATCH] util: introduce object for holding a system inhibitor lock
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The system inhibitor locks are currently handled by code in the
|
||||||
|
virNetDaemon class. The driver code invokes a callback provided
|
||||||
|
by the daemon when it wants to start or end inhibition.
|
||||||
|
|
||||||
|
When the first inhibition is started, the daemon will call out
|
||||||
|
to logind to apply it system wide.
|
||||||
|
|
||||||
|
This has many flaws
|
||||||
|
|
||||||
|
* A single message is registered with logind regardless of
|
||||||
|
what driver holds the inhibition
|
||||||
|
* An inhibition of daemon shutdown can't be acquired
|
||||||
|
without also inhibiting system shutdown
|
||||||
|
* Config of the inhibitions cannot be tailored by the
|
||||||
|
driver
|
||||||
|
|
||||||
|
The new virInhibitor object addresses these:
|
||||||
|
|
||||||
|
* The object directly manages an inhibition with logind
|
||||||
|
privately to the driver, enabling custom messages to
|
||||||
|
be set.
|
||||||
|
* It is possible to acquire an inhibition locally to the
|
||||||
|
daemon without forwarding it to logind.
|
||||||
|
|
||||||
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
(cherry picked from commit d2e5aa4f4e1501149c9e3095d38ebc04c9a4ba31)
|
||||||
|
Resolves: https://issues.redhat.com/browse/RHEL-83064
|
||||||
|
---
|
||||||
|
po/POTFILES | 1 +
|
||||||
|
src/libvirt_private.syms | 7 ++
|
||||||
|
src/util/meson.build | 1 +
|
||||||
|
src/util/virinhibitor.c | 214 +++++++++++++++++++++++++++++++++++++++
|
||||||
|
src/util/virinhibitor.h | 58 +++++++++++
|
||||||
|
5 files changed, 281 insertions(+)
|
||||||
|
create mode 100644 src/util/virinhibitor.c
|
||||||
|
create mode 100644 src/util/virinhibitor.h
|
||||||
|
|
||||||
|
diff --git a/po/POTFILES b/po/POTFILES
|
||||||
|
index 3514aa3dca..c71e439fe3 100644
|
||||||
|
--- a/po/POTFILES
|
||||||
|
+++ b/po/POTFILES
|
||||||
|
@@ -293,6 +293,7 @@ src/util/virhostcpu.c
|
||||||
|
src/util/virhostmem.c
|
||||||
|
src/util/virhostuptime.c
|
||||||
|
src/util/viridentity.c
|
||||||
|
+src/util/virinhibitor.c
|
||||||
|
src/util/virinitctl.c
|
||||||
|
src/util/viriscsi.c
|
||||||
|
src/util/virjson.c
|
||||||
|
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||||
|
index 7d404fdbf5..727ab52cfe 100644
|
||||||
|
--- a/src/libvirt_private.syms
|
||||||
|
+++ b/src/libvirt_private.syms
|
||||||
|
@@ -2605,6 +2605,13 @@ virIdentitySetUserName;
|
||||||
|
virIdentitySetX509DName;
|
||||||
|
|
||||||
|
|
||||||
|
+# util/virinhibitor.h
|
||||||
|
+virInhibitorFree;
|
||||||
|
+virInhibitorHold;
|
||||||
|
+virInhibitorNew;
|
||||||
|
+virInhibitorRelease;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
# util/virinitctl.h
|
||||||
|
virInitctlFifos;
|
||||||
|
virInitctlSetRunLevel;
|
||||||
|
diff --git a/src/util/meson.build b/src/util/meson.build
|
||||||
|
index 30f71b0227..69ef49139a 100644
|
||||||
|
--- a/src/util/meson.build
|
||||||
|
+++ b/src/util/meson.build
|
||||||
|
@@ -45,6 +45,7 @@ util_sources = [
|
||||||
|
'virhostmem.c',
|
||||||
|
'virhostuptime.c',
|
||||||
|
'viridentity.c',
|
||||||
|
+ 'virinhibitor.c',
|
||||||
|
'virinitctl.c',
|
||||||
|
'viriscsi.c',
|
||||||
|
'virjson.c',
|
||||||
|
diff --git a/src/util/virinhibitor.c b/src/util/virinhibitor.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..647bdc9fbb
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/util/virinhibitor.c
|
||||||
|
@@ -0,0 +1,214 @@
|
||||||
|
+/*
|
||||||
|
+ * virinhibitor.c: helper APIs for inhibiting host actions
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2024 Red Hat, Inc.
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with this library. If not, see
|
||||||
|
+ * <http://www.gnu.org/licenses/>.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <config.h>
|
||||||
|
+
|
||||||
|
+#include "virinhibitor.h"
|
||||||
|
+#include "virgdbus.h"
|
||||||
|
+#include "virsystemd.h"
|
||||||
|
+#include "virfile.h"
|
||||||
|
+#include "virlog.h"
|
||||||
|
+#include "virenum.h"
|
||||||
|
+
|
||||||
|
+#define VIR_FROM_THIS VIR_FROM_NONE
|
||||||
|
+
|
||||||
|
+VIR_LOG_INIT("util.inhibitor");
|
||||||
|
+
|
||||||
|
+struct _virInhibitor {
|
||||||
|
+ GMutex lock;
|
||||||
|
+ size_t count;
|
||||||
|
+ int fd;
|
||||||
|
+
|
||||||
|
+ char *what;
|
||||||
|
+ char *who;
|
||||||
|
+ char *why;
|
||||||
|
+ const char *mode;
|
||||||
|
+
|
||||||
|
+ virInhibitorAction action;
|
||||||
|
+ void *actionData;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+VIR_ENUM_DECL(virInhibitorMode);
|
||||||
|
+
|
||||||
|
+VIR_ENUM_IMPL(virInhibitorMode,
|
||||||
|
+ VIR_INHIBITOR_MODE_LAST,
|
||||||
|
+ "block", "delay");
|
||||||
|
+
|
||||||
|
+#ifdef G_OS_UNIX
|
||||||
|
+/* As per: https://www.freedesktop.org/wiki/Software/systemd/inhibit */
|
||||||
|
+static int
|
||||||
|
+virInhibitorAcquire(const char *what,
|
||||||
|
+ const char *who,
|
||||||
|
+ const char *why,
|
||||||
|
+ const char *mode,
|
||||||
|
+ int *inhibitorFD)
|
||||||
|
+{
|
||||||
|
+ g_autoptr(GVariant) reply = NULL;
|
||||||
|
+ g_autoptr(GUnixFDList) replyFD = NULL;
|
||||||
|
+ g_autoptr(GVariant) message = NULL;
|
||||||
|
+ GDBusConnection *systemBus;
|
||||||
|
+ int fd;
|
||||||
|
+ int rc;
|
||||||
|
+
|
||||||
|
+ VIR_DEBUG("what=%s who=%s why=%s mode=%s",
|
||||||
|
+ NULLSTR(what), NULLSTR(who), NULLSTR(why), NULLSTR(mode));
|
||||||
|
+
|
||||||
|
+ if (!(systemBus = virGDBusGetSystemBus())) {
|
||||||
|
+ VIR_DEBUG("system dbus not available, skipping system inhibitor");
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (virSystemdHasLogind() < 0) {
|
||||||
|
+ VIR_DEBUG("logind not available, skipping system inhibitor");
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ message = g_variant_new("(ssss)", what, who, why, mode);
|
||||||
|
+
|
||||||
|
+ rc = virGDBusCallMethodWithFD(systemBus,
|
||||||
|
+ &reply,
|
||||||
|
+ G_VARIANT_TYPE("(h)"),
|
||||||
|
+ &replyFD,
|
||||||
|
+ NULL,
|
||||||
|
+ "org.freedesktop.login1",
|
||||||
|
+ "/org/freedesktop/login1",
|
||||||
|
+ "org.freedesktop.login1.Manager",
|
||||||
|
+ "Inhibit",
|
||||||
|
+ message,
|
||||||
|
+ NULL);
|
||||||
|
+
|
||||||
|
+ if (rc < 0)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ if (g_unix_fd_list_get_length(replyFD) <= 0) {
|
||||||
|
+ VIR_DEBUG("Missing inhibitor FD in logind reply");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fd = g_unix_fd_list_get(replyFD, 0, NULL);
|
||||||
|
+ if (fd < 0) {
|
||||||
|
+ VIR_DEBUG("Unable to get inhibitor FD from logind reply");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ *inhibitorFD = fd;
|
||||||
|
+ VIR_DEBUG("Got inhibitor FD %d", fd);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static char *
|
||||||
|
+virInhibitorWhatFormat(virInhibitorWhat what)
|
||||||
|
+{
|
||||||
|
+ const char *whatstr[] = {
|
||||||
|
+ "sleep",
|
||||||
|
+ "shutdown",
|
||||||
|
+ "idle",
|
||||||
|
+ "handle-power-key",
|
||||||
|
+ "handle-suspend-key",
|
||||||
|
+ "handle-hibernate-key",
|
||||||
|
+ "handle-lid-switch",
|
||||||
|
+ };
|
||||||
|
+ GString *str = g_string_new("");
|
||||||
|
+ size_t i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < G_N_ELEMENTS(whatstr); i++) {
|
||||||
|
+ if (what & (1 << i)) {
|
||||||
|
+ if (str->len)
|
||||||
|
+ g_string_append(str, ":");
|
||||||
|
+ g_string_append(str, whatstr[i]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return g_string_free(str, FALSE);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+virInhibitor *virInhibitorNew(virInhibitorWhat what,
|
||||||
|
+ const char *who,
|
||||||
|
+ const char *why,
|
||||||
|
+ virInhibitorMode mode,
|
||||||
|
+ virInhibitorAction action,
|
||||||
|
+ void *actionData)
|
||||||
|
+{
|
||||||
|
+ virInhibitor *inhibitor = g_new0(virInhibitor, 1);
|
||||||
|
+
|
||||||
|
+ inhibitor->fd = -1;
|
||||||
|
+ inhibitor->what = virInhibitorWhatFormat(what);
|
||||||
|
+ inhibitor->who = g_strdup(who);
|
||||||
|
+ inhibitor->why = g_strdup(why);
|
||||||
|
+ inhibitor->mode = virInhibitorModeTypeToString(mode);
|
||||||
|
+ inhibitor->action = action;
|
||||||
|
+ inhibitor->actionData = actionData;
|
||||||
|
+
|
||||||
|
+ return inhibitor;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void virInhibitorHold(virInhibitor *inhibitor)
|
||||||
|
+{
|
||||||
|
+ g_mutex_lock(&inhibitor->lock);
|
||||||
|
+
|
||||||
|
+ if (inhibitor->count == 0) {
|
||||||
|
+ if (inhibitor->action) {
|
||||||
|
+ inhibitor->action(true, inhibitor->actionData);
|
||||||
|
+ }
|
||||||
|
+#ifdef G_OS_UNIX
|
||||||
|
+ if (virInhibitorAcquire(
|
||||||
|
+ inhibitor->what, inhibitor->who, inhibitor->why,
|
||||||
|
+ inhibitor->mode, &inhibitor->fd) < 0) {
|
||||||
|
+ VIR_ERROR(_("Failed to acquire inhibitor: %1$s"),
|
||||||
|
+ virGetLastErrorMessage());
|
||||||
|
+ virResetLastError();
|
||||||
|
+ }
|
||||||
|
+#else
|
||||||
|
+ VIR_DEBUG("No inhibitor implementation on non-UNIX platforms");
|
||||||
|
+#endif
|
||||||
|
+ }
|
||||||
|
+ inhibitor->count++;
|
||||||
|
+ g_mutex_unlock(&inhibitor->lock);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void virInhibitorRelease(virInhibitor *inhibitor)
|
||||||
|
+{
|
||||||
|
+ g_mutex_lock(&inhibitor->lock);
|
||||||
|
+ inhibitor->count--;
|
||||||
|
+ if (inhibitor->count == 0) {
|
||||||
|
+ VIR_FORCE_CLOSE(inhibitor->fd);
|
||||||
|
+ if (inhibitor->action) {
|
||||||
|
+ inhibitor->action(false, inhibitor->actionData);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ g_mutex_unlock(&inhibitor->lock);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void virInhibitorFree(virInhibitor *inhibitor)
|
||||||
|
+{
|
||||||
|
+ if (!inhibitor)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ g_free(inhibitor->what);
|
||||||
|
+ g_free(inhibitor->who);
|
||||||
|
+ g_free(inhibitor->why);
|
||||||
|
+ VIR_FORCE_CLOSE(inhibitor->fd);
|
||||||
|
+ g_free(inhibitor);
|
||||||
|
+}
|
||||||
|
diff --git a/src/util/virinhibitor.h b/src/util/virinhibitor.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..0a1c445d41
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/util/virinhibitor.h
|
||||||
|
@@ -0,0 +1,58 @@
|
||||||
|
+/*
|
||||||
|
+ * virinhibitor.h: helper APIs for inhibiting host actions
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2024 Red Hat, Inc.
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with this library. If not, see
|
||||||
|
+ * <http://www.gnu.org/licenses/>.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#pragma once
|
||||||
|
+
|
||||||
|
+#include "internal.h"
|
||||||
|
+
|
||||||
|
+typedef struct _virInhibitor virInhibitor;
|
||||||
|
+
|
||||||
|
+typedef enum {
|
||||||
|
+ VIR_INHIBITOR_WHAT_NONE = 0,
|
||||||
|
+ VIR_INHIBITOR_WHAT_SLEEP = (1 << 1),
|
||||||
|
+ VIR_INHIBITOR_WHAT_SHUTDOWN = (1 << 2),
|
||||||
|
+ VIR_INHIBITOR_WHAT_IDLE = (1 << 3),
|
||||||
|
+ VIR_INHIBITOR_WHAT_POWER_KEY = (1 << 4),
|
||||||
|
+ VIR_INHIBITOR_WHAT_SUSPEND_KEY = (1 << 5),
|
||||||
|
+ VIR_INHIBITOR_WHAT_HIBERNATE_KEY = (1 << 6),
|
||||||
|
+ VIR_INHIBITOR_WHAT_LID_SWITCH = (1 << 7),
|
||||||
|
+} virInhibitorWhat;
|
||||||
|
+
|
||||||
|
+typedef enum {
|
||||||
|
+ VIR_INHIBITOR_MODE_BLOCK,
|
||||||
|
+ VIR_INHIBITOR_MODE_DELAY,
|
||||||
|
+
|
||||||
|
+ VIR_INHIBITOR_MODE_LAST
|
||||||
|
+} virInhibitorMode;
|
||||||
|
+
|
||||||
|
+typedef void (*virInhibitorAction)(bool inhibited,
|
||||||
|
+ void *opaque);
|
||||||
|
+
|
||||||
|
+virInhibitor *virInhibitorNew(virInhibitorWhat what,
|
||||||
|
+ const char *who,
|
||||||
|
+ const char *why,
|
||||||
|
+ virInhibitorMode mode,
|
||||||
|
+ virInhibitorAction action,
|
||||||
|
+ void *actionData);
|
||||||
|
+
|
||||||
|
+void virInhibitorHold(virInhibitor *inhibitor);
|
||||||
|
+void virInhibitorRelease(virInhibitor *inhibitor);
|
||||||
|
+
|
||||||
|
+void virInhibitorFree(virInhibitor *inhibitor);
|
||||||
|
--
|
||||||
|
2.49.0
|
36
libvirt.spec
36
libvirt.spec
@ -289,7 +289,7 @@
|
|||||||
Summary: Library providing a simple virtualization API
|
Summary: Library providing a simple virtualization API
|
||||||
Name: libvirt
|
Name: libvirt
|
||||||
Version: 10.10.0
|
Version: 10.10.0
|
||||||
Release: 8%{?dist}%{?extra_release}
|
Release: 9%{?dist}%{?extra_release}
|
||||||
License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1
|
License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1
|
||||||
URL: https://libvirt.org/
|
URL: https://libvirt.org/
|
||||||
|
|
||||||
@ -384,6 +384,22 @@ Patch84: libvirt-remote-add-sysusers-file-to-create-libvirt-group.patch
|
|||||||
Patch85: libvirt-qemu-Avoid-crash-in-qemuDomainCheckCPU-with-unknown-host-CPU.patch
|
Patch85: libvirt-qemu-Avoid-crash-in-qemuDomainCheckCPU-with-unknown-host-CPU.patch
|
||||||
Patch86: libvirt-qemu_snapshot-allow-reverting-to-external-disk-only-snapshot.patch
|
Patch86: libvirt-qemu_snapshot-allow-reverting-to-external-disk-only-snapshot.patch
|
||||||
Patch87: libvirt-qemu-snapshot-error-out-early-when-reverting-snapshot-for-VM-with-non-file-disk.patch
|
Patch87: libvirt-qemu-snapshot-error-out-early-when-reverting-snapshot-for-VM-with-non-file-disk.patch
|
||||||
|
Patch88: libvirt-util-introduce-object-for-holding-a-system-inhibitor-lock.patch
|
||||||
|
Patch89: libvirt-src-convert-drivers-over-to-new-virInhibitor-APIs.patch
|
||||||
|
Patch90: libvirt-rpc-remove-logind-support-for-virNetDaemon.patch
|
||||||
|
Patch91: libvirt-util-fix-off-by-1-in-inhibitor-constants.patch
|
||||||
|
Patch92: libvirt-util-don-t-attempt-to-acquire-logind-inhibitor-if-not-requested.patch
|
||||||
|
Patch93: libvirt-network-Free-inhibitor-in-networkStateCleanup.patch
|
||||||
|
Patch94: libvirt-conf-introduce-support-for-multiple-ACPI-tables.patch
|
||||||
|
Patch95: libvirt-src-validate-permitted-ACPI-table-types-in-libxl-qemu-drivers.patch
|
||||||
|
Patch96: libvirt-src-introduce-raw-and-rawset-ACPI-table-types.patch
|
||||||
|
Patch97: libvirt-qemu-support-raw-ACPI-table-type.patch
|
||||||
|
Patch98: libvirt-libxl-support-rawset-ACPI-table-type.patch
|
||||||
|
Patch99: libvirt-conf-support-MSDM-ACPI-table-type.patch
|
||||||
|
Patch100: libvirt-qemu-support-MSDM-ACPI-table-type.patch
|
||||||
|
Patch101: libvirt-qemuxmlconftest-Include-shared-memory-net-vhostuser-test-cases.patch
|
||||||
|
Patch102: libvirt-qemuValidateDomainDeviceDefNetwork-Require-shared-memory-for-all-vhost-user-interfaces.patch
|
||||||
|
Patch103: libvirt-qemu-process-Remove-un-updated-qemuProcessStartWarnShmem.patch
|
||||||
|
|
||||||
|
|
||||||
Requires: libvirt-daemon = %{version}-%{release}
|
Requires: libvirt-daemon = %{version}-%{release}
|
||||||
@ -2709,6 +2725,24 @@ exit 0
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Mar 26 2025 Jiri Denemark <jdenemar@redhat.com> - 10.10.0-9
|
||||||
|
- util: introduce object for holding a system inhibitor lock (RHEL-83064)
|
||||||
|
- src: convert drivers over to new virInhibitor APIs (RHEL-83064)
|
||||||
|
- rpc: remove logind support for virNetDaemon (RHEL-83064)
|
||||||
|
- util: fix off-by-1 in inhibitor constants (RHEL-83064)
|
||||||
|
- util: don't attempt to acquire logind inhibitor if not requested (RHEL-83064)
|
||||||
|
- network: Free inhibitor in networkStateCleanup() (RHEL-83064)
|
||||||
|
- conf: introduce support for multiple ACPI tables (RHEL-81041)
|
||||||
|
- src: validate permitted ACPI table types in libxl/qemu drivers (RHEL-81041)
|
||||||
|
- src: introduce 'raw' and 'rawset' ACPI table types (RHEL-81041)
|
||||||
|
- qemu: support 'raw' ACPI table type (RHEL-81041)
|
||||||
|
- libxl: support 'rawset' ACPI table type (RHEL-81041)
|
||||||
|
- conf: support MSDM ACPI table type (RHEL-81041)
|
||||||
|
- qemu: support MSDM ACPI table type (RHEL-81041)
|
||||||
|
- qemuxmlconftest: Include shared memory 'net-vhostuser' test cases (RHEL-84133)
|
||||||
|
- qemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces (RHEL-84133)
|
||||||
|
- qemu: process: Remove un-updated 'qemuProcessStartWarnShmem' (RHEL-84133)
|
||||||
|
|
||||||
* Thu Mar 13 2025 Jiri Denemark <jdenemar@redhat.com> - 10.10.0-8
|
* Thu Mar 13 2025 Jiri Denemark <jdenemar@redhat.com> - 10.10.0-8
|
||||||
- remote: add sysusers file to create 'libvirt' group (RHEL-81749)
|
- remote: add sysusers file to create 'libvirt' group (RHEL-81749)
|
||||||
- qemu: Avoid crash in qemuDomainCheckCPU with unknown host CPU (RHEL-81747)
|
- qemu: Avoid crash in qemuDomainCheckCPU with unknown host CPU (RHEL-81747)
|
||||||
|
Loading…
Reference in New Issue
Block a user