[PATCH 0/3] interface define: add support for validation against schema
by Kristina Hanicova
This is just the first series of patches of many more. I will send them
soon, I just wanted to know if I am on the right path as they will
follow the same pattern.
Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1972586
Kristina Hanicova (3):
conf: propagate xmlDocPtr and flags into virInterfaceDefParseXML()
virsh: add support for '--validate' option in define interface
interface_conf: add validation against schema in define
include/libvirt/libvirt-interface.h | 4 +++
src/conf/interface_conf.c | 38 ++++++++++++++++++-------
src/conf/interface_conf.h | 6 ++--
src/conf/virinterfaceobj.c | 2 +-
src/interface/interface_backend_netcf.c | 6 ++--
src/test/test_driver.c | 4 +--
tests/interfacexml2xmltest.c | 2 +-
tools/virsh-interface.c | 10 ++++++-
8 files changed, 51 insertions(+), 21 deletions(-)
--
2.31.1
3 years, 4 months
[PATCH] src: stop checking virIdentityNew return value
by Daniel P. Berrangé
This method will always succeed.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/remote/remote_daemon_dispatch.c | 5 +----
src/rpc/virnetserverclient.c | 5 +----
src/util/viridentity.c | 5 +----
3 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 69d0a015ba..0e38b314a2 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -2192,7 +2192,7 @@ remoteDispatchConnectSetIdentity(virNetServer *server G_GNUC_UNUSED,
int nparams = 0;
int rv = -1;
virConnectPtr conn = remoteGetHypervisorConn(client);
- g_autoptr(virIdentity) ident = NULL;
+ g_autoptr(virIdentity) ident = virIdentityNew();
if (!conn)
goto cleanup;
@@ -2209,9 +2209,6 @@ remoteDispatchConnectSetIdentity(virNetServer *server G_GNUC_UNUSED,
if (virConnectSetIdentityEnsureACL(conn) < 0)
goto cleanup;
- if (!(ident = virIdentityNew()))
- goto cleanup;
-
if (virIdentitySetParameters(ident, params, nparams) < 0)
goto cleanup;
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 236702ced6..7050430e17 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -747,10 +747,7 @@ virNetServerClientCreateIdentity(virNetServerClient *client)
g_autofree char *username = NULL;
g_autofree char *groupname = NULL;
g_autofree char *seccontext = NULL;
- g_autoptr(virIdentity) ret = NULL;
-
- if (!(ret = virIdentityNew()))
- return NULL;
+ g_autoptr(virIdentity) ret = virIdentityNew();
if (client->sock && virNetSocketIsLocal(client->sock)) {
gid_t gid;
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
index c18326c8cb..e36e54ae4b 100644
--- a/src/util/viridentity.c
+++ b/src/util/viridentity.c
@@ -313,15 +313,12 @@ virIdentity *virIdentityGetSystem(void)
g_autofree char *username = NULL;
g_autofree char *groupname = NULL;
unsigned long long startTime;
- g_autoptr(virIdentity) ret = NULL;
+ g_autoptr(virIdentity) ret = virIdentityNew();
#if WITH_SELINUX
char *con;
#endif
g_autofree char *token = NULL;
- if (!(ret = virIdentityNew()))
- return NULL;
-
if (virIdentitySetProcessID(ret, getpid()) < 0)
return NULL;
--
2.31.1
3 years, 4 months
[PATCH 00/13] Clean up string list freeing
by Peter Krempa
Switch remaining users of virStringListFreeCount to g_auto(GStrv) and
clean up some usage of string lists.
Depends on the refactor of the virtual function code I've posted
earlier.
Pipeline:
https://gitlab.com/pipo.sk/libvirt/-/pipelines/348627403
Peter Krempa (13):
testQemuAgentSSHKeys: Refactor cleanup
remote: dispatch: Don't use virStringListFreeCount for NULL terminated
lists
qemu: firmware: Store machine types as a NULL-terminated string list
qemu: domain: Store passthrough environment variables in a struct
qemu: domain: Store capability overrides in NULL-terminated string
list
qemu: domain: Store passthrough arguments in NULL-terminated string
list
network: bridge: Store dnsmasq passthrough options in NULL-terminated
string list
qemuNamespacePrepareOneItem: Restructure code to avoid temporary
variables
qemuNamespacePrepareOneItem: Don't pass count of elements
qemuNamespaceMknodPaths: Remove 'ndevMountsPath'
qemuDomainUnshareNamespace: Use automatic memory clearing for string
lists
lxcContainerSetReadOnly: Refactor cleanup handling
util: virstring: Remove unused virStringListFreeCount
src/libvirt_private.syms | 1 -
src/lxc/lxc_container.c | 27 ++++-----
src/network/bridge_driver.c | 23 ++++----
src/qemu/qemu_command.c | 9 +--
src/qemu/qemu_domain.c | 91 +++++++++++++++--------------
src/qemu/qemu_domain.h | 12 ++--
src/qemu/qemu_firmware.c | 4 +-
src/qemu/qemu_namespace.c | 46 ++++++---------
src/qemu/qemu_process.c | 13 ++---
src/remote/remote_daemon_dispatch.c | 8 +--
src/util/virstring.c | 23 --------
src/util/virstring.h | 3 -
tests/qemuagenttest.c | 54 ++++++++---------
13 files changed, 135 insertions(+), 179 deletions(-)
--
2.31.1
3 years, 4 months
[PATCH 0/6] util: Refactor fetching of virtual function list
by Peter Krempa
Note that this applies on top of the 'VIR_APPEND_ELEMENT' refactor I've
sent earlier.
Pipeline:
https://gitlab.com/pipo.sk/libvirt/-/pipelines/348524810
Peter Krempa (6):
virNetDevGetVirtualFunctions: Remove 'max_vfs' argument
virPCIGetVirtualFunctions: Simplify cleanup of returned data
virPCIGetVirtualFunctionIndex: Refactor cleanup
virPCIGetNetName: Make 'physPortID' argument const
virPCIGetVirtualFunctions: Fetch also network interface name if needed
virNetDevGetVirtualFunctions: Directly return
virPCIVirtualFunctionList
src/conf/node_device_conf.c | 16 +++--
src/libvirt_private.syms | 2 +
src/network/bridge_driver.c | 23 ++-----
src/util/virnetdev.c | 65 +++---------------
src/util/virnetdev.h | 8 +--
src/util/virpci.c | 127 +++++++++++++++++++++---------------
src/util/virpci.h | 24 +++++--
7 files changed, 122 insertions(+), 143 deletions(-)
--
2.31.1
3 years, 4 months
[PATCH 0/7] vmx: Support super wide SCSI bus
by Michal Privoznik
As of vSphere 6.7 there can be up to 64 units on a SCSI bus.
Honestly, I'm not a big fan of 5/7 but we want to support three
different values and one of them doesn't depend on the driver that's
assigning the disk address, but at a runtime information. Thus using
xmlopt is not good enough. Any clever idea is very welcome.
Michal Prívozník (7):
vmx: Fill virtualHW.version to ESX version mapping
vmx2xmltest: Add a test case
vmx: Rework disk def allocation
vmx: Drop needless check in virVMXParseDisk()
conf: Store SCSI bus length in virDomainDef
vmx: Support super wide SCSI bus
DO NOT MERGE
src/bhyve/bhyve_parse_command.c | 2 +-
src/conf/domain_conf.c | 33 +++---
src/conf/domain_conf.h | 10 +-
src/hyperv/hyperv_driver.c | 4 +-
src/libxl/libxl_driver.c | 2 +-
src/libxl/xen_xl.c | 2 +-
src/libxl/xen_xm.c | 2 +-
src/lxc/lxc_native.c | 2 +-
src/openvz/openvz_conf.c | 2 +-
src/qemu/qemu_process.c | 2 +-
src/vbox/vbox_common.c | 8 +-
src/vmx/vmx.c | 108 +++++++++---------
src/vz/vz_sdk.c | 2 +-
tests/genericxml2xmltest.c | 2 +-
tests/openvzutilstest.c | 2 +-
tests/qemublocktest.c | 2 +-
tests/qemumonitortestutils.c | 2 +-
tests/securityselinuxtest.c | 2 +-
.../vmx2xml-esx-in-the-wild-11.vmx | 97 ++++++++++++++++
.../vmx2xml-esx-in-the-wild-11.xml | 43 +++++++
tests/vmx2xmltest.c | 1 +
21 files changed, 239 insertions(+), 91 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-11.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-11.xml
--
2.31.1
3 years, 4 months
[libvirt PATCH 0/7] Fix some mutex related issues
by Tim Wiederhake
The calls to pthread_mutex_{lock,unlock,destroy} in "virthread.c"
ignore the return value of these functions.
This series fixes all "double unlock mutex" and "destroy locked mutex"
issues I came across and adds checks to the calls to pthread_mutex_*,
so no new issues of this type are introduced.
Patches 1, 2, 3, and 4 fix the issues, patches 5, 6, and 7 add the
checks.
See https://gitlab.com/twiederh/libvirt/-/pipelines/348505233 and
https://gitlab.com/twiederh/libvirt/-/pipelines/348505233 (only
patches 5, 6, and 7).
Regards,
Tim
Tim Wiederhake (7):
tests: qemuMonitorTestFree: Unlock virDomainObj before freeing
qemusecuritytest: Unlock virDomainObj before disposal
qemuxml2argvtest: Unlock virDomainObj before disposal
qemuhotplugtest: Lock reused virDomainObj
Meson: Define "DYNAMIC_ANALYSIS" if built with sanitizers enabled
virMutex*: Warn on error
virMutex*: Fail loudly
meson.build | 4 ++++
src/util/virthread.c | 24 +++++++++++++++++++++---
tests/qemuhotplugtest.c | 1 +
tests/qemumonitortestutils.c | 2 +-
tests/qemusecuritytest.c | 3 ++-
tests/qemuxml2argvtest.c | 12 +++++++-----
6 files changed, 36 insertions(+), 10 deletions(-)
--
2.31.1
3 years, 4 months
[PATCH 00/23] Remove return value from VIR_APPEND_ELEMENT and cleanups
by Peter Krempa
Since this touches all kind of conditionally compiled code you can find
the pipeline build results here:
https://gitlab.com/pipo.sk/libvirt/-/pipelines/347734973
Peter Krempa (23):
virInsertElementsN: Rename 'add' argument
virInsertElementsN: Split out actual insertion code
util: alloc: Introduce virAppendElement helper
util: alloc: Reimplement VIR_APPEND_ELEMENT_(COPY_)INPLACE using
virAppendElement
util: alloc: Reimplement VIR_APPEND_ELEMENT_COPY using
virAppendElement
util: alloc: Reimplement VIR_APPEND_ELEMENT_QUIET using
virAppendElement
util: alloc: Reimplement VIR_APPEND_ELEMENT using virAppendElement
util: alloc: Completely replace VIR_APPEND_ELEMENT_QUIET by
VIR_APPEND_ELEMENT
prlsdkAddDomainVideoInfoCt: Remove pointless cleanup section
xenParseXMDisk: Use automatic memory clearing and remove 'ret'
variable
qemuDomainUSBAddressAddHubs: Refactor cleanup
virSecuritySELinuxContextListAppend: Remove unreachable cleanup
qemuDomainAttachDeviceConfig: Remove pointless assignment
virNWFilterRuleDefToRuleInst: Remove pointless assignment
virObjectEventCallbackListAddID: Remove pointless cleanup of 'cb'
virNWFilterRuleDefToRuleInst: Restructure code to avoid cleanup
virNWFilterIncludeDefToRuleInst: Refactor cleanup
qemuProcessSetupHotpluggableVcpus: Use automatic memory freeing
virNetServerGetClients: Remove pointless cleanup
lxcNetworkParseDataIPs: Automatically free string list
virStorageBackendLogicalParseVolExtents: Declare one variable per line
virStorageBackendLogicalParseVolExtents: Move 'extents' inside the
loop
virStorageBackendLogicalParseVolExtents: Remove 'cleanup' and 'ret'
src/bhyve/bhyve_parse_command.c | 18 +--
src/conf/capabilities.c | 11 +-
src/conf/domain_conf.c | 95 ++++++----------
src/conf/network_conf.c | 9 +-
src/conf/node_device_conf.c | 24 ++--
src/conf/nwfilter_conf.c | 12 +-
src/conf/object_event.c | 9 +-
src/conf/storage_conf.c | 6 +-
src/conf/virdomainobjlist.c | 6 +-
src/conf/virnwfilterobj.c | 8 +-
src/cpu/cpu_arm.c | 6 +-
src/cpu/cpu_ppc64.c | 6 +-
src/cpu/cpu_x86.c | 21 ++--
src/esx/esx_driver.c | 7 +-
src/esx/esx_network_driver.c | 3 +-
src/hyperv/hyperv_driver.c | 22 +---
src/hyperv/hyperv_network_driver.c | 3 +-
src/libvirt_private.syms | 1 +
src/libxl/xen_common.c | 17 +--
src/libxl/xen_xl.c | 21 +---
src/libxl/xen_xm.c | 21 +---
src/logging/log_handler.c | 6 +-
src/lxc/lxc_container.c | 5 +-
src/lxc/lxc_controller.c | 3 +-
src/lxc/lxc_native.c | 12 +-
src/network/bridge_driver.c | 4 +-
src/node_device/node_device_driver.c | 3 +-
src/nwfilter/nwfilter_ebiptables_driver.c | 3 +-
src/nwfilter/nwfilter_gentech_driver.c | 57 ++++------
src/openvz/openvz_conf.c | 8 +-
src/qemu/qemu_block.c | 9 +-
src/qemu/qemu_command.c | 14 +--
src/qemu/qemu_domain.c | 6 +-
src/qemu/qemu_domain_address.c | 9 +-
src/qemu/qemu_driver.c | 17 +--
src/qemu/qemu_firmware.c | 3 +-
src/qemu/qemu_hotplug.c | 6 +-
src/qemu/qemu_monitor_json.c | 3 +-
src/qemu/qemu_namespace.c | 5 +-
src/qemu/qemu_process.c | 17 +--
src/remote/remote_daemon_dispatch.c | 56 ++++------
src/rpc/virnetdaemon.c | 4 +-
src/rpc/virnetmessage.c | 3 +-
src/rpc/virnetserver.c | 12 +-
src/security/security_dac.c | 3 +-
src/security/security_manager.c | 5 +-
src/security/security_selinux.c | 15 +--
src/storage/storage_backend_logical.c | 38 +++----
src/storage/storage_backend_rbd.c | 3 +-
src/util/viralloc.c | 129 +++++++++++++++++-----
src/util/viralloc.h | 48 ++++----
src/util/virfirewall.c | 8 +-
src/util/viriscsi.c | 3 +-
src/util/virjson.c | 5 +-
src/util/virlog.c | 10 +-
src/util/virmdev.c | 7 +-
src/util/virnetdev.c | 3 +-
src/util/virnvme.c | 7 +-
src/util/virpci.c | 13 +--
src/util/virprocess.c | 3 +-
src/util/virresctrl.c | 6 +-
src/util/virscsi.c | 7 +-
src/util/virscsivhost.c | 4 +-
src/util/virusb.c | 4 +-
src/util/virutil.c | 9 +-
src/vbox/vbox_common.c | 13 +--
src/vmx/vmx.c | 3 +-
src/vz/vz_sdk.c | 32 ++----
tests/nwfilterxml2firewalltest.c | 13 +--
tests/qemumonitortestutils.c | 11 +-
tests/testutils.c | 10 +-
tests/virfilewrapper.c | 9 +-
tests/virpcimock.c | 10 +-
tools/virsh-domain.c | 3 +-
tools/vsh-table.c | 9 +-
75 files changed, 404 insertions(+), 630 deletions(-)
--
2.31.1
3 years, 4 months
[libvirt PATCH v2 0/5] add support for Fibre Channel VMID
by Pavel Hrdina
changes in v2:
- refactor of resource parsing and formatting code
- use <fibrechannel vmid=''/> element
- use stat() directly
- report only single system error
Pavel Hrdina (5):
vircgroup: introduce virCgroupGetInode function
conf: refactor virDomainResourceDefParse
conf: refactor virDomainResourceDefFormat
conf: introduce support for Fibre Channel VMID
qemu: implement support for Fibre Channel VMID
docs/formatdomain.rst | 21 ++++++++++
docs/schemas/domaincommon.rng | 21 ++++++++--
src/conf/domain_conf.c | 42 +++++++++++--------
src/conf/domain_conf.h | 1 +
src/conf/domain_validate.c | 19 +++++++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_cgroup.c | 27 ++++++++++++
src/util/vircgroup.c | 31 ++++++++++++++
src/util/vircgroup.h | 2 +
.../fibrechannel-vmid.xml | 21 ++++++++++
tests/genericxml2xmltest.c | 2 +
11 files changed, 167 insertions(+), 21 deletions(-)
create mode 100644 tests/genericxml2xmlindata/fibrechannel-vmid.xml
--
2.31.1
3 years, 4 months
[PATCH] tests: Don't leak cpu defs
by Michal Privoznik
There are cpu definitions that are allocated in
qemuTestDriverInit() but are missing corresponding
virCPUDefFree() call in qemuTestDriverFree(). It's safe to call
the free function because the definitions contain a refcounter
and thus even if they were still in use the refcounter would be
just decreased.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/testutilsqemu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index fab676c070..9a0666724a 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -332,6 +332,11 @@ void qemuTestDriverFree(virQEMUDriver *driver)
virObjectUnref(driver->caps);
virObjectUnref(driver->config);
virObjectUnref(driver->securityManager);
+
+ virCPUDefFree(cpuDefault);
+ virCPUDefFree(cpuHaswell);
+ virCPUDefFree(cpuPower8);
+ virCPUDefFree(cpuPower9);
}
int qemuTestCapsCacheInsert(virFileCache *cache,
--
2.31.1
3 years, 4 months
[PATCH] rpm: add conditionals around post scripts
by Daniel P. Berrangé
The hypervisor drivers can be disabled in certain build scenarios, so
their corresponding post scripts need to match.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
libvirt.spec.in | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index a162bc333d..011f5dd49e 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1458,6 +1458,7 @@ fi
%libvirt_daemon_perform_restart virtstoraged
+%if %{with_qemu}
%post daemon-driver-qemu
%if %{with_modular_daemons}
%libvirt_daemon_systemd_post virtqemud
@@ -1469,8 +1470,10 @@ fi
%posttrans daemon-driver-qemu
%libvirt_daemon_perform_restart virtqemud
+%endif
+%if %{with_lxc}
%post daemon-driver-lxc
%if %{with_modular_daemons}
%libvirt_daemon_systemd_post virtlxcd
@@ -1482,8 +1485,10 @@ fi
%posttrans daemon-driver-lxc
%libvirt_daemon_perform_restart virtlxcd
+%endif
+%if %{with_vbox}
%post daemon-driver-vbox
%if %{with_modular_daemons}
%libvirt_daemon_systemd_post virtvboxd
@@ -1495,8 +1500,10 @@ fi
%posttrans daemon-driver-vbox
%libvirt_daemon_perform_restart virtvboxd
+%endif
+%if %{with_libxl}
%post daemon-driver-libxl
%if %{with_modular_daemons}
%libvirt_daemon_systemd_post virtxend
@@ -1508,6 +1515,7 @@ fi
%posttrans daemon-driver-libxl
%libvirt_daemon_perform_restart virtxend
+%endif
%post daemon-config-network
--
2.31.1
3 years, 4 months