[PATCH v2 0/4] fix AppArmor policy restore for runtime rules
by Georgia Garcia
Some rules are generated dynamically during boot and added to the
AppArmor policy. An example of that is macvtap devices that call the
AppArmorSetFDLabel hook to add a rule for the tap device path.
Since this information is dynamic, it is not available in the xml
config, therefore whenever a "Restore" hook is called, the entire
profile is regenerated by virt-aa-helper based only the information
from the VM definition, so the dynamic/runtime information is lost.
This patchset fixes that by storing these rules in a different file
called libvirt-uuid.runtime_files, which is included by
libvirt-uuid.files that already exists. It also includes other fixes
like memory leaks, adoption of the GLib API in the apparmor files and
a fix on the AppArmor policy that incorrectly applies apparmor policy
syntax.
Georgia Garcia (4):
security_apparmor: fix memleaks in AppArmorSetFDLabel
security: replace uses of label and VIR_FREE by g_autofree
apparmor: fix UUID specification
virt-aa-helper: store dynamically generated rules
.../usr.lib.libvirt.virt-aa-helper.in | 5 +-
src/security/apparmor/usr.sbin.libvirtd.in | 7 +-
src/security/security_apparmor.c | 83 +++++-----
src/security/virt-aa-helper.c | 145 +++++++++---------
4 files changed, 120 insertions(+), 120 deletions(-)
--
2.34.1
1 week, 3 days
[PATCH] util: Change return type of functions that never fail to void
by Alexander Kuznetsov
These functions return value is invariant since 18f3771, so change
its type and remove all dependent checks.
Found by Linux Verification Center (linuxtesting.org) with Svace.
Reported-by: Pavel Nekrasov <p.nekrasov(a)fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam(a)altlinux.org>
---
src/hypervisor/virhostdev.c | 21 +++++++--------------
src/logging/log_daemon.c | 8 ++------
src/logging/log_daemon_config.c | 4 +---
src/logging/log_daemon_config.h | 2 +-
src/util/virpci.c | 4 +---
src/util/virpci.h | 2 +-
src/util/virscsi.c | 4 +---
src/util/virscsi.h | 2 +-
src/util/virscsivhost.c | 6 ++----
src/util/virscsivhost.h | 2 +-
tests/virscsitest.c | 6 ++----
11 files changed, 20 insertions(+), 41 deletions(-)
diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index db94a2e056..037842c8a1 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -1131,8 +1131,7 @@ virHostdevUpdateActivePCIDevices(virHostdevManager *mgr,
if (!actual)
continue;
- if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0)
- goto cleanup;
+ virPCIDeviceSetUsedBy(actual, drv_name, dom_name);
/* Setup the original states for the PCI device */
virPCIDeviceSetUnbindFromStub(actual, virBitmapIsBitSet(orig, VIR_DOMAIN_HOSTDEV_PCI_ORIGSTATE_UNBIND));
@@ -1213,11 +1212,9 @@ virHostdevUpdateActiveSCSIHostDevices(virHostdevManager *mgr,
return -1;
if ((tmp = virSCSIDeviceListFind(mgr->activeSCSIHostdevs, scsi))) {
- if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0)
- return -1;
+ virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name);
} else {
- if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0 ||
- virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0)
+ if (virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0)
return -1;
scsi = NULL;
}
@@ -1598,11 +1595,9 @@ virHostdevPrepareSCSIDevices(virHostdevManager *mgr,
goto error;
}
- if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0)
- goto error;
+ virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name);
} else {
- if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0)
- goto error;
+ virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name);
VIR_DEBUG("Adding %s to activeSCSIHostdevs", virSCSIDeviceGetName(scsi));
@@ -1671,8 +1666,7 @@ virHostdevPrepareSCSIVHostDevices(virHostdevManager *mgr,
if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn)))
return -1;
- if (virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name) < 0)
- return -1;
+ virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name);
if (virSCSIVHostDeviceListAdd(list, host) < 0)
return -1;
@@ -2480,8 +2474,7 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *hostdev_mgr,
/* We must restore some attributes that were lost on daemon restart. */
virPCIDeviceSetUnbindFromStub(actual, true);
- if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0)
- goto rollback;
+ virPCIDeviceSetUsedBy(actual, drv_name, dom_name);
if (virPCIDeviceListAddCopy(hostdev_mgr->activePCIHostdevs, actual) < 0)
goto rollback;
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index daf7ef4b2f..5a9be4a44e 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -692,14 +692,10 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
- /* No explicit config, so try and find a default one */
+ /* No explicit config, so find a default one */
if (remote_config_file == NULL) {
implicit_conf = true;
- if (virLogDaemonConfigFilePath(privileged,
- &remote_config_file) < 0) {
- VIR_ERROR(_("Can't determine config path"));
- exit(EXIT_FAILURE);
- }
+ virLogDaemonConfigFilePath(privileged, &remote_config_file);
}
/* Read the config file if it exists */
diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_config.c
index 248bd927d3..60c424ad84 100644
--- a/src/logging/log_daemon_config.c
+++ b/src/logging/log_daemon_config.c
@@ -33,7 +33,7 @@
VIR_LOG_INIT("logging.log_daemon_config");
-int
+void
virLogDaemonConfigFilePath(bool privileged, char **configfile)
{
if (privileged) {
@@ -45,8 +45,6 @@ virLogDaemonConfigFilePath(bool privileged, char **configfile)
*configfile = g_strdup_printf("%s/virtlogd.conf", configdir);
}
-
- return 0;
}
diff --git a/src/logging/log_daemon_config.h b/src/logging/log_daemon_config.h
index 43922feedf..5c10cc50d7 100644
--- a/src/logging/log_daemon_config.h
+++ b/src/logging/log_daemon_config.h
@@ -39,7 +39,7 @@ struct _virLogDaemonConfig {
};
-int virLogDaemonConfigFilePath(bool privileged, char **configfile);
+void virLogDaemonConfigFilePath(bool privileged, char **configfile);
virLogDaemonConfig *virLogDaemonConfigNew(bool privileged);
void virLogDaemonConfigFree(virLogDaemonConfig *data);
int virLogDaemonConfigLoadFile(virLogDaemonConfig *data,
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 289c0b330b..90617e69c6 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -2049,7 +2049,7 @@ virPCIDeviceSetReprobe(virPCIDevice *dev, bool reprobe)
dev->reprobe = reprobe;
}
-int
+void
virPCIDeviceSetUsedBy(virPCIDevice *dev,
const char *drv_name,
const char *dom_name)
@@ -2058,8 +2058,6 @@ virPCIDeviceSetUsedBy(virPCIDevice *dev,
VIR_FREE(dev->used_by_domname);
dev->used_by_drvname = g_strdup(drv_name);
dev->used_by_domname = g_strdup(dom_name);
-
- return 0;
}
void
diff --git a/src/util/virpci.h b/src/util/virpci.h
index ba5e0ae6f1..c5dcf9d37f 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -136,7 +136,7 @@ void virPCIDeviceSetStubDriverName(virPCIDevice *dev,
const char *driverName);
const char *virPCIDeviceGetStubDriverName(virPCIDevice *dev);
virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev);
-int virPCIDeviceSetUsedBy(virPCIDevice *dev,
+void virPCIDeviceSetUsedBy(virPCIDevice *dev,
const char *drv_name,
const char *dom_name);
void virPCIDeviceGetUsedBy(virPCIDevice *dev,
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 3d2c77e3b8..6899958e21 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -243,7 +243,7 @@ virSCSIDeviceFree(virSCSIDevice *dev)
g_free(dev);
}
-int
+void
virSCSIDeviceSetUsedBy(virSCSIDevice *dev,
const char *drvname,
const char *domname)
@@ -255,8 +255,6 @@ virSCSIDeviceSetUsedBy(virSCSIDevice *dev,
copy->domname = g_strdup(domname);
VIR_APPEND_ELEMENT(dev->used_by, dev->n_used_by, copy);
-
- return 0;
}
bool
diff --git a/src/util/virscsi.h b/src/util/virscsi.h
index ec34303bdc..d76ee13bcc 100644
--- a/src/util/virscsi.h
+++ b/src/util/virscsi.h
@@ -50,7 +50,7 @@ virSCSIDevice *virSCSIDeviceNew(const char *sysfs_prefix,
bool shareable);
void virSCSIDeviceFree(virSCSIDevice *dev);
-int virSCSIDeviceSetUsedBy(virSCSIDevice *dev,
+void virSCSIDeviceSetUsedBy(virSCSIDevice *dev,
const char *drvname,
const char *domname);
bool virSCSIDeviceIsAvailable(virSCSIDevice *dev);
diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c
index 15024d7106..05b89e58d6 100644
--- a/src/util/virscsivhost.c
+++ b/src/util/virscsivhost.c
@@ -193,7 +193,7 @@ virSCSIVHostDeviceListNew(void)
}
-int
+void
virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev,
const char *drvname,
const char *domname)
@@ -202,8 +202,6 @@ virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev,
VIR_FREE(dev->used_by_domname);
dev->used_by_drvname = g_strdup(drvname);
dev->used_by_domname = g_strdup(domname);
-
- return 0;
}
@@ -214,7 +212,7 @@ virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevice *dev,
{
*drv_name = dev->used_by_drvname;
*dom_name = dev->used_by_domname;
- }
+}
int
diff --git a/src/util/virscsivhost.h b/src/util/virscsivhost.h
index a7299382db..caaac26328 100644
--- a/src/util/virscsivhost.h
+++ b/src/util/virscsivhost.h
@@ -50,7 +50,7 @@ void virSCSIVHostDeviceListDel(virSCSIVHostDeviceList *list,
virSCSIVHostDevice *dev);
virSCSIVHostDeviceList *virSCSIVHostDeviceListNew(void);
virSCSIVHostDevice *virSCSIVHostDeviceNew(const char *name);
-int virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev,
+void virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev,
const char *drvname,
const char *domname);
void virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevice *dev,
diff --git a/tests/virscsitest.c b/tests/virscsitest.c
index c96699e157..2c3b599c7a 100644
--- a/tests/virscsitest.c
+++ b/tests/virscsitest.c
@@ -87,14 +87,12 @@ test2(const void *data G_GNUC_UNUSED)
if (!virSCSIDeviceIsAvailable(dev))
goto cleanup;
- if (virSCSIDeviceSetUsedBy(dev, "QEMU", "fc18") < 0)
- goto cleanup;
+ virSCSIDeviceSetUsedBy(dev, "QEMU", "fc18");
if (virSCSIDeviceIsAvailable(dev))
goto cleanup;
- if (virSCSIDeviceSetUsedBy(dev, "QEMU", "fc20") < 0)
- goto cleanup;
+ virSCSIDeviceSetUsedBy(dev, "QEMU", "fc20");
if (virSCSIDeviceIsAvailable(dev))
goto cleanup;
--
2.42.2
1 week, 4 days
[PATCH v4 00/11] swtpm: Add support for profiles
by Stefan Berger
Upcoming libtpms v0.10 and swtpm v0.10 will have TPM profile support that
allows to restrict a TPM's provided set of crypto algorithms and commands
and through which backwards compatibility and migration from newer versions
of libtpms to older ones (up to libtpms v0.9) is supported. For the latter
to work it is necessary that the user chooses the right ('null') profile.
This series adds support for passing a profile choice to swtpm_setup by
setting it in the domain XML using the <profile/> XML node. An optional
attribute 'remove_disabled' can be set in this node and accepts two values:
"check": test a few crypto algorithms (tdes, camellia, unpadded encryption,
and others) for whether they are currently disabled due to FIPS
mode on the host and remove these algorithms in the 'custom'
profile if they are disabled;
"fips-host": do not test but remove all the possibly disabled crypto
algorithms (from list above)
Also extend the documentation but point the user to swtpm and libtpms
documentation for further details.
Follow Deniel's suggestions there's now a PR for swtpm_setup to support
searching for profiles though a configurable local directory, distro
directory and if no profile could be found there (with appended
".json" suffix) it will fall back to try to use a built-in profile by
the provided name: https://github.com/stefanberger/swtpm/pull/918
Stefan
v4:
- Renamed previous 'name' attribute in profile XML node to 'source'
to indicate that the profile was created from some sort of 'source'.
The 'name' is now set from the name of the profile read from the
swtpm instance's state once it has been created.
v3:
- 2/10: Adjustments to due rebase
- Applied Marc-André's R-b tags
- 10/10: Read back profile name from swtpm and adjust it in emulator defs
Stefan Berger (11):
conf: Move TPM emulator parameters into own struct
qemu: Pass virQEMUDriverConfig rather than some of its fields
util: Add parsing support for swtpm_setup's cmdarg-profile capability
conf: Define enum virDomainTPMProfileRemoveDisabled
schema: Extend schema for TPM emulator profile node
conf: Add support for profile parameter on TPM emulator in domain XML
docs: Add documentation for the TPM backend profile node
qemu: Extend swtpm_setup command line to set a profile by its name
qemu: Move adding of keys to swtpm command line into own function
qemu: Move adding --tpmstate to swtpm command line into own function
qemu: Read back the profile name after creation of a TPM instance
docs/formatdomain.rst | 32 +++
src/conf/domain_conf.c | 47 ++++
src/conf/domain_conf.h | 38 ++--
src/conf/domain_validate.c | 7 +
src/conf/schemas/domaincommon.rng | 32 +++
src/conf/virconftypes.h | 2 +
src/qemu/qemu_extdevice.c | 5 +-
src/qemu/qemu_tpm.c | 344 ++++++++++++++++++++----------
src/qemu/qemu_tpm.h | 3 +-
src/util/virtpm.c | 2 +
src/util/virtpm.h | 2 +
tests/testutilsqemu.c | 1 +
12 files changed, 386 insertions(+), 129 deletions(-)
--
2.47.0
1 week, 4 days
[PATCH safe for 10.10.0] qemu: re-use existing ActualNetDef for more interface types during update-device
by Laine Stump
For the full history behind this patch, look at the following:
https://issues.redhat.com/browse/RHEL-7036
commit v10.7.0-101-ga37bd2a15b
commit v10.8.0-rc2-8-gbcd5ae4e73
Summary: original problem was unexpected failure of update-device when
the user hadn't changed anything other than online status of the guest
NIC (which should always be allowed).
The first commit "fixed" this by avoiding the allocation of a new
ActualNetDef (i.e. creating a new networkport) for *all* network
device updates (because that was inappropriately changing which
ethernet physdev should be used for a macvtap connection, which by
design can't be handled in an update-device).
But this commit caused a regression for update-device of bridge-based
network devices (because some the updates of certain attributes *do*
require the ActualNetDef be re-allocated), so...
The 2nd commit narrowed the list of network types that get the "don't
allocate new ActualNetDef" treatment (so that only interfaces
connected to a network that uses a pool of ethernet VFs *being used in
passthrough mode* qualify).
But then it was pointed out that this re-broke simple updates of
devices that used a direct/macvtap network in "bridge" mode (because
it's possible to list multiple physdevs to use for bridge mode, in
which case the network driver attempts to "load balance" (and so a new
allocation might have a different ethernet physdev which, again, can't
be supported in a device-update).
So this (single line of code) patch *widens* the list of network types
that don't allocate a new ActualNetDef to also include the other
direct (macvtap) modes, e.g. bridge, private, etc.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
There is a more comprehensive fix that also, e.g., makes updating the
bandwidth or vlan info of a direct interface work correctly, but that
is much more invasive (and also isn't done yet). This patch fixes the
case of updating a direct interface's online status (for example)
without breaking anything else.
src/qemu/qemu_hotplug.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 3c18af6b0c..ff8c1263c6 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3935,25 +3935,29 @@ qemuDomainChangeNet(virQEMUDriver *driver,
if (newdev->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
if (olddev->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
oldType == VIR_DOMAIN_NET_TYPE_DIRECT &&
- virDomainNetGetActualDirectMode(olddev) == VIR_NETDEV_MACVLAN_MODE_PASSTHRU &&
STREQ(olddev->data.network.name, newdev->data.network.name)) {
/* old and new are type='network', and the network name
- * hasn't changed *and* this is a network where each
- * connection is allocated exclusive use of a VF
- * device. In this case we *don't* want to get a new port
- * ("actual device") from the network because attempting
- * to allocate a new device would also allocate a
- * new/different VF, causing the update to fail. And
- * anyway we can use olddev's actualNetDef (since it
- * hasn't changed).
- *
- * So instead we just duplicate *the pointer to* the
- * actualNetDef from olddev to newdev so that comparisons
- * of actualNetDef will show no change. If the update is
- * successful, we will clear the actualNetDef pointer from
- * olddev before destroying it (or if the update fails,
- * then we need to clear the pointer from newdev before
- * destroying it)
+ * hasn't changed *and* this is a "direct" network (a pool
+ * of 1 or more host ethernet devices where each guest
+ * interface is allocated one device that it connects to
+ * via macvtap. In this case we *don't* want to get a new
+ * port ("actual device") from the network because
+ * attempting to allocate a new device would also allocate
+ * a new/different ethernet, causing the update to fail
+ * (because the physical device of a macvtap-based
+ * interface can't be changed without completely
+ * unplugging and re-plugging the guest NIC).
+
+
+ * We can work around this issue by just re-using olddev's
+ * actualNetDef (since it hasn't changed) rather than
+ * allocating a new one. We just duplicate *the pointer
+ * to* the actualNetDef from olddev to newdev so that
+ * comparisons of actualNetDef will show no change. If the
+ * update is successful, we will clear the actualNetDef
+ * pointer from olddev before destroying it (or if the
+ * update fails, then we need to clear the pointer from
+ * newdev before destroying it)
*/
newdev->data.network.actual = olddev->data.network.actual;
memcpy(newdev->data.network.portid, olddev->data.network.portid,
--
2.47.0
1 week, 6 days
[PATCH] Change return type of functions that use VIR_EXPAND_N and never fail to void
by Alexander Kuznetsov
These functions return value is invariant since VIR_EXPAND_N check
removal in 7d2fd6e, so change its type and remove all dependent checks.
Found by Linux Verification Center (linuxtesting.org) with Svace.
Reported-by: Pavel Nekrasov <p.nekrasov(a)fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam(a)altlinux.org>
---
src/access/viraccessdriverstack.c | 4 +---
src/access/viraccessdriverstack.h | 2 +-
src/access/viraccessmanager.c | 5 +----
src/admin/admin_remote.c | 3 +--
src/hyperv/hyperv_wmi.c | 13 ++++-------
src/locking/lock_daemon.c | 10 ++-------
src/locking/lock_driver_lockd.c | 3 +--
src/logging/log_daemon.c | 10 ++-------
src/logging/log_manager.c | 3 +--
src/lxc/lxc_monitor.c | 4 +---
src/remote/remote_daemon.c | 20 ++++-------------
src/remote/remote_driver.c | 17 +++++---------
src/rpc/gendispatch.pl | 5 +----
src/rpc/virnetclient.c | 6 ++---
src/rpc/virnetclient.h | 4 ++--
src/rpc/virnetserver.c | 3 +--
src/rpc/virnetserver.h | 2 +-
src/util/virsysinfo.c | 37 ++++++++++---------------------
18 files changed, 43 insertions(+), 108 deletions(-)
diff --git a/src/access/viraccessdriverstack.c b/src/access/viraccessdriverstack.c
index fb9ea71665..9d6a0d4d1b 100644
--- a/src/access/viraccessdriverstack.c
+++ b/src/access/viraccessdriverstack.c
@@ -32,7 +32,7 @@ struct _virAccessDriverStackPrivate {
};
-int virAccessDriverStackAppend(virAccessManager *manager,
+void virAccessDriverStackAppend(virAccessManager *manager,
virAccessManager *child)
{
virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
@@ -40,8 +40,6 @@ int virAccessDriverStackAppend(virAccessManager *manager,
VIR_EXPAND_N(priv->managers, priv->managersLen, 1);
priv->managers[priv->managersLen-1] = child;
-
- return 0;
}
diff --git a/src/access/viraccessdriverstack.h b/src/access/viraccessdriverstack.h
index abcfc30ec3..f878ef1989 100644
--- a/src/access/viraccessdriverstack.h
+++ b/src/access/viraccessdriverstack.h
@@ -23,7 +23,7 @@
#include "access/viraccessdriver.h"
-int virAccessDriverStackAppend(virAccessManager *manager,
+void virAccessDriverStackAppend(virAccessManager *manager,
virAccessManager *child);
extern virAccessDriver accessDriverStack;
diff --git a/src/access/viraccessmanager.c b/src/access/viraccessmanager.c
index 481528c3b9..6d9fdee5f1 100644
--- a/src/access/viraccessmanager.c
+++ b/src/access/viraccessmanager.c
@@ -164,10 +164,7 @@ virAccessManager *virAccessManagerNewStack(const char **names)
if (!child)
goto error;
- if (virAccessDriverStackAppend(manager, child) < 0) {
- virObjectUnref(child);
- goto error;
- }
+ virAccessDriverStackAppend(manager, child);
}
return manager;
diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c
index 3291a1e965..5c4913a76e 100644
--- a/src/admin/admin_remote.c
+++ b/src/admin/admin_remote.c
@@ -214,8 +214,7 @@ remoteAdminPrivNew(const char *sock_path)
NULL, 0, NULL)))
goto error;
- if (virNetClientAddProgram(priv->client, priv->program) < 0)
- goto error;
+ virNetClientAddProgram(priv->client, priv->program);
return priv;
error:
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 8bc376e22f..0b82f1f131 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -184,14 +184,12 @@ hypervFreeInvokeParams(hypervInvokeParamsList *params)
}
-static inline int
+static inline void
hypervCheckParams(hypervInvokeParamsList *params)
{
if (params->nbParams + 1 > params->nbAvailParams) {
VIR_EXPAND_N(params->params, params->nbAvailParams, 5);
}
-
- return 0;
}
@@ -212,8 +210,7 @@ hypervAddSimpleParam(hypervInvokeParamsList *params, const char *name,
{
hypervParam *p = NULL;
- if (hypervCheckParams(params) < 0)
- return -1;
+ hypervCheckParams(params);
p = ¶ms->params[params->nbParams];
p->type = HYPERV_SIMPLE_PARAM;
@@ -245,8 +242,7 @@ hypervAddEprParam(hypervInvokeParamsList *params,
{
hypervParam *p = NULL;
- if (hypervCheckParams(params) < 0)
- return -1;
+ hypervCheckParams(params);
p = ¶ms->params[params->nbParams];
p->type = HYPERV_EPR_PARAM;
@@ -333,8 +329,7 @@ hypervAddEmbeddedParam(hypervInvokeParamsList *params,
{
hypervParam *p = NULL;
- if (hypervCheckParams(params) < 0)
- return -1;
+ hypervCheckParams(params);
p = ¶ms->params[params->nbParams];
p->type = HYPERV_EMBEDDED_PARAM;
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index ba52ce7d77..0b86300b43 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -1066,10 +1066,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
- if (virNetServerAddProgram(lockSrv, lockProgram) < 0) {
- ret = VIR_DAEMON_ERR_INIT;
- goto cleanup;
- }
+ virNetServerAddProgram(lockSrv, lockProgram);
if (adminSrv != NULL) {
if (!(adminProgram = virNetServerProgramNew(ADMIN_PROGRAM,
@@ -1079,10 +1076,7 @@ int main(int argc, char **argv) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
- if (virNetServerAddProgram(adminSrv, adminProgram) < 0) {
- ret = VIR_DAEMON_ERR_INIT;
- goto cleanup;
- }
+ virNetServerAddProgram(adminSrv, adminProgram);
}
/* Disable error func, now logging is setup */
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index d75302dd0a..0b6c720477 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -213,8 +213,7 @@ static virNetClient *virLockManagerLockDaemonConnectionNew(bool privileged,
NULL)))
goto error;
- if (virNetClientAddProgram(client, *prog) < 0)
- goto error;
+ virNetClientAddProgram(client, *prog);
return client;
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 5a9be4a44e..16a5dcea9a 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -864,10 +864,7 @@ int main(int argc, char **argv) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
- if (virNetServerAddProgram(logSrv, logProgram) < 0) {
- ret = VIR_DAEMON_ERR_INIT;
- goto cleanup;
- }
+ virNetServerAddProgram(logSrv, logProgram);
if (adminSrv != NULL) {
if (!(adminProgram = virNetServerProgramNew(ADMIN_PROGRAM,
@@ -877,10 +874,7 @@ int main(int argc, char **argv) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
- if (virNetServerAddProgram(adminSrv, adminProgram) < 0) {
- ret = VIR_DAEMON_ERR_INIT;
- goto cleanup;
- }
+ virNetServerAddProgram(adminSrv, adminProgram);
}
/* Disable error func, now logging is setup */
diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c
index d8490f4e5a..19e23d65c5 100644
--- a/src/logging/log_manager.c
+++ b/src/logging/log_manager.c
@@ -88,8 +88,7 @@ virLogManagerConnect(bool privileged,
NULL)))
goto error;
- if (virNetClientAddProgram(client, *prog) < 0)
- goto error;
+ virNetClientAddProgram(client, *prog);
VIR_FREE(daemonPath);
VIR_FREE(logdpath);
diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index 811d6685e5..cf2fd1897f 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -169,9 +169,7 @@ virLXCMonitor *virLXCMonitorNew(virDomainObj *vm,
mon)))
goto error;
- if (virNetClientAddProgram(mon->client,
- mon->program) < 0)
- goto error;
+ virNetClientAddProgram(mon->client, mon->program);
mon->vm = virObjectRef(vm);
memcpy(&mon->cb, cb, sizeof(mon->cb));
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 9e82132654..1d079c7e4b 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -1063,10 +1063,7 @@ int main(int argc, char **argv) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
- if (virNetServerAddProgram(srv, remoteProgram) < 0) {
- ret = VIR_DAEMON_ERR_INIT;
- goto cleanup;
- }
+ virNetServerAddProgram(srv, remoteProgram);
if (!(lxcProgram = virNetServerProgramNew(LXC_PROGRAM,
LXC_PROTOCOL_VERSION,
@@ -1075,10 +1072,7 @@ int main(int argc, char **argv) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
- if (virNetServerAddProgram(srv, lxcProgram) < 0) {
- ret = VIR_DAEMON_ERR_INIT;
- goto cleanup;
- }
+ virNetServerAddProgram(srv, lxcProgram);
if (!(qemuProgram = virNetServerProgramNew(QEMU_PROGRAM,
QEMU_PROTOCOL_VERSION,
@@ -1087,10 +1081,7 @@ int main(int argc, char **argv) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
- if (virNetServerAddProgram(srv, qemuProgram) < 0) {
- ret = VIR_DAEMON_ERR_INIT;
- goto cleanup;
- }
+ virNetServerAddProgram(srv, qemuProgram);
if (!(srvAdm = virNetServerNew("admin", 1,
config->admin_min_workers,
@@ -1120,10 +1111,7 @@ int main(int argc, char **argv) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
- if (virNetServerAddProgram(srvAdm, adminProgram) < 0) {
- ret = VIR_DAEMON_ERR_INIT;
- goto cleanup;
- }
+ virNetServerAddProgram(srvAdm, adminProgram);
if (timeout > 0) {
if (virNetDaemonAutoShutdown(dmn, timeout) < 0)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e76d9e9ba4..307f9ca945 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1160,10 +1160,9 @@ doRemoteOpen(virConnectPtr conn,
conn)))
goto error;
- if (virNetClientAddProgram(priv->client, priv->remoteProgram) < 0 ||
- virNetClientAddProgram(priv->client, priv->lxcProgram) < 0 ||
- virNetClientAddProgram(priv->client, priv->qemuProgram) < 0)
- goto error;
+ virNetClientAddProgram(priv->client, priv->remoteProgram);
+ virNetClientAddProgram(priv->client, priv->lxcProgram);
+ virNetClientAddProgram(priv->client, priv->qemuProgram);
/* Try and authenticate with server */
VIR_DEBUG("Trying authentication");
@@ -5664,10 +5663,7 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dconn,
false)))
return -1;
- if (virNetClientAddStream(priv->client, netst) < 0) {
- virObjectUnref(netst);
- return -1;
- }
+ virNetClientAddStream(priv->client, netst);
st->driver = &remoteStreamDrv;
st->privateData = netst;
@@ -6433,10 +6429,7 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
false)))
goto cleanup;
- if (virNetClientAddStream(priv->client, netst) < 0) {
- virObjectUnref(netst);
- goto cleanup;
- }
+ virNetClientAddStream(priv->client, netst);
st->driver = &remoteStreamDrv;
st->privateData = netst;
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index c5842dc796..724a6aed6e 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -1822,10 +1822,7 @@ elsif ($mode eq "client") {
print " if (!(netst = virNetClientStreamNew(priv->remoteProgram, $call->{constname}, priv->counter, sparse)))\n";
print " goto cleanup;\n";
print "\n";
- print " if (virNetClientAddStream(priv->client, netst) < 0) {\n";
- print " virObjectUnref(netst);\n";
- print " goto cleanup;\n";
- print " }";
+ print " virNetClientAddStream(priv->client, netst);\n";
print "\n";
print " st->driver = &remoteStreamDrv;\n";
print " st->privateData = netst;\n";
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 6d424eb599..39ccbd739c 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1053,7 +1053,7 @@ bool virNetClientIsOpen(virNetClient *client)
}
-int virNetClientAddProgram(virNetClient *client,
+void virNetClientAddProgram(virNetClient *client,
virNetClientProgram *prog)
{
virObjectLock(client);
@@ -1062,11 +1062,10 @@ int virNetClientAddProgram(virNetClient *client,
client->programs[client->nprograms-1] = virObjectRef(prog);
virObjectUnlock(client);
- return 0;
}
-int virNetClientAddStream(virNetClient *client,
+void virNetClientAddStream(virNetClient *client,
virNetClientStream *st)
{
virObjectLock(client);
@@ -1075,7 +1074,6 @@ int virNetClientAddStream(virNetClient *client,
client->streams[client->nstreams-1] = virObjectRef(st);
virObjectUnlock(client);
- return 0;
}
diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h
index 1647a6cc71..29099791a0 100644
--- a/src/rpc/virnetclient.h
+++ b/src/rpc/virnetclient.h
@@ -117,10 +117,10 @@ int virNetClientDupFD(virNetClient *client, bool cloexec);
bool virNetClientHasPassFD(virNetClient *client);
-int virNetClientAddProgram(virNetClient *client,
+void virNetClientAddProgram(virNetClient *client,
virNetClientProgram *prog);
-int virNetClientAddStream(virNetClient *client,
+void virNetClientAddStream(virNetClient *client,
virNetClientStream *st);
void virNetClientRemoveStream(virNetClient *client,
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index a6c6443c55..91219c3eed 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -768,7 +768,7 @@ virNetServerAddServiceUNIX(virNetServer *srv,
}
-int
+void
virNetServerAddProgram(virNetServer *srv,
virNetServerProgram *prog)
{
@@ -776,7 +776,6 @@ virNetServerAddProgram(virNetServer *srv,
VIR_EXPAND_N(srv->programs, srv->nprograms, 1);
srv->programs[srv->nprograms-1] = virObjectRef(prog);
- return 0;
}
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 7756a1dd6c..c14d8bd10f 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -84,7 +84,7 @@ int virNetServerAddServiceUNIX(virNetServer *srv,
size_t max_queued_clients,
size_t nrequests_client_max);
-int virNetServerAddProgram(virNetServer *srv,
+void virNetServerAddProgram(virNetServer *srv,
virNetServerProgram *prog);
int virNetServerSetTLSContext(virNetServer *srv,
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index dbcbca62ed..3575669ac3 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -263,7 +263,7 @@ virSysinfoParsePPCSystem(const char *base, virSysinfoSystemDef **sysdef)
return ret;
}
-static int
+static void
virSysinfoParsePPCProcessor(const char *base, virSysinfoDef *ret)
{
const char *cur;
@@ -303,8 +303,6 @@ virSysinfoParsePPCProcessor(const char *base, virSysinfoDef *ret)
}
}
-
- return 0;
}
/* virSysinfoRead for PowerPC
@@ -325,8 +323,7 @@ virSysinfoReadPPC(void)
ret->nprocessor = 0;
ret->processor = NULL;
- if (virSysinfoParsePPCProcessor(outbuf, ret) < 0)
- return NULL;
+ virSysinfoParsePPCProcessor(outbuf, ret);
if (virSysinfoParsePPCSystem(outbuf, &ret->system) < 0)
return NULL;
@@ -383,7 +380,7 @@ virSysinfoParseARMSystem(const char *base, virSysinfoSystemDef **sysdef)
return ret;
}
-static int
+static void
virSysinfoParseARMProcessor(const char *base, virSysinfoDef *ret)
{
const char *cur;
@@ -393,7 +390,7 @@ virSysinfoParseARMProcessor(const char *base, virSysinfoDef *ret)
if (!(tmp_base = strstr(base, "model name")) &&
!(tmp_base = strstr(base, "Processor")))
- return 0;
+ return;
eol = strchr(tmp_base, '\n');
cur = strchr(tmp_base, ':') + 1;
@@ -420,7 +417,7 @@ virSysinfoParseARMProcessor(const char *base, virSysinfoDef *ret)
}
VIR_FREE(processor_type);
- return 0;
+ return;
}
/* virSysinfoRead for ARMv7
@@ -451,8 +448,7 @@ virSysinfoReadARM(void)
ret->nprocessor = 0;
ret->processor = NULL;
- if (virSysinfoParseARMProcessor(outbuf, ret) < 0)
- return NULL;
+ virSysinfoParseARMProcessor(outbuf, ret);
if (virSysinfoParseARMSystem(outbuf, &ret->system) < 0)
return NULL;
@@ -753,7 +749,7 @@ virSysinfoParseX86System(const char *base, virSysinfoSystemDef **sysdef)
return ret;
}
-static int
+static void
virSysinfoParseX86BaseBoard(const char *base,
virSysinfoBaseBoardDef **baseBoard,
size_t *nbaseBoard)
@@ -827,7 +823,6 @@ virSysinfoParseX86BaseBoard(const char *base,
*nbaseBoard = nboards;
*baseBoard = g_steal_pointer(&boards);
- return 0;
}
@@ -1006,7 +1001,7 @@ virSysinfoParseOEMStrings(const char *base,
}
-static int
+static void
virSysinfoParseX86Processor(const char *base, virSysinfoDef *ret)
{
const char *cur, *tmp_base;
@@ -1102,11 +1097,9 @@ virSysinfoParseX86Processor(const char *base, virSysinfoDef *ret)
base += strlen("Processor Information");
}
-
- return 0;
}
-static int
+static void
virSysinfoParseX86Memory(const char *base, virSysinfoDef *ret)
{
const char *cur, *tmp_base;
@@ -1197,8 +1190,6 @@ virSysinfoParseX86Memory(const char *base, virSysinfoDef *ret)
next:
base += strlen("Memory Device");
}
-
- return 0;
}
virSysinfoDef *
@@ -1223,8 +1214,7 @@ virSysinfoReadDMI(void)
if (virSysinfoParseX86System(outbuf, &ret->system) < 0)
return NULL;
- if (virSysinfoParseX86BaseBoard(outbuf, &ret->baseBoard, &ret->nbaseBoard) < 0)
- return NULL;
+ virSysinfoParseX86BaseBoard(outbuf, &ret->baseBoard, &ret->nbaseBoard);
if (virSysinfoParseX86Chassis(outbuf, &ret->chassis) < 0)
return NULL;
@@ -1234,13 +1224,10 @@ virSysinfoReadDMI(void)
ret->nprocessor = 0;
ret->processor = NULL;
- if (virSysinfoParseX86Processor(outbuf, ret) < 0)
- return NULL;
-
+ virSysinfoParseX86Processor(outbuf, ret);
ret->nmemory = 0;
ret->memory = NULL;
- if (virSysinfoParseX86Memory(outbuf, ret) < 0)
- return NULL;
+ virSysinfoParseX86Memory(outbuf, ret);
return g_steal_pointer(&ret);
}
--
2.42.2
1 week, 6 days
[PATCH v2 0/5] Allow Guest CPU Model with Deprecated Features Disabled
by Collin Walling
# Changelog
v2
- rebased on latest master changes
# Description
Add support for libvirt to query and cache an array of deprecated CPU features
(aka CPU properties) for the host-model. This data is queried via a full
query-cpu-model-expansion and cached in the QEMU capabilities file. This
model expansion will depend on the availability of the "deprecated-props" field
resulting from a query-cpu-model-expansion command. Currently, only s390x
supports this field.
The purpose of these patches is to make it easy for users to create guests with
a CPU model that will be compatible & migratable with future hardware.
An updated host CPU model with deprecated features paired with the policy "disable"
may be visable via an update to the virsh domcapabilities command with the
--disable-deprecated-features flag. An example is shown below.
Note: other CPU model queries (e.g. baseline and comparison) currently do not
consider deprecated features, as their outputs do not consider feature policy.
If implementation is desired, it will require a discussion on how these
commands should report policies.
Examples:
virsh domcapabilities --disable-deprecated-features
e.g. output (trimmed):
<mode name='host-model' supported='yes'>
<model fallback='forbid'>z14.2-base</model>
<feature policy='require' name='aen'/>
<feature policy='require' name='cmmnt'/>
<feature policy='require' name='aefsi'/>
<feature policy='require' name='diag318'/>
<feature policy='require' name='mepoch'/>
<feature policy='require' name='msa8'/>
<feature policy='require' name='msa7'/>
<feature policy='require' name='msa6'/>
<feature policy='require' name='msa5'/>
<feature policy='require' name='msa4'/>
<feature policy='require' name='msa3'/>
<feature policy='require' name='msa2'/>
<feature policy='require' name='msa1'/>
<feature policy='require' name='sthyi'/>
<feature policy='require' name='edat'/>
<feature policy='require' name='ri'/>
<feature policy='require' name='edat2'/>
<feature policy='require' name='etoken'/>
<feature policy='require' name='vx'/>
<feature policy='require' name='ipter'/>
<feature policy='require' name='mepochptff'/>
<feature policy='require' name='ap'/>
<feature policy='require' name='vxeh'/>
<feature policy='require' name='vxpd'/>
<feature policy='require' name='esop'/>
<feature policy='require' name='apqi'/>
<feature policy='require' name='apft'/>
<feature policy='require' name='els'/>
<feature policy='require' name='iep'/>
<feature policy='require' name='apqci'/>
<feature policy='disable' name='cte'/>
<feature policy='require' name='ais'/>
<feature policy='disable' name='bpb'/>
<feature policy='require' name='ctop'/>
<feature policy='require' name='gs'/>
<feature policy='require' name='ppa15'/>
<feature policy='require' name='zpci'/>
<feature policy='require' name='sea_esop2'/>
<feature policy='disable' name='te'/>
<feature policy='require' name='cmm'/>
<feature policy='disable' name='csske'/>
</mode>
A domain may be defined with a new <cpu> XML attribute, deprecated_features='on|off':
<cpu mode='host-model' check='partial' deprecated_features='off'/>
e.g. after guest has started (trimmed):
<cpu mode='custom' match='exact' check='partial' deprecated_features='off'>
<model fallback='forbid'>z14.2-base</model>
<feature policy='require' name='aen'/>
<feature policy='require' name='cmmnt'/>
<feature policy='require' name='aefsi'/>
<feature policy='require' name='diag318'/>
<feature policy='require' name='mepoch'/>
<feature policy='require' name='msa8'/>
<feature policy='require' name='msa7'/>
<feature policy='require' name='msa6'/>
<feature policy='require' name='msa5'/>
<feature policy='require' name='msa4'/>
<feature policy='require' name='msa3'/>
<feature policy='require' name='msa2'/>
<feature policy='require' name='msa1'/>
<feature policy='require' name='sthyi'/>
<feature policy='require' name='edat'/>
<feature policy='require' name='ri'/>
<feature policy='require' name='edat2'/>
<feature policy='require' name='etoken'/>
<feature policy='require' name='vx'/>
<feature policy='require' name='ipter'/>
<feature policy='require' name='mepochptff'/>
<feature policy='require' name='ap'/>
<feature policy='require' name='vxeh'/>
<feature policy='require' name='vxpd'/>
<feature policy='require' name='esop'/>
<feature policy='require' name='apqi'/>
<feature policy='require' name='apft'/>
<feature policy='require' name='els'/>
<feature policy='require' name='iep'/>
<feature policy='require' name='apqci'/>
<feature policy='disable' name='cte'/>
<feature policy='require' name='ais'/>
<feature policy='disable' name='bpb'/>
<feature policy='require' name='ctop'/>
<feature policy='require' name='gs'/>
<feature policy='require' name='ppa15'/>
<feature policy='require' name='zpci'/>
<feature policy='require' name='sea_esop2'/>
<feature policy='disable' name='te'/>
<feature policy='require' name='cmm'/>
<feature policy='disable' name='csske'/>
</cpu>
Collin Walling (5):
qemuMonitorJSONGetCPUModelExpansion: refactor parsing functions
qemu: parse deprecated-props from query-cpu-model-expansion response
qemu_capabilities: query deprecated features for host-model
virsh: add --disable-deprecated-features flag to domcapabilities
conf: add deprecated_features attribute
docs/manpages/virsh.rst | 6 +
include/libvirt/libvirt-domain.h | 12 +
src/conf/cpu_conf.c | 10 +
src/conf/cpu_conf.h | 1 +
src/conf/schemas/cputypes.rng | 12 +
src/libvirt-domain.c | 2 +-
src/qemu/qemu_capabilities.c | 89 +++++
src/qemu/qemu_capabilities.h | 4 +
src/qemu/qemu_driver.c | 8 +-
src/qemu/qemu_monitor.c | 10 +
src/qemu/qemu_monitor.h | 1 +
src/qemu/qemu_monitor_json.c | 64 +++-
src/qemu/qemu_process.c | 4 +
.../caps_9.1.0_s390x.replies | 348 +++++++++++++++++-
.../qemucapabilitiesdata/caps_9.1.0_s390x.xml | 13 +
.../caps_9.2.0_s390x.replies | 348 +++++++++++++++++-
.../qemucapabilitiesdata/caps_9.2.0_s390x.xml | 13 +
tools/virsh-host.c | 9 +-
18 files changed, 940 insertions(+), 14 deletions(-)
--
2.45.1
2 weeks, 3 days
[PATCH 0/5] cpu_map: Add missing -v1 models
by Jiri Denemark
CPU models that do not have a list of versions attached are still
advertised as aliases to corresponding -v1 variants. We should add the
missing variants to the CPU map.
Available on gitlab:
git fetch https://gitlab.com/jirkade/libvirt.git cpu-versions
Pipeline: https://gitlab.com/jirkade/libvirt/-/pipelines/1564399375
Jiri Denemark (5):
cpu_map: Sort data files in meson.build
sync_qemu_models_i386: Update meson.build
sync_qemu_models_i386: Ignore old models
sync_qemu_models_i386: Generate missing -v1 variants
cpu_map: Add missing -v1 models
src/cpu_map/index.xml | 2 +
src/cpu_map/meson.build | 18 +++---
src/cpu_map/sync_qemu_models_i386.py | 58 +++++++++++++++++++
src/cpu_map/x86_EPYC-Genoa-v1.xml | 6 ++
src/cpu_map/x86_KnightsMill-v1.xml | 6 ++
.../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 20 ++++++-
tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 20 ++++++-
tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 20 ++++++-
tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 20 ++++++-
tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_7.0.0-q35.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml | 20 ++++++-
tests/domaincapsdata/qemu_7.0.0.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_7.1.0-q35.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml | 20 ++++++-
tests/domaincapsdata/qemu_7.1.0.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_7.2.0-q35.x86_64.xml | 14 ++++-
.../qemu_7.2.0-tcg.x86_64+hvf.xml | 16 ++++-
.../domaincapsdata/qemu_7.2.0-tcg.x86_64.xml | 16 ++++-
tests/domaincapsdata/qemu_7.2.0.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_8.0.0-q35.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_8.0.0-tcg.x86_64.xml | 16 ++++-
tests/domaincapsdata/qemu_8.0.0.x86_64.xml | 14 ++++-
.../domaincapsdata/qemu_8.1.0-q35.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_8.1.0-tcg.x86_64.xml | 56 +++++++++++++++++-
tests/domaincapsdata/qemu_8.1.0.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_8.2.0-q35.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_8.2.0-tcg.x86_64.xml | 55 +++++++++++++++++-
tests/domaincapsdata/qemu_8.2.0.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_9.0.0-q35.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_9.0.0-tcg.x86_64.xml | 54 ++++++++++++++++-
tests/domaincapsdata/qemu_9.0.0.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_9.1.0-q35.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_9.1.0-tcg.x86_64.xml | 54 ++++++++++++++++-
tests/domaincapsdata/qemu_9.1.0.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_9.2.0-q35.x86_64.xml | 46 ++++++++++++++-
.../domaincapsdata/qemu_9.2.0-tcg.x86_64.xml | 54 ++++++++++++++++-
tests/domaincapsdata/qemu_9.2.0.x86_64.xml | 46 ++++++++++++++-
45 files changed, 1152 insertions(+), 63 deletions(-)
create mode 100644 src/cpu_map/x86_EPYC-Genoa-v1.xml
create mode 100644 src/cpu_map/x86_KnightsMill-v1.xml
--
2.47.0
3 weeks, 1 day
[PATCH v3 0/5] ch: handle events from cloud-hypervisor
by Purna Pavan Chandra Aekkaladevi
changes from v2->v3:
* Remove patch 'utils: Implement virFileIsNamedPipe' as it is no more needed.
* Remove the eventmonitorpath only if it exists
* Added domain name as a prefix to logs from ch_events.c. This will make
debugging easier.
* Simplified event parsing logic by reserving a byte for null char.
changes from v1->v2:
* Rebase on latest master
* Use /* */ for comments
* Remove fifo file if already exists
* Address other comments from Praveen Paladugu
cloud-hypervisor raises various events, including VM lifecylce operations
such as boot, shutdown, pause, resume, etc. Libvirt will now read these
events and take the necessary actions, such as correctly updating the
domain state. A FIFO file is passed to `--event-monitor` option of
cloud-hypervisor. Libvirt creates a new thread that acts as the reader
of the fifo file and continuously monitors for new events. Currently,
shutdown events are handled by updating the domain state appropriately.
Purna Pavan Chandra Aekkaladevi (5):
ch: pass --event-monitor option to cloud-hypervisor
ch: start a new thread for handling ch events
ch: events: Read and parse cloud-hypervisor events
ch: events: facilitate lifecycle events handling
NEWS: Mention event handling support in ch driver
NEWS.rst | 7 +
po/POTFILES | 1 +
src/ch/ch_events.c | 329 ++++++++++++++++++++++++++++++++++++++++++++
src/ch/ch_events.h | 54 ++++++++
src/ch/ch_monitor.c | 52 ++++++-
src/ch/ch_monitor.h | 11 ++
src/ch/meson.build | 2 +
7 files changed, 449 insertions(+), 7 deletions(-)
create mode 100644 src/ch/ch_events.c
create mode 100644 src/ch/ch_events.h
--
2.34.1
3 weeks, 2 days
[PATCH] qemuSnapshotDeleteValidate: Fix crash when disk is not found in VM definition
by kaihuan
qemuDomainDiskByName() can return a NULL pointer on failure.
But this returned value in qemuSnapshotDeleteValidate is not checked.It will make libvirtd crash.
Signed-off-by: kaihuan <jungleman759(a)gmail.com>
---
src/qemu/qemu_snapshot.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 18b2e478f6..bcbd913073 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -4242,8 +4242,19 @@ qemuSnapshotDeleteValidate(virDomainObj *vm,
virDomainDiskDef *vmdisk = NULL;
virDomainDiskDef *disk = NULL;
- vmdisk = qemuDomainDiskByName(vm->def, snapDisk->name);
- disk = qemuDomainDiskByName(snapdef->parent.dom, snapDisk->name);
+ if (!(vmdisk = qemuDomainDiskByName(vm->def, snapDisk->name))) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("disk '%1$s' referenced by snapshot '%2$s' not found in the current definition"),
+ snapDisk->name, snap->def->name);
+ return -1;
+ }
+
+ if (!(disk = qemuDomainDiskByName(snapdef->parent.dom, snapDisk->name))) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("disk '%1$s' referenced by snapshot '%2$s' not found in the VM definition of the deleted snapshot"),
+ snapDisk->name, snap->def->name);
+ return -1;
+ }
if (!virStorageSourceIsSameLocation(vmdisk->src, disk->src)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
--
2.33.1.windows.1
3 weeks, 6 days
[PATCH v5 00/18] *** qemu: block: Support block disk along with throttle filters ***
by Harikumar R
*** BLURB HERE ***
Chun Feng Wu (17):
schema: Add new domain elements to support multiple throttle groups
schema: Add new domain elements to support multiple throttle filters
config: Introduce ThrottleGroup and corresponding XML parsing
config: Introduce ThrottleFilter and corresponding XML parsing
qemu: monitor: Add support for ThrottleGroup operations
tests: Test qemuMonitorJSONGetThrottleGroup and
qemuMonitorJSONUpdateThrottleGroup
remote: New APIs for ThrottleGroup lifecycle management
qemu: Refactor qemuDomainSetBlockIoTune to extract common methods
qemu: Implement qemu driver for throttle API
qemu: helper: throttle filter nodename and preparation processing
qemu: block: Support block disk along with throttle filters
config: validate: Verify iotune, throttle group and filter
qemuxmlconftest: Add 'throttlefilter' tests
test_driver: Test throttle group lifecycle APIs
virsh: Refactor iotune options for re-use
virsh: Add support for throttle group operations
virsh: Add option "throttle-groups" to "attach_disk"
Harikumar Rajkumar (1):
tests: Test qemuxmlactivetestThrottleGroup
docs/formatdomain.rst | 47 ++
docs/manpages/virsh.rst | 135 +++-
include/libvirt/libvirt-domain.h | 21 +
src/conf/domain_conf.c | 398 ++++++++++
src/conf/domain_conf.h | 45 ++
src/conf/domain_validate.c | 119 ++-
src/conf/schemas/domaincommon.rng | 293 ++++----
src/conf/virconftypes.h | 4 +
src/driver-hypervisor.h | 22 +
src/libvirt-domain.c | 174 +++++
src/libvirt_private.syms | 8 +
src/libvirt_public.syms | 7 +
src/qemu/qemu_block.c | 136 ++++
src/qemu/qemu_block.h | 49 ++
src/qemu/qemu_command.c | 180 +++++
src/qemu/qemu_command.h | 6 +
src/qemu/qemu_domain.c | 73 +-
src/qemu/qemu_driver.c | 619 +++++++++++++---
src/qemu/qemu_hotplug.c | 33 +
src/qemu/qemu_monitor.c | 34 +
src/qemu/qemu_monitor.h | 14 +
src/qemu/qemu_monitor_json.c | 134 ++++
src/qemu/qemu_monitor_json.h | 14 +
src/remote/remote_daemon_dispatch.c | 44 ++
src/remote/remote_driver.c | 40 ++
src/remote/remote_protocol.x | 48 +-
src/remote_protocol-structs | 28 +
src/test/test_driver.c | 452 ++++++++----
tests/qemumonitorjsontest.c | 86 +++
.../throttlefilter-in.xml | 392 ++++++++++
.../throttlefilter-out.xml | 393 ++++++++++
tests/qemuxmlactivetest.c | 1 +
.../throttlefilter-invalid.x86_64-latest.err | 1 +
.../throttlefilter-invalid.xml | 89 +++
.../throttlefilter.x86_64-latest.args | 55 ++
.../throttlefilter.x86_64-latest.xml | 105 +++
tests/qemuxmlconfdata/throttlefilter.xml | 95 +++
tests/qemuxmlconftest.c | 2 +
tools/virsh-completer-domain.c | 82 +++
tools/virsh-completer-domain.h | 16 +
tools/virsh-domain.c | 680 ++++++++++++++----
41 files changed, 4649 insertions(+), 525 deletions(-)
create mode 100644 tests/qemustatusxml2xmldata/throttlefilter-in.xml
create mode 100644 tests/qemustatusxml2xmldata/throttlefilter-out.xml
create mode 100644 tests/qemuxmlconfdata/throttlefilter-invalid.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/throttlefilter-invalid.xml
create mode 100644 tests/qemuxmlconfdata/throttlefilter.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/throttlefilter.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/throttlefilter.xml
--
2.39.5 (Apple Git-154)
3 weeks, 6 days