[libvirt PATCH] qemu: fix release of virDomainObjPtr in SSH key APIs
by Daniel P. Berrangé
The qemuDomainObjFromDomain() API must be paired with
the virDomainObjEndAPI API. The qemuDomainAuthorizedSSHKeysGet
method simply did 'return -1' leaking a reference in two paths.
The qemuDomainAuthorizedSSHKeysSet method marked the object
as an autoptr while also have some code paths that will call
virDomainObjEndAPI, resulting in attempted double free.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_driver.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 027617deef..05e021cce4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20254,10 +20254,10 @@ qemuDomainAuthorizedSSHKeysGet(virDomainPtr dom,
return -1;
if (virDomainAuthorizedSshKeysGetEnsureACL(dom->conn, vm->def) < 0)
- return -1;
+ goto cleanup;
if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0)
- return -1;
+ goto cleanup;
if (!qemuDomainAgentAvailable(vm, true))
goto endagentjob;
@@ -20268,6 +20268,7 @@ qemuDomainAuthorizedSSHKeysGet(virDomainPtr dom,
endagentjob:
qemuDomainObjEndAgentJob(vm);
+ cleanup:
virDomainObjEndAPI(&vm);
return rv;
}
@@ -20281,7 +20282,7 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom,
unsigned int flags)
{
virQEMUDriverPtr driver = dom->conn->privateData;
- g_autoptr(virDomainObj) vm = NULL;
+ virDomainObjPtr vm = NULL;
qemuAgentPtr agent;
const bool append = flags & VIR_DOMAIN_AUTHORIZED_SSH_KEYS_SET_APPEND;
const bool remove = flags & VIR_DOMAIN_AUTHORIZED_SSH_KEYS_SET_REMOVE;
@@ -20294,10 +20295,10 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom,
return -1;
if (virDomainAuthorizedSshKeysSetEnsureACL(dom->conn, vm->def) < 0)
- return -1;
+ goto cleanup;
if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0)
- return -1;
+ goto cleanup;
if (!qemuDomainAgentAvailable(vm, true))
goto endagentjob;
@@ -20311,6 +20312,7 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom,
endagentjob:
qemuDomainObjEndAgentJob(vm);
+ cleanup:
virDomainObjEndAPI(&vm);
return rv;
}
--
2.29.2
3 years, 11 months
[PATCH] docs: formatdomain: Fix poll-control XML example
by Cole Robinson
Fixes: 3fc4412c6f5
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
Pushed as trivial
docs/formatdomain.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index af540391db..c738078b90 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -1766,7 +1766,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off.
<kvm>
<hidden state='on'/>
<hint-dedicated state='on'/>
- <poll-control='on'/>
+ <poll-control state='on'/>
</kvm>
<xen>
<e820_host state='on'/>
--
2.29.2
3 years, 11 months
[libvirt PATCH] docs: link to PCI docs from the kbase page
by Daniel P. Berrangé
While the PCI docs are linked from formatdomain.html, finding those
links is not straightforward. It is good for users to highlight them in
the kbase pages. The PCI docs are intentionally not moved to the kbase/
sub-directory in order to avoid breaking hyperlinks.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/kbase/index.rst | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/docs/kbase/index.rst b/docs/kbase/index.rst
index 1494be1e77..83b9bb7200 100644
--- a/docs/kbase/index.rst
+++ b/docs/kbase/index.rst
@@ -40,6 +40,12 @@ Usage
`KVM real time <kvm-realtime.html>`__
Run real time workloads in guests on a KVM hypervisor
+`PCI hotplug <../pci-hotplug.html>`__
+ Effectively usage of PCI hotplug
+
+`PCI topology <../pci-addresses.html>`__
+ Addressing schemes for PCI devices
+
Internals / Debugging
---------------------
--
2.29.2
3 years, 11 months
[libvirt PATCH] docs: use a relative link to the kbase page
by Daniel P. Berrangé
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/index.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/index.html.in b/docs/index.html.in
index f44e055174..bf164edb58 100644
--- a/docs/index.html.in
+++ b/docs/index.html.in
@@ -64,7 +64,7 @@
<dt><a href="https://wiki.libvirt.org">Wiki</a></dt>
<dd>Read further community contributed content</dd>
- <dt><a href="https://libvirt.org/kbase/index.html">Knowledge base</a></dt>
+ <dt><a href="kbase/index.html">Knowledge base</a></dt>
<dd>Learn more about libvirt through knowledge base</dd>
</dl>
</div>
--
2.29.2
3 years, 11 months
[PATCH 00/55] Hyper-V: code cleanup & prep for future changes
by Matt Coleman
This series of patches simplifies the code in several ways and makes a
few changes required by the next round of patches that I'll submit.
Simplifications:
* add a macro to cut down on repetitive SettingData code
* enable GLib auto-cleanup for hypervObject and several OpenWSMAN types
Changes:
* store the version in hypervPrivate, which will be used to handle
breaking changes in the Hyper-V API: despite 2012R2 and 2016+ all
using Hyper-V's "V2" API, backwards-incompatible changes were made in
2016
* add inheritance to the WMI generator to simplify handling of the
backwards-incompatible changes introduced in Hyper-V 2016
Matt Coleman (55):
hyperv: add a macro for retrieving setting data
hyperv: store the Hyper-V version when connecting
hyperv: add inheritance to the WMI generator
hyperv: store hypervPrivate in hypervObject
hyperv: enable use of g_autoptr for hypervObject
hyperv: enable use of g_autoptr for the rest of the CIM/WMI classes
hyperv: enable automatic cleanup for OpenWSMAN types
hyperv: use g_autoptr for Win32_OperatingSystem in hypervConnectOpen
hyperv: use g_autoptr for Win32_ComputerSystem in
hypervConnectGetHostname
hyperv: use g_autoptr for Msvm_ProcessorSettingData in
hypervConnectGetMaxVcpus
hyperv: use g_autoptr for WMI classes in hypervNodeGetInfo
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervConnectNumOfDomains
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervConnectListDomains
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervDomainLookupByID
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervDomainLookupByUUID
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervDomainLookupByName
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainResume
hyperv: use g_autoptr for WMI classes in hypervDomainShutdownFlags
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervDomainDestroyFlags
hyperv: use g_autoptr for WMI classes in hypervDomainGetMaxMemory
hyperv: use g_autoptr for WMI classes in hypervDomainSetMemoryProperty
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervRequestStateChange
hyperv: use g_autoptr for Win32_ComputerSystemProduct in
hypervLookupHostSystemBiosUuid
hyperv: use g_autoptr for Msvm_ResourceAllocationSettingData in
hypervDomainAttachPhysicalDisk
hyperv: use g_autoptr for WMI classes in hypervDomainAttachStorage
hyperv: use g_autoptr for Msvm_DiskDrive in
hypervDomainDefParsePhysicalDisk
hyperv: use g_autoptr for WMI classes in hypervDomainGetInfo
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainGetState
hyperv: use g_autoptr for WMI classes in hypervDomainSetVcpusFlags
hyperv: use g_autoptr for WMI classes in hypervDomainGetVcpusFlags
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervConnectListDefinedDomains
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervConnectNumOfDefinedDomains
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervDomainCreateWithFlags
hyperv: use g_autoptr for Msvm_VirtualSystemSettingData in
hypervDomainGetAutostart
hyperv: use g_autoptr for Msvm_VirtualSystemSettingData in
hypervDomainSetAutostart
hyperv: use g_autoptr for WMI classes in
hypervDomainGetSchedulerParametersFlags
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainIsActive
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervDomainManagedSave
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervDomainHasManagedSaveImage
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervDomainManagedSaveRemove
hyperv: use g_autoptr for Msvm_ComputerSystem in
hypervConnectListAllDomains
hyperv: use GLib auto-cleanup in hypervDomainSendKey
hyperv: use GLib auto-cleanup in hypervInvokeMethod
hyperv: use GLib auto-cleanup in
hypervInvokeMsvmComputerSystemRequestStateChange
hyperv: use GLib auto-cleanup in hypervMsvmVSMSAddResourceSettings and
hypervMsvmVSMSModifyResourceSettings
hyperv: use g_autoptr for
Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor in
hypervDomainGetVcpus
hyperv: use g_autoptr for Win32_OperatingSystem in
hypervNodeGetFreeMemory
hyperv: use GLib auto-cleanup in hypervDomainGetXMLDesc
hyperv: use g_autoptr for WMI classes in hypervDomainAttachDeviceFlags
hyperv: use GLib auto-cleanup in hypervSerializeEprParam
hyperv: use GLib auto-cleanup in hypervEnumAndPull
hyperv: use GLib auto-cleanup in hypervSerializeEmbeddedParam
hyperv: use GLib auto-cleanup in hypervCreateInvokeXmlDoc
hyperv: use g_auto for WsXmlDocH in hypervDomainAttachVirtualDisk
hyperv: use g_auto for WsXmlDocH in hypervDomainAttachCDROM
scripts/hyperv_wmi_generator.py | 16 +-
src/hyperv/hyperv_driver.c | 755 +++++++++++---------------------
src/hyperv/hyperv_private.h | 4 +-
src/hyperv/hyperv_wmi.c | 408 +++++++----------
src/hyperv/hyperv_wmi.h | 4 +-
src/hyperv/hyperv_wsman.h | 28 ++
6 files changed, 457 insertions(+), 758 deletions(-)
create mode 100644 src/hyperv/hyperv_wsman.h
--
2.30.0
3 years, 11 months
[PATCH 0/3] RFC: stop using netcf for the interface driver backend
by Laine Stump
This is a followup to my message in December suggesting that we
deprecate use of the netcf package:
https://www.redhat.com/archives/libvir-list/2020-December/msg00183.html
(or Message-Id: <4889202b-734c-4d0f-472c-d86894319878(a)redhat.com> for
those of you who keep a local archive)
Each of these patches takes a baby step in the direction of removing
netcf from libvirt:
1) makes it possible to explicitly disable netcf in a build without
uninstalling netcf-devel.
2) makes netcf=disabled the default for all normal builds
3) switches all RHEL/Fedora/CentOS rpm builds to disable netcf, and no
longer require that netcf and netcf-devel be installed.
I purposefully didn't include a patch to completely remove all traces
of netcf; we can leave it disabled for awhile before taking that step.
Much of the basic functionality provided by the netcf backend to the
interface driver is also provided by the udev backend which is used
when netcf isn't available.
Some differences:
1) the udev backend can't make any modifications to host interface
configuration. It is only useful for reading a list of host network
devices, and querying some basic status of those interfaces (*not*
the contents of configuration files, but how the interface is
currently setup)
2) With the netcf backend, "virsh iface-list --all" shows a list of
those interfaces that have an ifcfg-blah file in
/etc/sysconfig/network-scripts. With the udev backend, the same
command shows a list of all network devices currently on the host,
as provided by the udev function
udev_enumerate_add_match_subsystem(enumerate, "net")
(with some exceptions - see udeevGetDevices()). This means that, for
example, the bridge devices created by libvirt for virtual networks
(virbrX) will show in the list when using udev.
3) The udev backend doesn't fill in IP address info about the devices
in the output of "virsh iface-dumpxml" (netcf does).
4) The udev driver *does* go to the trouble of filling in the MTU of
every interface, even when it is the default value of 1500.
In the end, all the information it reports is correct (well, item (2)
is debatable - it depends on what you would use the info for), but it
is different, which is why I'm sending this as an RFC - I'd appreciate if
people can build and try running something like this script with
existing libvirt as well as with the patches applied:
http://people.redhat.com/lstump/ncfresults
and compare the before/after.
The real question is whether or not this difference really "makes a
difference" to anyone. My guess/hope is that the answer to this is
"no". As far as I know, there aren't any management applications that
use the virInterface API (even virt-manager has stopped) so it's
probably only humans using virsh that encounter it.
(If it's considered important, we could 1) filter out the bridge
devices used by libvirt virtual networks, and 2) copy the netcf code
that fills in IP address info. I don't want to spend time doing that
if nobody's going to use it anyway, though.)
Laine Stump (3):
build: support explicitly disabling netcf
build: make netcf=disabled the default
rpm: disable netcf for the interface driver on RHEL/Fedora/CentOS
libvirt.spec.in | 8 ++------
meson.build | 9 ++++++---
2 files changed, 8 insertions(+), 9 deletions(-)
--
2.29.2
3 years, 11 months
[libvirt PATCH v2 00/13] second part of cleanup storage source related code
by Pavel Hrdina
Pavel Hrdina (13):
src: add missing virstoragefile.h includes
virstoragefile: properly include virstoragefile.h header
virstoragefile: change virStorageSource->drv to void pointer
storage: move storage file sources to separate directory
util: move virStorageSourceFindByNodeName into qemu_domain
util: extract storage file probe code into virtstoragefileprobe.c
util: extract virStorageFile code into storage_source
util: move virStorageFileBackend code into storage_file
util: move virStorageFileProbe code into storage_file
util: move virStorageSource code into conf
util: move virStorageEncryption code into conf
virstoragefile: use virStorageFile prefix for all functions
storage_source: use virStorageSource prefix for all functions
po/POTFILES.in | 11 +-
src/conf/backup_conf.c | 2 +-
src/conf/checkpoint_conf.c | 2 +-
src/conf/domain_conf.c | 2 +-
src/conf/domain_conf.h | 6 +-
src/conf/meson.build | 2 +
src/conf/snapshot_conf.c | 2 +-
src/conf/storage_conf.c | 2 +-
src/conf/storage_conf.h | 4 +-
.../storage_encryption_conf.c} | 4 +-
.../storage_encryption_conf.h} | 2 +-
src/conf/storage_source_conf.c | 1350 +++++
src/conf/storage_source_conf.h | 537 ++
src/esx/esx_storage_backend_iscsi.c | 2 +-
src/esx/esx_storage_backend_vmfs.c | 2 +-
src/libvirt_private.syms | 189 +-
src/libxl/meson.build | 1 +
src/libxl/xen_xl.c | 2 +-
src/locking/lock_driver_lockd.c | 1 +
src/meson.build | 1 +
src/qemu/meson.build | 1 +
src/qemu/qemu_backup.c | 11 +-
src/qemu/qemu_block.c | 10 +-
src/qemu/qemu_blockjob.c | 2 +-
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_domain.c | 55 +-
src/qemu/qemu_driver.c | 69 +-
src/qemu/qemu_hotplug.c | 7 +-
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_process.c | 5 +-
src/qemu/qemu_snapshot.c | 24 +-
src/security/meson.build | 1 +
src/security/virt-aa-helper.c | 3 +-
src/storage/meson.build | 34 +-
src/storage/storage_backend.c | 2 +-
src/storage/storage_backend_gluster.c | 6 +-
src/storage/storage_util.c | 9 +-
src/storage_file/meson.build | 61 +
.../storage_file_backend.c} | 4 +-
.../storage_file_backend.h} | 6 +-
.../storage_file_fs.c | 23 +-
.../storage_file_fs.h | 0
.../storage_file_gluster.c | 34 +-
.../storage_file_gluster.h | 0
src/storage_file/storage_file_probe.c | 967 ++++
src/storage_file/storage_file_probe.h | 44 +
src/storage_file/storage_source.c | 2614 +++++++++
src/storage_file/storage_source.h | 148 +
src/util/meson.build | 2 -
src/util/virstoragefile.c | 4790 +----------------
src/util/virstoragefile.h | 554 +-
tests/meson.build | 4 +-
tests/qemublocktest.c | 1 +
tests/virstoragetest.c | 19 +-
54 files changed, 6045 insertions(+), 5593 deletions(-)
rename src/{util/virstorageencryption.c => conf/storage_encryption_conf.c} (99%)
rename src/{util/virstorageencryption.h => conf/storage_encryption_conf.h} (98%)
create mode 100644 src/conf/storage_source_conf.c
create mode 100644 src/conf/storage_source_conf.h
create mode 100644 src/storage_file/meson.build
rename src/{util/virstoragefilebackend.c => storage_file/storage_file_backend.c} (97%)
rename src/{util/virstoragefilebackend.h => storage_file/storage_file_backend.h} (93%)
rename src/{storage => storage_file}/storage_file_fs.c (90%)
rename src/{storage => storage_file}/storage_file_fs.h (100%)
rename src/{storage => storage_file}/storage_file_gluster.c (89%)
rename src/{storage => storage_file}/storage_file_gluster.h (100%)
create mode 100644 src/storage_file/storage_file_probe.c
create mode 100644 src/storage_file/storage_file_probe.h
create mode 100644 src/storage_file/storage_source.c
create mode 100644 src/storage_file/storage_source.h
--
2.29.2
3 years, 11 months
[PATCH] virsh: Fix XPATH in virshDomainDeviceAliasCompleter()
by Michal Privoznik
The way this completer works is that it dumps XML of specified
domain and then tries to look for @name attribute of <alias/>
element. However, the XPATH it uses is not correct which results
in no aliases returned by the completer.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-completer-domain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index 4a3459f12a..e773af6552 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -316,14 +316,14 @@ virshDomainDeviceAliasCompleter(vshControl *ctl,
if (virshDomainGetXML(ctl, cmd, domainXMLFlags, &xmldoc, &ctxt) < 0)
return NULL;
- naliases = virXPathNodeSet("./devices//alias/@name", ctxt, &aliases);
+ naliases = virXPathNodeSet("/domain/devices//alias[@name]", ctxt, &aliases);
if (naliases < 0)
return NULL;
tmp = g_new0(char *, naliases + 1);
for (i = 0; i < naliases; i++) {
- if (!(tmp[i] = virXMLNodeContentString(aliases[i])))
+ if (!(tmp[i] = virXMLPropString(aliases[i], "name")))
return NULL;
}
--
2.26.2
3 years, 11 months
[PATCH] virNetworkDHCPLeaseTimeDefParseXML: Output error when 'expiry' can't be parsed
by Peter Krempa
virStrToLong_ul doesn't report it's own error.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1918674
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/network_conf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 4f1115e103..ff7a56f4f4 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -418,8 +418,11 @@ virNetworkDHCPLeaseTimeDefParseXML(virNetworkDHCPLeaseTimeDefPtr *lease,
if (!(expirystr = virXMLPropString(node, "expiry")))
return 0;
- if (virStrToLong_ul(expirystr, NULL, 10, &expiry) < 0)
+ if (virStrToLong_ul(expirystr, NULL, 10, &expiry) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("failed to parse expiry value '%s'"), expirystr);
return -1;
+ }
if ((unitstr = virXMLPropString(node, "unit"))) {
if ((unit = virNetworkDHCPLeaseTimeUnitTypeFromString(unitstr)) < 0) {
--
2.29.2
3 years, 11 months
[libvirt PATCH 0/8] Remove space-padded alignment from public headers
by Jonathon Jongsma
Erik Skultety suggested posting a separate series removing the space-padded
alignment of function declarations in the public headers.
Jonathon Jongsma (8):
libvirt-nodedev.h: remove space-padded alignment
libvirt-domain.h: remove space-padded alignment
libvirt-host.h: remove space-padded alignment
libvirt-interface.h: remove space-padded alignment
libvirt-network.h: remove space-padded alignment
libvirt-nwfilter.h: remove space-padded alignment
libvirt-secret.h: remove space-padded alignment
libvirt-storage.h: remove space-padded alignment
include/libvirt/libvirt-domain.h | 584 ++++++++++++++--------------
include/libvirt/libvirt-host.h | 100 ++---
include/libvirt/libvirt-interface.h | 72 ++--
include/libvirt/libvirt-network.h | 92 ++---
include/libvirt/libvirt-nodedev.h | 79 ++--
include/libvirt/libvirt-nwfilter.h | 80 ++--
include/libvirt/libvirt-secret.h | 72 ++--
include/libvirt/libvirt-storage.h | 222 +++++------
8 files changed, 652 insertions(+), 649 deletions(-)
--
2.26.2
3 years, 11 months