[RFC PATCH 0/7] Fix issue when storage migration is requested but there are no disks to migrate
by Peter Krempa
In certain weird cases and due to very crusty code we'd instruct qemu to
migrate storage using the old style storage migration when there wasn't
anything to migrate. This was caused by a recent refactor.
Note that the series is RFC as I didn't really test it yet, but feel
free to provide feedback.
Peter Krempa (7):
util: xml: Introduce virXMLFormatElementEmpty
qemuMigrationCookieNBDXMLFormat: Format empty <nbd/> element
qemuMigrationSrcNBDStorageCopy: Return error code on error
qemuMigrationSrcNBDStorageCopy: Don't pass migrate_flags
qemuMigrationSrcRun: Sanitize setting of cookieFlags and migrate_flags
on storage migration
qemuMigrationSrcRun: Don't attempt any storage migration if no disks
will be migrated
qemuMigrationSrcBeginPhase: Don't offer 'nbd' in cookie if there are
no disks to migrate
src/libvirt_private.syms | 1 +
src/qemu/qemu_migration.c | 102 ++++++++++++++++++-------------
src/qemu/qemu_migration_cookie.c | 2 +-
src/util/virxml.c | 42 ++++++++-----
src/util/virxml.h | 7 +++
5 files changed, 95 insertions(+), 59 deletions(-)
--
2.30.2
3 years, 6 months
[PATCH] docs: formatdomain: Fix quoting of ':since:' argument for <teaming>
by Peter Krempa
The end quote of the argument of :since: must not have a space in front
of it as it's then not considered as end of the argument.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
docs/formatdomain.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Pushed as trivial.
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 4388ad545f..4528e172ec 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -4856,7 +4856,7 @@ Teaming a virtio/hostdev NIC pair
:since:`Since 6.1.0 (QEMU and KVM only, requires QEMU 4.2.0 or newer and a guest
virtio-net driver supporting the "failover" feature, such as the one included in
-Linux kernel 4.18 and newer) ` The ``<teaming>`` element of two interfaces can
+Linux kernel 4.18 and newer)` The ``<teaming>`` element of two interfaces can
be used to connect them as a team/bond device in the guest (assuming proper
support in the hypervisor and the guest network driver).
--
2.30.2
3 years, 6 months
[libvirt PATCH v2 00/10] Refactor more XML parsing boilerplate code
by Tim Wiederhake
For background, see
https://listman.redhat.com/archives/libvir-list/2021-April/msg00668.html
Changes since V1:
* Rebased
* s/VIR_XML_PROP_OPTIONAL/VIR_XML_PROP_NONE/
* Declare variables 1 / line
* Commented on strictening of parser in patch #10
Tim Wiederhake (10):
virDomainBackupDiskDefParseXML: Use virXMLProp*
virDomainBackupDefParse: Use virXMLProp*
virZPCIDeviceAddressParseXML: Use virXMLProp*
virPCIDeviceAddressParseXML: Use virXMLProp*
virDomainDeviceCCWAddressParseXML: Use virXMLProp*
virDomainDeviceDriveAddressParseXML: Use virXMLProp*
virDomainDeviceVirtioSerialAddressParseXML: Use virXMLProp*
virDomainDeviceCcidAddressParseXML: Use virXMLProp*
virDomainDeviceUSBAddressParseXML: Use virXMLProp*
virInterfaceLinkParseXML: Use virXMLProp*
src/conf/backup_conf.c | 57 +++-------
src/conf/device_conf.c | 237 ++++++++++++-----------------------------
2 files changed, 80 insertions(+), 214 deletions(-)
--
2.26.3
3 years, 6 months
[libvirt PATCH] spec: Do not build qemu driver for Power on RHEL-9
by Jiri Denemark
https://bugzilla.redhat.com/show_bug.cgi?id=1946529
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
libvirt.spec.in | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index f9af330186..be74964b7b 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -19,7 +19,11 @@
%define arches_qemu_kvm %{ix86} x86_64 %{power64} %{arm} aarch64 s390x
%if 0%{?rhel}
- %define arches_qemu_kvm x86_64 %{power64} aarch64 s390x
+ %if 0%{?rhel} <= 8
+ %define arches_qemu_kvm x86_64 %{power64} aarch64 s390x
+ %else
+ %define arches_qemu_kvm x86_64 aarch64 s390x
+ %endif
%endif
%define arches_64bit x86_64 %{power64} aarch64 s390x riscv64
--
2.31.1
3 years, 6 months
[libvirt PATCH v2 00/21] cleanup meson checks for runtime binaries
by Pavel Hrdina
Recent attempt to add a lot of meson options to specify different
runtime paths motivated me enough to cleanup this from meson.
Changes in v2:
- split and rework patch 16/17 to address review comments
- added a new patch to cleanup libvirt.spec.in file
Pavel Hrdina (21):
bridge_driver: fix comment about dnsmasqCaps
virdnsmasq: drop unused dnsmasqCapsNewFromFile function
virdnsmasq: drop unused dnsmasqCapsRefresh function
virdnsmasq: remove binaryPath argument from dnsmasqCapsNewFromBuffer
virdnsmasq: remove binaryPath argument from dnsmasqCapsNewFromBinary
virfirewall: use virFindFileInPath instead of virFileIsExecutable
tests: introduce virfirewallmock
tests: use virfirewallmock instead of hasNetfilterTools
virnetdev: move virNetDevSetRootQDisc to virnetdevbandwidth
tests: testutilsqemu: move virFindFileInPath into domaincapsmock
meson: don't check collie as program for sheepdog
bhyvexml2argvtest: use virCommandToStringFull to strip command path
storage: use virFindFileInPath to validate presence of mkfs
virfile: introduce virFindFileInPathFull()
qemu_conf: use virFindFileInPathFull for runtime binaries
meson: drop check for runtime binary dependencies
meson: move iscsiadm check into storage_iscsi condition
meson: stop setting runtime binaries defines during compilation
meson: use runtime binaries to only resolve features with "auto" value
meson: optional_programs should be used only for building libvirt
libvirt.spec: drop no longer required build dependencies
libvirt.spec.in | 31 ---
meson.build | 214 ++++++------------
src/bhyve/bhyve_command.c | 4 +
src/libvirt_private.syms | 6 +-
src/locking/lock_driver_lockd.c | 12 +-
src/network/bridge_driver.c | 8 +-
src/node_device/node_device_driver.c | 2 +
src/qemu/qemu_conf.c | 23 +-
src/qemu/qemu_domain.c | 3 +-
src/storage/storage_backend_fs.c | 24 +-
src/storage/storage_backend_logical.c | 13 ++
src/storage/storage_backend_sheepdog.c | 2 +
src/storage/storage_backend_zfs.c | 3 +
src/storage/storage_util.c | 2 +
src/storage/storage_util.h | 6 +
src/util/virdnsmasq.c | 56 +----
src/util/virdnsmasq.h | 8 +-
src/util/virfile.c | 16 +-
src/util/virfile.h | 6 +-
src/util/virfirewall.c | 4 +-
src/util/virfirewall.h | 4 +
src/util/viriscsi.h | 2 +
src/util/virkmod.h | 3 +
src/util/virnetdev.c | 46 ----
src/util/virnetdev.h | 4 -
src/util/virnetdevbandwidth.c | 50 ++++
src/util/virnetdevbandwidth.h | 6 +
src/util/virnetdevip.c | 2 +
src/util/virnetdevmidonet.c | 2 +
src/util/virnetdevopenvswitch.c | 2 +
src/util/virnuma.c | 1 +
src/util/virsysinfo.c | 1 +
src/util/virutil.c | 2 +
.../bhyvexml2argv-acpiapic.args | 2 +-
.../bhyvexml2argv-acpiapic.ldargs | 2 +-
...ml2argv-addr-isa-controller-on-slot-1.args | 2 +-
...2argv-addr-isa-controller-on-slot-1.ldargs | 2 +-
...l2argv-addr-isa-controller-on-slot-31.args | 2 +-
...argv-addr-isa-controller-on-slot-31.ldargs | 2 +-
...xml2argv-addr-more-than-32-sata-disks.args | 2 +-
...l2argv-addr-more-than-32-sata-disks.ldargs | 2 +-
...hyvexml2argv-addr-multiple-sata-disks.args | 2 +-
...vexml2argv-addr-multiple-sata-disks.ldargs | 2 +-
...vexml2argv-addr-multiple-virtio-disks.args | 2 +-
...xml2argv-addr-multiple-virtio-disks.ldargs | 2 +-
...rgv-addr-no32devs-multiple-sata-disks.args | 2 +-
...v-addr-no32devs-multiple-sata-disks.ldargs | 2 +-
...l2argv-addr-no32devs-single-sata-disk.args | 2 +-
...argv-addr-no32devs-single-sata-disk.ldargs | 2 +-
...rgv-addr-non-isa-controller-on-slot-1.args | 2 +-
.../bhyvexml2argv-addr-single-sata-disk.args | 2 +-
...bhyvexml2argv-addr-single-sata-disk.ldargs | 2 +-
...bhyvexml2argv-addr-single-virtio-disk.args | 2 +-
...yvexml2argv-addr-single-virtio-disk.ldargs | 2 +-
.../bhyvexml2argvdata/bhyvexml2argv-base.args | 2 +-
.../bhyvexml2argv-base.ldargs | 2 +-
.../bhyvexml2argv-bhyveload-bootorder.args | 2 +-
.../bhyvexml2argv-bhyveload-bootorder.ldargs | 2 +-
.../bhyvexml2argv-bhyveload-bootorder1.args | 2 +-
.../bhyvexml2argv-bhyveload-bootorder1.ldargs | 2 +-
.../bhyvexml2argv-bhyveload-bootorder3.args | 2 +-
.../bhyvexml2argv-bhyveload-bootorder3.ldargs | 2 +-
.../bhyvexml2argv-bhyveload-explicitargs.args | 2 +-
...hyvexml2argv-bhyveload-explicitargs.ldargs | 2 +-
.../bhyvexml2argv-commandline.args | 2 +-
.../bhyvexml2argv-commandline.ldargs | 2 +-
...gv-console-master-slave-not-specified.args | 2 +-
...-console-master-slave-not-specified.ldargs | 2 +-
.../bhyvexml2argv-console.args | 2 +-
.../bhyvexml2argv-console.ldargs | 2 +-
.../bhyvexml2argv-cputopology.args | 2 +-
.../bhyvexml2argv-cputopology.ldargs | 2 +-
.../bhyvexml2argv-custom-loader.args | 2 +-
.../bhyvexml2argv-custom-loader.ldargs | 2 +-
.../bhyvexml2argv-disk-cdrom-grub.args | 2 +-
.../bhyvexml2argv-disk-cdrom-grub.ldargs | 2 +-
.../bhyvexml2argv-disk-cdrom.args | 2 +-
.../bhyvexml2argv-disk-cdrom.ldargs | 2 +-
.../bhyvexml2argv-disk-virtio.args | 2 +-
.../bhyvexml2argv-disk-virtio.ldargs | 2 +-
.../bhyvexml2argv-firmware-efi.args | 2 +-
.../bhyvexml2argv-fs-9p-readonly.args | 2 +-
.../bhyvexml2argv-fs-9p-readonly.ldargs | 2 +-
.../bhyvexml2argv-fs-9p.args | 2 +-
.../bhyvexml2argv-fs-9p.ldargs | 2 +-
.../bhyvexml2argv-grub-bootorder.args | 2 +-
.../bhyvexml2argv-grub-bootorder.ldargs | 2 +-
.../bhyvexml2argv-grub-bootorder2.args | 2 +-
.../bhyvexml2argv-grub-bootorder2.ldargs | 2 +-
.../bhyvexml2argv-grub-defaults.args | 2 +-
.../bhyvexml2argv-grub-defaults.ldargs | 2 +-
.../bhyvexml2argv-input-xhci-tablet.args | 2 +-
.../bhyvexml2argv-input-xhci-tablet.ldargs | 2 +-
.../bhyvexml2argv-isa-controller.args | 2 +-
.../bhyvexml2argv-isa-controller.ldargs | 2 +-
.../bhyvexml2argv-localtime.args | 2 +-
.../bhyvexml2argv-localtime.ldargs | 2 +-
.../bhyvexml2argv-macaddr.args | 2 +-
.../bhyvexml2argv-macaddr.ldargs | 2 +-
.../bhyvexml2argvdata/bhyvexml2argv-msrs.args | 2 +-
.../bhyvexml2argv-msrs.ldargs | 2 +-
.../bhyvexml2argv-net-e1000.args | 2 +-
.../bhyvexml2argv-net-e1000.ldargs | 2 +-
.../bhyvexml2argv-serial-grub-nocons.args | 2 +-
.../bhyvexml2argv-serial-grub-nocons.ldargs | 2 +-
.../bhyvexml2argv-serial-grub.args | 2 +-
.../bhyvexml2argv-serial-grub.ldargs | 2 +-
.../bhyvexml2argv-serial.args | 2 +-
.../bhyvexml2argv-serial.ldargs | 2 +-
.../bhyvexml2argv-sound.args | 2 +-
.../bhyvexml2argv-sound.ldargs | 2 +-
.../bhyvexml2argvdata/bhyvexml2argv-uefi.args | 2 +-
.../bhyvexml2argv-vnc-autoport.args | 2 +-
.../bhyvexml2argv-vnc-password.args | 2 +-
.../bhyvexml2argv-vnc-resolution.args | 2 +-
.../bhyvexml2argv-vnc-vgaconf-io.args | 2 +-
.../bhyvexml2argv-vnc-vgaconf-off.args | 2 +-
.../bhyvexml2argv-vnc-vgaconf-on.args | 2 +-
.../bhyvexml2argvdata/bhyvexml2argv-vnc.args | 2 +-
.../bhyvexml2argv-wired.args | 2 +-
.../bhyvexml2argv-wired.ldargs | 2 +-
tests/bhyvexml2argvtest.c | 4 +-
tests/domaincapsmock.c | 17 ++
tests/meson.build | 1 +
tests/networkxml2conftest.c | 6 +-
tests/networkxml2firewalltest.c | 16 +-
tests/nwfilterebiptablestest.c | 15 +-
tests/nwfilterxml2firewalltest.c | 14 +-
tests/qemuxml2argvmock.c | 5 +-
tests/testutilsqemu.c | 15 --
tests/virfirewallmock.c | 35 +++
tests/virfirewalltest.c | 15 +-
132 files changed, 403 insertions(+), 484 deletions(-)
create mode 100644 tests/virfirewallmock.c
--
2.30.2
3 years, 6 months
[PATCH] qemu.conf: add max-ram-below-4g option
by yezhiyong
Limit the amount of ram below 4G. This helps in scenarios like
GPU passthrough when the GPA used by DMA device is conflict with
the decode window of a host bridge and the address translation
request to iommu isn't launched, which causes address overlapping.
Note that currently this can be triggered by some abnormal behavior
of hardware.
In the general case, this option needs to be configured when virtual
machines share the same host, which is why using qemu.conf to support
per-host configuration.
Signed-off-by: yezhiyong <yezhiyong(a)bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei(a)bytedance.com>
Signed-off-by: zhangruien <zhangruien(a)bytedance.com>
---
src/qemu/qemu.conf | 8 ++++++++
src/qemu/qemu_command.c | 4 ++++
src/qemu/qemu_conf.c | 5 +++++
src/qemu/qemu_conf.h | 1 +
4 files changed, 18 insertions(+)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 8722dc169c..f09c89486e 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -898,6 +898,14 @@
# NOTE: big files will be stored here
#memory_backing_dir = "/var/lib/libvirt/qemu/ram"
+# Limit the amount of ram below 4G. This helps in scenarios like
+# GPU passthrough when the GPA used by DMA device is comflict with
+# the decode window of a host bridge and the address translation
+# request to iommu isn't launched, which causes address overlapping.
+# Note that currently this can be triggered by some abnormal behavior
+# of hardware.
+#max_ram_below_4g = "2G"
+
# Path to the SCSI persistent reservations helper. This helper is
# used whenever <reservations/> are enabled for SCSI LUN devices.
#pr_helper = "/usr/bin/qemu-pr-helper"
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2f69a79bc0..fd5e14c500 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6960,6 +6960,10 @@ qemuBuildMachineCommandLine(virCommand *cmd,
cfg->dumpGuestCore ? "on" : "off");
}
+ if (cfg->maxRamBelow4G)
+ virBufferAsprintf(&buf, ",max-ram-below-4g=%s",
+ cfg->maxRamBelow4G);
+
if (def->mem.nosharepages)
virBufferAddLit(&buf, ",mem-merge=off");
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 916a3d36ee..b718995870 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -384,6 +384,8 @@ static void virQEMUDriverConfigDispose(void *obj)
g_strfreev(cfg->capabilityfilters);
g_free(cfg->deprecationBehavior);
+
+ g_free(cfg->maxRamBelow4G);
}
@@ -1001,6 +1003,9 @@ virQEMUDriverConfigLoadMemoryEntry(virQEMUDriverConfig *cfg,
g_autofree char *dir = NULL;
int rc;
+ if (virConfGetValueString(conf, "max_ram_below_4g", &cfg->maxRamBelow4G) < 0)
+ return -1;
+
if ((rc = virConfGetValueString(conf, "memory_backing_dir", &dir)) < 0) {
return -1;
} else if (rc > 0) {
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 2f64e39a18..ff558e2fdb 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -216,6 +216,7 @@ struct _virQEMUDriverConfig {
bool virtiofsdDebug;
char *memoryBackingDir;
+ char *maxRamBelow4G;
uid_t swtpm_user;
gid_t swtpm_group;
--
2.24.3 (Apple Git-128)
3 years, 6 months
[PATCH] qemu: blockjob: Transition into 'ready' state only from expected states
by Peter Krempa
In certain rare occasions qemu can transition a block job which was
already 'ready' into 'standby' and then back. If this happens in the
following order libvirt will get confused about the actual job state:
1) the block copy job is 'ready' (job->state == QEMU_BLOCKJOB_STATE_READY)
2) user calls qemuDomainBlockJobAbort with VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT
flag but without VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC
3) the block job is switched to synchronous event handling
4) the block job blips to 'standby' and back to 'ready', the event is
not processed since the blockjob is in sync mode for now
5) qemuDomainBlockJobPivot is called:
5.1) 'job-complete' QMP command is issued
5.2) job->state is set to QEMU_BLOCKJOB_STATE_PIVOTING
6) code for synchronous-wait for the job completion in qemuDomainBlockJobAbort
is invoked
7) the waiting loop calls qemuBlockJobUpdate:
7.1) job->newstate is QEMU_BLOCKJOB_STATE_READY due to 4)
7.2) qemuBlockJobEventProcess is called
7.3) the handler for QEMU_BLOCKJOB_STATE_READY overwrites
job->state from QEMU_BLOCKJOB_STATE_PIVOTING to QEMU_BLOCKJOB_STATE_READY
8) qemuDomainBlockJobAbort is looking for a finished job, so waits again
9) qemu finishes the blockjob and transitions it into 'concluded' state
10) qemuBlockJobUpdate is triggered again, this time finalizing the job.
10.1) job->newstate is = QEMU_BLOCKJOB_STATE_CONCLUDED
job->state is = QEMU_BLOCKJOB_STATE_READY
10.2) qemuBlockJobEventProcessConcluded is called, the function
checks whether there was an error with the blockjob. Since
there was no error job->newstate becomes
QEMU_BLOCKJOB_STATE_COMPLETED.
10.3) qemuBlockJobEventProcessConcludedTransition selects the action
for the appropriate block job type where we have:
case QEMU_BLOCKJOB_TYPE_COPY:
if (job->state == QEMU_BLOCKJOB_STATE_PIVOTING && success)
qemuBlockJobProcessEventConcludedCopyPivot(driver, vm, job, asyncJob);
else
qemuBlockJobProcessEventConcludedCopyAbort(driver, vm, job, asyncJob);
break;
Since job->state is QEMU_BLOCKJOB_STATE_READY,
qemuBlockJobProcessEventConcludedCopyAbort is called.
This patch forbids transitions to QEMU_BLOCKJOB_STATE_READY if the
previous job state isn't QEMU_BLOCKJOB_STATE_RUNNING or
QEMU_BLOCKJOB_STATE_NEW.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1951507
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 21fcc29ddb..9ae4500f4d 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -1697,14 +1697,21 @@ qemuBlockJobEventProcess(virQEMUDriver *driver,
break;
case QEMU_BLOCKJOB_STATE_READY:
- /* mirror may be NULL for copy job corresponding to migration */
- if (job->disk) {
- job->disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_READY;
- qemuBlockJobEmitEvents(driver, vm, job->disk, job->type, job->newstate);
+ /* in certain cases qemu can blip out and back into 'ready' state for
+ * a blockjob. In cases when we already are past RUNNING the job such
+ * as when pivoting/aborting this could reset the internally set job
+ * state, thus we ignore it if the job isn't in expected state */
+ if (job->state == QEMU_BLOCKJOB_STATE_NEW ||
+ job->state == QEMU_BLOCKJOB_STATE_RUNNING) {
+ /* mirror may be NULL for copy job corresponding to migration */
+ if (job->disk) {
+ job->disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_READY;
+ qemuBlockJobEmitEvents(driver, vm, job->disk, job->type, job->newstate);
+ }
+ job->state = job->newstate;
+ qemuDomainSaveStatus(vm);
}
- job->state = job->newstate;
job->newstate = -1;
- qemuDomainSaveStatus(vm);
break;
case QEMU_BLOCKJOB_STATE_NEW:
--
2.30.2
3 years, 6 months
[libvirt PATCH v4 0/7] spec: Reorganize some packages
by Andrea Bolognani
Changes from [v3]:
* generate per-command bash completion scripts using Meson instead
of tweaking the contents after the fact for RPM build;
* update documentation as files are moved around and packages are
dropped.
Changes from [v2]:
* move virt-admin to -daemon rather than -client;
* move other host-only tools from -client to -daemon;
* move systemtap probes from -client to -libs.
Changes from [v1]:
* add Obsoletes/Provides for a smooth transition.
[v3] https://listman.redhat.com/archives/libvir-list/2021-April/msg00900.html
[v2] https://listman.redhat.com/archives/libvir-list/2021-April/msg00613.html
[v1] https://listman.redhat.com/archives/libvir-list/2021-April/msg00604.html
Andrea Bolognani (7):
docs: Use consistent vertical spacing
docs: Expand upon the contents of the -daemon package
spec: Merge -admin package into -daemon
spec: Move some files from -client to -daemon
spec: Move systemtap probes from -client to -libs
tools: Generate per-command bash completion script
spec: Drop -bash-completion package
docs/kbase/rpm-deployment.rst | 55 ++++---------------
libvirt.spec.in | 76 ++++++++++-----------------
tools/bash-completion/meson.build | 24 +++++----
tools/bash-completion/{vsh => vsh.in} | 7 ++-
4 files changed, 54 insertions(+), 108 deletions(-)
rename tools/bash-completion/{vsh => vsh.in} (91%)
--
2.26.3
3 years, 6 months
[libvirt PATCH 1/2] nodedev: fix potential leak of command
by Jonathon Jongsma
When returning early due to errors, cmd will be leaked. Use an autoptr
to handle these early returns without leaking memory.
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
src/node_device/node_device_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index b0cc63ed42..e565cc29ec 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -724,7 +724,7 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def,
char **errbuf)
{
g_autofree char *parent_addr = NULL;
- virCommand *cmd = NULL;
+ g_autoptr(virCommand) cmd = NULL;
const char *subcommand = virMdevctlCommandTypeToString(cmd_type);
g_autofree char *inbuf = NULL;
@@ -787,7 +787,7 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def,
virCommandSetErrorBuffer(cmd, errbuf);
- return cmd;
+ return g_steal_pointer(&cmd);
}
--
2.26.3
3 years, 6 months