[PATCH 08/10] remote_driver: Move URI re-generation into a function

2023-02-06 Thread Michal Privoznik
that it can be re-used. Signed-off-by: Michal Privoznik --- src/remote/remote_driver.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index c41d5b414f..7e1a31a5a0 100644 --- a/src/remote

[PATCH 05/10] src: Unify URI params parsing

2023-02-06 Thread Michal Privoznik
ctOpen() does accept both. Signed-off-by: Michal Privoznik --- src/admin/libvirt-admin.c | 15 +++--- src/esx/esx_util.c| 96 +++ src/hyperv/hyperv_util.c | 30 ++-- src/qemu/qemu_migration.c | 21 - src/util/virauth.c| 12 ++--

[PATCH 02/10] Drop checks for virURIFormat() retval

2023-02-06 Thread Michal Privoznik
The virURIFormat() function either returns a string, or aborts (on OOM). There's no way this function can return NULL (as of v7.2.0-rc1~277). Therefore, it doesn't make sense to check its retval against NULL. Signed-off-by: Michal Privoznik --- src/admin/libvirt-admin.c | 6

[PATCH 01/10] viruri: Search params case insensitively

2023-02-06 Thread Michal Privoznik
of STREQ() at two places: virURIGetParam() and virURICheckUnixSocket(). Signed-off-by: Michal Privoznik --- src/util/viruri.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/viruri.c b/src/util/viruri.c index 88bb0cc1f8..53f85ed705 100644 --- a/src/util/viruri.c

[PATCH 00/10] remote: Pass 'mode' and 'socket' URI parameters to virt-ssh-helper

2023-02-06 Thread Michal Privoznik
The first couple of patches are cleanups, mostly. The last 5 patches are the important ones. Now, the fix I went with in the 10/10 is to format URI anew, just for the virt-ssh-helper's sake. I did not want to touch @name as it's passed to sub-daemon's .open() method. If desired, I can change the

[PATCH 2/5] domain_conf: Rewrite virDomainChrSourceModeTypeFromString() using VIR_ENUM_IMPL()

2023-02-01 Thread Michal Privoznik
In domain_conf.c there's virDomainChrSourceModeTypeFromString() which is open coded. Let's rewrite it using VIR_ENUM_DECL() + VIR_ENUM_IMPL() combo. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 41 ++--- 1 file changed, 18 insertions(+), 23

[PATCH 4/5] conf: Format and parse private data for virDomainNetDef

2023-02-01 Thread Michal Privoznik
and formatting privateData. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 51 ++ src/conf/domain_conf.h | 7 ++ 2 files changed, 58 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4920f04bd0..6e33a4472f 100644

[PATCH 0/5] qemu: Don't remove macvtaps on failed start

2023-02-01 Thread Michal Privoznik
See 5/5 for explanation. Michal Prívozník (5): domain_conf: Move virDomainNetVhostuserMode enum declaration domain_conf: Rewrite virDomainChrSourceModeTypeFromString() using VIR_ENUM_IMPL() virnetdevmacvlan: Drop G_GNUC_WARN_UNUSED_RESULT annotation for

[PATCH 1/5] domain_conf: Move virDomainNetVhostuserMode enum declaration

2023-02-01 Thread Michal Privoznik
While it's true that the virDomainNetVhostuserMode enum is used solely in virDomainNetDefParseXML(), its placement just above the function is rather unfortunate. Let's put it at the beginning of the file with the rest of the enum declarations/implementations. Signed-off-by: Michal Privoznik

[PATCH 5/5] qemu: Don't remove macvtaps on failed start

2023-02-01 Thread Michal Privoznik
variable), or not needed (qemuDomainRemoveNetDevice() - we're removing an interface that was already attached to QEMU). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2166235 Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c| 27 +++ src/qemu/qemu_domain.h

[PATCH 3/5] virnetdevmacvlan: Drop G_GNUC_WARN_UNUSED_RESULT annotation for virNetDevMacVLanDeleteWithVPortProfile()

2023-02-01 Thread Michal Privoznik
Every single caller of the virNetDevMacVLanDeleteWithVPortProfile() function is calling it wrapped inside of ignore_value() macro. This is because the function is annotated as G_GNUC_WARN_UNUSED_RESULT. This makes no sense. Drop the annotation and the macro envelope. Signed-off-by: Michal

[PATCH 7/7] virDomainNetDefFormat: Modernize formatting

2023-01-31 Thread Michal Privoznik
The child element of is formatted the old way. Switch to virXMLFormatElement(). Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b991a01af3..1cf2bf84bc

[PATCH 2/7] virDomainNetDefFormat: Rename @attrBuf to @targetAttrBuf

2023-01-31 Thread Michal Privoznik
The @attrBuf variable in virDomainNetDefFormat() is named too broadly. It holds attribute buffer to the element. Rename it to @targetAttrBuf then. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/conf

[PATCH 4/7] virDomainNetDefFormat: Modernize formatting

2023-01-31 Thread Michal Privoznik
The child element of is formatted the old way. Switch to virXMLFormatElement(). Since this element is used in LXC driver, this part of the function is tested by lxcxml2xmltest (specifically lxc-ethernet* test cases). Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 13

[PATCH 3/7] virDomainNetDefFormat: Modernize formatting

2023-01-31 Thread Michal Privoznik
The child element of is formatted the old way. Switch to virXMLFormatElement(). Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 10 +- tests/qemuxml2argvdata/net-mtu.xml | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/conf

[PATCH 5/7] virDomainNetDefFormat: Modernize formatting

2023-01-31 Thread Michal Privoznik
The child element of is formatted the old way. Switch to virXMLFormatElement(). Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 103 - 1 file changed, 30 insertions(+), 73 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf

[PATCH 6/7] virDomainNetDefFormat: Simplify @sourceAttrBuf handling for some types of VIR_DOMAIN_NET

2023-01-31 Thread Michal Privoznik
For VIR_DOMAIN_NET_TYPE_{SERVER,CLIENT,MCAST,UDP} we need to put (optionally) 'address' attribute and 'port' attributes of element. But the way we currently do that is particularly verbose. It can be shortened using virBufferEscapeString(). Signed-off-by: Michal Privoznik --- src/conf

[PATCH 1/7] qemuxml2xmloutdata: Turn net-mtu.xml into a symlink

2023-01-31 Thread Michal Privoznik
There's nothing specific about net-mtu test. In fact, if device addresses are filled in (and some elements reordered), we get the same XML. Make those changes to the input XML and turn the output XML to be a symlink. Signed-off-by: Michal Privoznik --- tests/qemuxml2argvdata/net-mtu.xml | 23

[PATCH 0/7] virDomainNetDefFormat: Modernize XML formatting

2023-01-31 Thread Michal Privoznik
A bit. After these, the function is still long and could be broken into smaller ones, but let's leave that as an exercise for future us. Michal Prívozník (7): qemuxml2xmloutdata: Turn net-mtu.xml into a symlink virDomainNetDefFormat: Rename @attrBuf to @targetAttrBuf virDomainNetDefFormat:

[PATCH] virsh: Make domif-setlink work more than once

2023-01-30 Thread Michal Privoznik
irt/libvirt/-/issues/426 Fixes: e575bf082ed4889280be07c986375f1ca15bb7ee Signed-off-by: Michal Privoznik --- tools/virsh-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 6b431bd1e5..59b2b3ce60 100644 --- a/tools/virsh-

[PATCH 2/3] qemuExtTPMStop: Restore TPM state label more often

2023-01-27 Thread Michal Privoznik
reason than migration, we want to restore the seclabels. The correct condition is: skip restoring the state on outgoing migration AND shared filesystem. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2161557 Signed-off-by: Michal Privoznik --- src/qemu/qemu_tpm.c | 2 +- 1 file changed, 1

[PATCH 1/3] qemuProcessStop: Fix detection of outgoing migration for external devices

2023-01-27 Thread Michal Privoznik
to true if asyncJob is anything but VIR_ASYNC_JOB_MIGRATION_IN. Well, we have a specific job for outgoing migration (VIR_ASYNC_JOB_MIGRATION_OUT) and thus we should check for that. Signed-off-by: Michal Privoznik --- src/qemu/qemu_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 0/3] qemu: Fix setting TPM state seclabels wrt save/restore

2023-01-27 Thread Michal Privoznik
*** BLURB HERE *** Michal Prívozník (3): qemuProcessStop: Fix detection of outgoing migration for external devices qemuExtTPMStop: Restore TPM state label more often qemuProcessLaunch: Tighten rules for external devices wrt incoming migration src/qemu/qemu_process.c | 11

[PATCH 3/3] qemuProcessLaunch: Tighten rules for external devices wrt incoming migration

2023-01-27 Thread Michal Privoznik
the machine restored seclabels. Signed-off-by: Michal Privoznik --- src/qemu/qemu_process.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6718915293..f9789650bc 100644 --- a/src/qemu/qemu_process.c +++ b/src

[PATCH] rpc: Use struct zero initializer for args

2023-01-26 Thread Michal Privoznik
In a recent commit of v9.0.0-104-g0211e430a8 I've turned all args vars in src/remote/remote_driver.c to be initialized wit {0}. What I've missed was the generated code. Do what we've done in v9.0.0-13-g1c656836e3 and init also args, not just ret. Signed-off-by: Michal Privoznik --- src/rpc

[PATCH] remote: Initialize args variable

2023-01-26 Thread Michal Privoznik
. Signed-off-by: Michal Privoznik --- src/remote/remote_driver.c | 178 ++--- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 7f84050f70..9f3a9520e4 100644 --- a/src/remote/remote_driver.c

[PATCH] qemu_domain: Don't unref NULL hash table in qemuDomainRefreshStatsSchema()

2023-01-26 Thread Michal Privoznik
The g_hash_table_unref() function does not accept NULL. Passing NULL results in a glib warning being triggered. Check whether the hash table is not NULL and unref it only then. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion

[PATCH v2] vbox: Fix starting domains

2023-01-23 Thread Michal Privoznik
I make us fallback onto DISPLAY=:0 when no other configuration is found then I'm able to start my guests just fine. Signed-off-by: Michal Privoznik --- I've experimented with introducing an enum for frontend since it can be one of gui, sdl, vrdp. But it turned out to be a huge mess and not worth t

[PATCH 0/2] qemu_interface: Fix managed='no' case when creating an ethernet interface

2023-01-23 Thread Michal Privoznik
*** BLURB HERE *** Michal Prívozník (2): virnetdevtap: Clarify virNetDevTapCreate() behavior wrt VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING qemu_interface: Fix managed='no' case when creating an ethernet interface src/qemu/qemu_interface.c | 5 +++-- src/util/virnetdevtap.c | 2 +- 2

[PATCH 2/2] qemu_interface: Fix managed='no' case when creating an ethernet interface

2023-01-23 Thread Michal Privoznik
of VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag into managed='yes' branch instead of managed='no' branch in qemuInterfaceEthernetConnect(). Move the setting of the flag into the correct branch. Fixes: a2ae3d299cf9c5ada8aa42ec4271748eb479dc27 Signed-off-by: Michal Privoznik --- src/qemu/qemu_interface.c | 5 +++-- 1 file changed

[PATCH 1/2] virnetdevtap: Clarify virNetDevTapCreate() behavior wrt VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING

2023-01-23 Thread Michal Privoznik
passed as: * VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING * - The device creation fails if @ifname already exists Fortunately, the function is implemented so that it follows the expected behavior (i.e. the former flag documentation). Fix the function documentation then. Signed-off-by: Michal Privoznik --- sr

[PATCH 00/15] vbox: Add support for version 7.0 SDK and drop old

2023-01-23 Thread Michal Privoznik
For full experience you'll need to apply these on top of: https://listman.redhat.com/archives/libvir-list/2023-January/237248.html Michal Prívozník (15): vbox: Drop misleading G_GNUC_UNUSED annotation vbox: Drop @mediaChangeOnly from vboxDomainAttachDeviceImpl() vbox: Drop @iid from

[PATCH 1/8] vbox: Introduce VBOX_QUERY_INTERFACE()

2023-01-23 Thread Michal Privoznik
() and Release(). Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.h| 3 +++ src/vbox/vbox_tmpl.c | 6 ++ src/vbox/vbox_uniformed_api.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h index 1fb922aaf0..38afdfddfa

[PATCH 4/8] vbox: Introduce vboxUniformedPFN::ClearException()

2023-01-23 Thread Michal Privoznik
The ClearException() method clears the latest exception inside of VirtualBox. This needed because obtaining an exception via GetException() does not clear it. Signed-off-by: Michal Privoznik --- src/vbox/vbox_tmpl.c | 6 ++ src/vbox/vbox_uniformed_api.h | 1 + 2 files changed, 7

[PATCH 08/15] vbox: Drop UIUSBCommon::GetEnabled()

2023-01-23 Thread Michal Privoznik
The UIUSBCommon::GetEnabled() function is not needed really, as it sets a boolean to true and always succeeds. We can live without the function. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c| 6 -- src/vbox/vbox_tmpl.c | 8 src/vbox

[PATCH 1/2] vbox: Fix memleak in _virtualboxCreateMachine()

2023-01-23 Thread Michal Privoznik
==by 0x4AE28AC: virNetServerProcessMsg (virnetserver.c:135) ==12481==by 0x4AE2972: virNetServerHandleJob (virnetserver.c:155) ==12481==by 0x49BC275: virThreadPoolWorker (virthreadpool.c:164) Signed-off-by: Michal Privoznik --- src/vbox/vbox_tmpl.c | 1 + 1 file changed, 1 insertion

[PATCH 2/2] vbox: Fix starting domains

2023-01-23 Thread Michal Privoznik
I make us fallback onto DISPLAY=:0 when no other configuration is found then I'm able to start my guests just fine. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_comm

[PATCH 02/15] vbox: Drop @mediaChangeOnly from vboxDomainAttachDeviceImpl()

2023-01-23 Thread Michal Privoznik
The @mediaChangeOnly argument of vboxDomainAttachDeviceImpl() function is unused. Drop it. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 939f9e8fb9

[PATCH 15/15] NEWS: Document recent vbox changes

2023-01-23 Thread Michal Privoznik
The support for VirtualBox 5.2 and 6.0 was removed and 7.0 was added. Reflect these changes in the NEWS file. Signed-off-by: Michal Privoznik --- NEWS.rst | 11 +++ 1 file changed, 11 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 2756b25611..a0fe0d18a0 100644 --- a/NEWS.rst

[PATCH 2/8] vbox: Introduce IVirtualBoxErrorInfo interface

2023-01-23 Thread Michal Privoznik
the interface UUID (which MAY change across each release) so that it can be passed to VBOX_QUERY_INTERFACE() introduced earlier. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.h| 1 + src/vbox/vbox_tmpl.c | 34 ++ src/vbox/vbox_uniformed_api.h

[PATCH 03/15] vbox: Drop @iid from UIMachine::LaunchVMProcess()

2023-01-23 Thread Michal Privoznik
The @iid argument of UIMachine::LaunchVMProcess() callback is unused. Drop it and also its propagation from parent functions. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c| 6 +++--- src/vbox/vbox_tmpl.c | 1 - src/vbox/vbox_uniformed_api.h | 1 - 3 files changed

[PATCH 11/15] vbox: Drop @networkName from UIDHCPServer::Start()

2023-01-23 Thread Michal Privoznik
The @networkName argument of UIDHCPServer::Start() callback is unused. Drop it and also its propagation from parent functions. Signed-off-by: Michal Privoznik --- src/vbox/vbox_network.c | 2 -- src/vbox/vbox_tmpl.c | 2 +- src/vbox/vbox_uniformed_api.h | 2 +- 3 files changed, 2

[PATCH 14/15] vbox: Add support for version 7.0 SDK

2023-01-23 Thread Michal Privoznik
() combo. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/419 Signed-off-by: Michal Privoznik --- src/vbox/meson.build | 1 + src/vbox/vbox_V7_0.c | 13 + src/vbox/vbox_common.h| 2 ++ src/vbox/vbox_storage.c | 2 ++ src/vbox/vbox_tmpl.c

[PATCH 0/8] vbox: Report VirtualBox exceptions too

2023-01-23 Thread Michal Privoznik
See 5/8 for motivation. Michal Prívozník (8): vbox: Introduce VBOX_QUERY_INTERFACE() vbox: Introduce IVirtualBoxErrorInfo interface vbox: Introduce vboxUniformedPFN::GetException() vbox: Introduce vboxUniformedPFN::ClearException() vbox: Introduce vboxReportError() vbox: Replace

[PATCH 12/15] vbox: Rename #include guard macro in header files

2023-01-23 Thread Michal Privoznik
of changing the newer 7.0 header file (and having to change all subsequent versions), let's change the old ones and as we drop support for them, we can forget this ever happened. Signed-off-by: Michal Privoznik --- src/vbox/vbox_CAPI_v6_1.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions

[PATCH 3/8] vbox: Introduce vboxUniformedPFN::GetException()

2023-01-23 Thread Michal Privoznik
The GetException() method can be used to obtain the latest exception that occurred in VirtualBox. Calling the method does not reset the exception though. For that we'll need to call another method (introduced in following commit). Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.h

[PATCH 01/15] vbox: Drop misleading G_GNUC_UNUSED annotation

2023-01-23 Thread Michal Privoznik
There are few cases where a function argument is marked as unused, but it's used later in the function. The majority of such occurrences are in vbox_tmpl.c as a residue of older vbox versions, but a pair was found in vbox_common.c too. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c

[PATCH 6/8] vbox: Replace virReportError() with vboxReportError()

2023-01-23 Thread Michal Privoznik
though, for instance, when initializing VirtualBox SDK (we don't have all the objects needed for querying exceptions yet), or when invalid combination of arguments was passed to an API of ours, or when a function from other module (e.g. src/conf/) failed. Signed-off-by: Michal Privoznik --- src

[PATCH 7/8] vbox: Move error messages onto a single line

2023-01-23 Thread Michal Privoznik
Our coding style suggests error messages to be on a single line for easier git grep. Since I'm touching them anyways, let's make them follow our own suggestion. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c | 52 +++--- 1 file changed, 19

[PATCH 8/8] vbox: Stop reporting RC in error messages

2023-01-23 Thread Michal Privoznik
As shown in the commit that introduced vboxReportError(), we are appending the retval of a failed VirtualBox API onto our error messages. Well, this is no longer needed because vboxReportError() already appends the VirtualBox error in plain text. Signed-off-by: Michal Privoznik --- src/vbox

[PATCH 5/8] vbox: Introduce vboxReportError()

2023-01-23 Thread Michal Privoznik
ppend them after the error message we intent to report. If the exception can't be queried successfully, this behaves exactly like virReportError(). Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c | 113 + 1 file changed, 113 insertions(+) diff -

[PATCH 04/15] vbox: Drop @iid from UISession::Open()

2023-01-23 Thread Michal Privoznik
The @iid argument of UISession::Open() callback is unused. Drop it and also its propagation from parent functions. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c| 14 +++--- src/vbox/vbox_storage.c | 2 +- src/vbox/vbox_tmpl.c | 2 +- src/vbox

[PATCH 07/15] vbox: Drop UIUSBCommon::Enable()

2023-01-23 Thread Michal Privoznik
The UIUSBCommon::Enable() function is no longer needed as it is a NOP. Drop it. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c| 1 - src/vbox/vbox_tmpl.c | 8 src/vbox/vbox_uniformed_api.h | 1 - 3 files changed, 10 deletions(-) diff --git a/src/vbox

[PATCH 06/15] vbox: Drop @data and @name from UIHost::CreateHostOnlyNetworkInterface()

2023-01-23 Thread Michal Privoznik
The @data and @name arguments of UIHost::CreateHostOnlyNetworkInterface() callback are unused. Drop them and also their propagation from parent functions. Signed-off-by: Michal Privoznik --- src/vbox/vbox_network.c | 3 +-- src/vbox/vbox_tmpl.c | 3 +-- src/vbox

[PATCH 05/15] vbox: Drop @iid from UISession::OpenExisting()

2023-01-23 Thread Michal Privoznik
The @iid argument of UISession::OpenExisting() callback is unused. Drop it and also its propagation from parent functions. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c| 22 +++--- src/vbox/vbox_tmpl.c | 2 +- src/vbox/vbox_uniformed_api.h | 2

[PATCH 0/2] vbox: Two simple fixes

2023-01-23 Thread Michal Privoznik
I've notice these while working on adding support for 7.0 API. Michal Prívozník (2): vbox: Fix memleak in _virtualboxCreateMachine() vbox: Fix starting domains src/vbox/vbox_common.c | 13 ++--- src/vbox/vbox_tmpl.c | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) --

[PATCH v2 1/3] src: Don't use virReportSystemError() on virProcessGetStatInfo() failure

2023-01-18 Thread Michal Privoznik
errors is very misleading. Use plain virReportError() instead. Luckily, there are only two places where the former was used: chDomainHelperGetVcpus() and qemuDomainHelperGetVcpus() (not a big surprise since CH driver is heavily inspired by QEMU driver). Signed-off-by: Michal Privoznik --- src/ch

[PATCH v2 3/3] qemu: Provide virDomainGetCPUStats() implementation for session connection

2023-01-18 Thread Michal Privoznik
virProcessGetStatInfo() to fill the overall stats. Unfortunately, I haven't found any source of per host CPU usage, so we just continue throwing an error in that case. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 52 -- 1 file changed, 50 insertions

[PATCH v2 2/3] virprocess: Make virProcessGetStatInfo() fail if unable to parse data

2023-01-18 Thread Michal Privoznik
). Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 11 --- src/util/virprocess.c | 28 +++- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c576c601ad..25c681bfd2 100644 --- a/src/qemu

[PATCH v2 0/3] qemu: Provide virDomainGetCPUStats() implementation for session connection

2023-01-18 Thread Michal Privoznik
v2 of: https://listman.redhat.com/archives/libvir-list/2023-January/237113.html diff to v1: - Make virProcessGetStatInfo() return an error, per Martin's review Michal Prívozník (3): src: Don't use virReportSystemError() on virProcessGetStatInfo() failure virprocess: Make

[PATCH] qemu: Provide virDomainGetCPUStats() implementation for session connection

2023-01-17 Thread Michal Privoznik
virProcessGetStatInfo() to fill the overall stats. Unfortunately, I haven't found any source of per host CPU usage, so we just continue throwing an error in that case. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 52 -- 1 file changed, 50 insertions

[PATCH] NEWS: Document my contributions for upcoming release

2023-01-16 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- NEWS.rst | 37 + 1 file changed, 37 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 9baf10b8e9..a860c2b6f6 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -50,6 +50,30 @@ v9.0.0 (unreleased) With sufficiently new QEMU

[PATCH] qemu_namespace: Move umount() call into #fdef __linux__

2023-01-05 Thread Michal Privoznik
__linux__ and not care about other OSes. Signed-off-by: Michal Privoznik --- src/qemu/qemu_namespace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index fc348c043e..5769a4dfe0 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu

[PATCH] qemuBuildThreadContextProps: Generate ThreadContext less frequently

2023-01-05 Thread Michal Privoznik
, which fails. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2154750 Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 11 ++- .../hugepages-memaccess2.x86_64-latest.args | 9 +++-- .../memory-hotplug-virtio-mem.x86_64

[PATCH v2 2/7] virDomainCapsEnumFormat: Retrun void

2023-01-05 Thread Michal Privoznik
The virDomainCapsEnumFormat() function does not return anything but zero and none of its callers is interested in the failure anyways. Switch its return type from integer to void. Signed-off-by: Michal Privoznik --- src/conf/domain_capabilities.c | 5 ++--- 1 file changed, 2 insertions(+), 3

[PATCH v2 5/7] qemuMonitorJSONGetCPUModelExpansion: Introduce @hv_passthrough argument

2023-01-05 Thread Michal Privoznik
This continues and finishes propagation of the @hv_passthrough argument started in the previous commit. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 8 src/qemu/qemu_driver.c | 3 ++- src/qemu/qemu_monitor.c | 5 +++-- src

[PATCH v2 6/7] qemu_capabilities: Query for Hyper-V Enlightenments

2023-01-05 Thread Michal Privoznik
expansion is not stored in cache (and thus not formatted in tests/qemucapabilitiesdata/caps_*.replies files either). This is purely runtime thing. Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 159 ++ .../caps_4.2.0.aarch64.replies| 45

[PATCH v2 4/7] qemuMonitorJSONMakeCPUModel: Introduce @hv_passthrough argument

2023-01-05 Thread Michal Privoznik
nts": { "type": "full", "model": { "name": "host", "props": { "hv-passthrough": true } } } } Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_monitor_

[PATCH v2 7/7] qemu_capabilities: Report Hyper-V Enlightenments in domcapabilities

2023-01-05 Thread Michal Privoznik
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1717611 Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 11 +++ .../domaincapsdata/qemu_8.0.0-q35.x86_64.xml | 19 ++- .../domaincapsdata/qemu_8.0.0-tcg.x86_64

[PATCH v2 3/7] domain_capabilities: Expose Hyper-V Enlightenments

2023-01-05 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- docs/formatdomaincaps.rst | 15 +++ src/conf/domain_capabilities.c | 18 ++ src/conf/domain_capabilities.h | 8 src/conf/schemas/domaincaps.rng| 10

[PATCH v2 1/7] virDomainCapsEnumFormat: Switch to virXMLFormatElement()

2023-01-05 Thread Michal Privoznik
We are formatting element and its children using virBufferAddLit(), virBufferAsprintf(), virBufferAdjustIndent(), etc. Well, we can avoid that when switching to virXMLFormatElement(). Signed-off-by: Michal Privoznik --- src/conf/domain_capabilities.c | 15 +-- 1 file changed, 5

[PATCH v2 0/7] qemu_capabilities: Report Hyper-V Enlightenments in domcapabilities

2023-01-05 Thread Michal Privoznik
v2 of: https://listman.redhat.com/archives/libvir-list/2022-December/236464.html diff to v1: - Merged some cleanup patches from v1 - Store capabilities in cache - More cleanup patches Michal Prívozník (7): virDomainCapsEnumFormat: Switch to virXMLFormatElement() virDomainCapsEnumFormat:

[PATCH] security_selinux: Set and restore /dev/sgx_* labels

2023-01-04 Thread Michal Privoznik
For SGX type of memory, QEMU needs to open and talk to /dev/sgx_vepc and /dev/sgx_provision files. But we do not set nor restore SELinux labels on these files when starting a guest. Signed-off-by: Michal Privoznik --- src/security/security_dac.c | 3 --- src/security/security_manager.h

[PATCH] virQEMUCapsLoadCache: Parse properly

2023-01-03 Thread Michal Privoznik
In a recent commit, when ditching virXPathULong() the parsing of was changed. But it was changed to virXMLPropUInt() which is not correct because the value we're interested in is not in an attribute but element itself. Fixes: a3c7426839df25f4026707c5877be75f2461f5e9 Signed-off-by: Michal

[PATCH] qemu_namespace: Fix detection of nested mount points

2023-01-03 Thread Michal Privoznik
ix is slash. Signed-off-by: Michal Privoznik --- src/qemu/qemu_namespace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index fb79460109..fc348c043e 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_na

[PATCH 2/3] util: Introduce virDirOpenSorted()

2022-12-23 Thread Michal Privoznik
In some cases (e.g. test suite) it may be desirable to read directory contents in a sorted fashion. Introduce virDirOpenSorted() and modify virDirRead() so that directory entries can be returned in alphabetical order (as defined by strcmp()). Signed-off-by: Michal Privoznik --- src

[PATCH 3/3] tests: Use virDirOpenSorted()

2022-12-23 Thread Michal Privoznik
ow that we have virDirOpenSorted() the test cases can run in more predictable way. Signed-off-by: Michal Privoznik --- tests/testutilsqemu.c | 4 ++-- tests/virschematest.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index

[PATCH 1/3] util: Introduce a wrapper struct around DIR

2022-12-23 Thread Michal Privoznik
This is going to be important in next commits because we are going to store more information than just DIR structure. Signed-off-by: Michal Privoznik --- build-aux/syntax-check.mk| 2 +- src/bhyve/bhyve_capabilities.c | 2 +- src/bhyve/bhyve_firmware.c | 2 +- src

[PATCH 0/3] Introduce and use virDirOpenSorted()

2022-12-23 Thread Michal Privoznik
Whiles working on Hyper-V patches I've posted yesterday I ran domaincapstest occasionally and was puzzled for a moment that qemu-7.2.0 wasn't tested. Well it is, but it's harder to see immediately because individual test cases are in 'random' order: 11) qemu_7.2.0.x86_64

[PATCH v1 7/7] qemu_capabilities: Report Hyper-V Enlightenments in domcapabilities

2022-12-22 Thread Michal Privoznik
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1717611 Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 57 +++ .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 + .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 + .../qemu_4.2.0-virt.a

[PATCH v1 5/7] qemu_capabilities: Query for Hyper-V Enlightenments

2022-12-22 Thread Michal Privoznik
expansion is not stored in cache (and thus not formatted in tests/qemucapabilitiesdata/caps_*.replies files either). This is purely runtime thing. Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 19 + .../caps_4.2.0.aarch64.replies| 45

[PATCH v1 6/7] domain_capabilities: Expose Hyper-V Enlightenments

2022-12-22 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- docs/formatdomaincaps.rst | 15 +++ src/conf/domain_capabilities.c | 12 src/conf/domain_capabilities.h | 8 src/conf/schemas/domaincaps.rng | 10 ++ 4 files changed, 45 insertions(+) diff --git a/docs

[PATCH v1 4/7] qemuMonitorJSONGetCPUModelExpansion: Introduce @hv_passthrough argument

2022-12-22 Thread Michal Privoznik
This continues and finishes propagation of the @hv_passthrough argument started in the previous commit. Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 8 src/qemu/qemu_driver.c | 3 ++- src/qemu/qemu_monitor.c | 5 +++-- src/qemu/qemu_monitor.h | 1

[PATCH v1 3/7] qemuMonitorJSONMakeCPUModel: Introduce @hv_passthrough argument

2022-12-22 Thread Michal Privoznik
nts": { "type": "full", "model": { "name": "host", "props": { "hv-passthrough": true } } } } Signed-off-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 20 +--

[PATCH v1 2/7] qemu_capabilities: Decrease scope of @hash in virQEMUCapsProbeQMPHostCPU()

2022-12-22 Thread Michal Privoznik
The @hash variable inside of virQEMUCapsProbeQMPHostCPU() is used only within a loop, but declared at the beginning of the function. Bring the variable declaration into the said loop. Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v1 1/7] domain_capabilities: s/qemuDomainCapsFeatureFormatSimple/virDomainCapsFeatureFormatSimple/

2022-12-22 Thread Michal Privoznik
There's nothing qemu specific about qemuDomainCapsFeatureFormatSimple() and in fact, the function lives in hypervisor agnostic location and thus mustn't have qemu prefix. Signed-off-by: Michal Privoznik --- src/conf/domain_capabilities.c | 16 1 file changed, 8 insertions(+), 8

[PATCH v1 0/7] qemu_capabilities: Report Hyper-V Enlightenments in domcapabilities

2022-12-22 Thread Michal Privoznik
Michal Prívozník (7): domain_capabilities: s/qemuDomainCapsFeatureFormatSimple/virDomainCapsFeatureFormatSimple/ qemu_capabilities: Decrease scope of @hash in virQEMUCapsProbeQMPHostCPU() qemuMonitorJSONMakeCPUModel: Introduce @hv_passthrough argument

[PATCH v2] virQEMUDriverGetDomainCapabilities: Validate arguments

2022-12-22 Thread Michal Privoznik
. This also fixes the issue when domcapabilities for a virttype of a different driver are requested, or a different arch. Signed-off-by: Michal Privoznik --- v2 of: https://listman.redhat.com/archives/libvir-list/2022-December/236460.html diff to v1: - validate @arch, @virttype as well, not just

[PATCH] qemumonitortestutils: Fix line counting in qemuMonitorTestProcessFileEntries()

2022-12-22 Thread Michal Privoznik
-off-by: Michal Privoznik --- tests/qemumonitortestutils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 46791931b0..4e99c4b54e 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1302,6 +1302,9

[PATCH] virQEMUDriverGetDomainCapabilities: Validate machine type

2022-12-22 Thread Michal Privoznik
This is because for 'hvf' virttype (at least my) QEMU does not have any machine type. Therefore, @machine is set to NULL and the rest of the code does not expect that. Signed-off-by: Michal Privoznik --- src/qemu/qemu_conf.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/qemu

[PATCH 6/7] qemu_security: Drop qemuSecurityStartTPMEmulator()

2022-12-20 Thread Michal Privoznik
After previous cleanup this function is no longer used and thus can be dropped. Signed-off-by: Michal Privoznik --- src/qemu/qemu_security.c | 77 src/qemu/qemu_security.h | 9 - 2 files changed, 86 deletions(-) diff --git a/src/qemu

[PATCH 5/7] qemu_tpm: Open code qemuSecurityStartTPMEmulator()

2022-12-20 Thread Michal Privoznik
operations. Just call functions for them separately. Signed-off-by: Michal Privoznik --- src/qemu/qemu_tpm.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 03055002cb..b2748eb6a4 100644 --- a/src/qemu/qemu_tpm.c +++ b

[PATCH 1/7] qemu_security: Rework qemuSecurityCleanupTPMEmulator()

2022-12-20 Thread Michal Privoznik
path. Make the function return an integer, just like the rest of qemuSecurity*Restore() functions. Signed-off-by: Michal Privoznik --- src/qemu/qemu_security.c | 21 - src/qemu/qemu_security.h | 6 +++--- src/qemu/qemu_tpm.c | 3 ++- 3 files changed, 17 insertions(+), 13

[PATCH 7/7] docs: Recommend static seclabels for migration on shared storage

2022-12-20 Thread Michal Privoznik
and the destination QEMU/helper process) would try to access the same file. One of them is necessarily going to be denied access. Signed-off-by: Michal Privoznik --- docs/drvqemu.rst | 7 +++ 1 file changed, 7 insertions(+) diff --git a/docs/drvqemu.rst b/docs/drvqemu.rst index bbd51066a1..fa23912937

[PATCH 4/7] qemu_tpm: Restore TPM labels on failed start

2022-12-20 Thread Michal Privoznik
If swtpm binary fails to start after successful exec() (e.g. it fails to initialize itself), the seclabels set in qemuSecurityStartTPMEmulator() are not restored. This is due to lacking qemuSecurityRestoreTPMLabels() call in the error path. Signed-off-by: Michal Privoznik --- src/qemu

[PATCH 3/7] qemu_security: Introduce qemuSecuritySetTPMLabels()

2022-12-20 Thread Michal Privoznik
on the TPM state. Signed-off-by: Michal Privoznik --- src/qemu/qemu_security.c | 26 ++ src/qemu/qemu_security.h | 4 2 files changed, 30 insertions(+) diff --git a/src/qemu/qemu_security.c b/src/qemu/qemu_security.c index 82d686b0e3..daf01bb803 100644 --- a/src/qemu

[PATCH 0/7] qemu: Cleanup code around TPM seclabels

2022-12-20 Thread Michal Privoznik
*** BLURB HERE *** Michal Prívozník (7): qemu_security: Rework qemuSecurityCleanupTPMEmulator() qemu_security: Rename qemuSecurityCleanupTPMEmulator() qemu_security: Introduce qemuSecuritySetTPMLabels() qemu_tpm: Restore TPM labels on failed start qemu_tpm: Open code

[PATCH 2/7] qemu_security: Rename qemuSecurityCleanupTPMEmulator()

2022-12-20 Thread Michal Privoznik
The qemuSecurityCleanupTPMEmulator() function calls virSecurityManagerRestoreTPMLabels() and thus the proper name is qemuSecurityRestoreTPMLabels(). Rename it. Signed-off-by: Michal Privoznik --- src/qemu/qemu_security.c | 6 +++--- src/qemu/qemu_security.h | 6 +++--- src/qemu/qemu_tpm.c

[PATCH 1/1] secret: Inhibit shutdown for ephemeral secrets

2022-12-20 Thread Michal Privoznik
can't be restored. Therefore, we could view ephemeral secrets as active objects that the daemon manages and thus inhibit automatic shutdown (just like hypervisor daemons do when a guest is running). Signed-off-by: Michal Privoznik --- src/secret/secret_driver.c | 35

[RFC PATCH 0/1] secret: Inhibit shutdown for ephemeral secrets

2022-12-20 Thread Michal Privoznik
I'm kind of convinced that we want to do this, but also it's a significant change in the behaviour of the daemon, hence RFC prefix. This stemmed from a discussion with a user who wants us to use something more secure than base64 encoded secret values stored on a disk. They suggested storing the

<    1   2   3   4   5   6   7   8   9   10   >