Re: [PATCH 05/36] conf: virdomainobjlist: Remove return value from virDomainObjListCollect

2023-01-05 Thread Jonathon Jongsma
On 1/5/23 10:29 AM, Peter Krempa wrote: The function can't fail so there's no point in returning anything. Signed-off-by: Peter Krempa --- src/conf/virdomainobjlist.c | 7 ++- src/conf/virdomainobjlist.h | 2 +- src/qemu/qemu_driver.c | 7 +++ src/test/test_driver.c | 4

Re: [PATCH 04/36] conf: virdomainobjlist: Introduce 'virDomainObjListCollectAll'

2023-01-05 Thread Jonathon Jongsma
On 1/5/23 10:29 AM, Peter Krempa wrote: Introduce a helper which will return a list of all domain objects inside of the list without filtering and thus without the need to lock individual members. Signed-off-by: Peter Krempa --- src/conf/virdomainobjlist.c | 32

Re: [PATCH 03/36] conf: virdomainobjlist: Convert header to contemporary style

2023-01-05 Thread Jonathon Jongsma
On 1/5/23 10:29 AM, Peter Krempa wrote: Use the new style which doesn't require re-aligning the argument list once you change the return type. Signed-off-by: Peter Krempa --- src/conf/virdomainobjlist.h | 156 1 file changed, 86 insertions(+), 70

Re: [PATCH 02/36] datatypes: Clean up whitespace in definition of struct _virConnect

2023-01-05 Thread Jonathon Jongsma
On 1/5/23 10:29 AM, Peter Krempa wrote: Remove extraneous spaces and put comment on a single line. Signed-off-by: Peter Krempa --- src/datatypes.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/datatypes.h b/src/datatypes.h index 0f9730d9e8..f8b1a83407 100644

Re: [PATCH 01/36] datatypes: Simplify error path of 'virGetDomain'

2023-01-05 Thread Jonathon Jongsma
On 1/5/23 10:29 AM, Peter Krempa wrote: 'virObjectNew' can't return NULL. If we pre-check the arguments we don't need a cleanup label. Signed-off-by: Peter Krempa --- src/datatypes.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/datatypes.c

[PATCH] NEWS: Mention split of libvirt-daemon subpackage

2023-01-05 Thread Jim Fehlig
Signed-off-by: Jim Fehlig --- NEWS.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 39f508a6ce..a799ee4529 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -23,6 +23,12 @@ v9.0.0 (unreleased) With sufficiently new QEMU (v7.1.0) screenshots change format from

Re: [PATCH 0/9] use g_autofree

2023-01-05 Thread Jonathon Jongsma
On 1/5/23 6:26 AM, Jiang Jiacheng wrote: Use g_autofree more often and remove unnecessary cleanup/error labels. Jiang Jiacheng (9): conf: use g_autofree and remove unnecessary label interface: use g_autofree and remove unnecessary label locking: use g_autofree and remove unnecessary

Re: [PATCH 6/9] security: use g_autofree and remove unnecessary label

2023-01-05 Thread Jonathon Jongsma
On 1/5/23 6:26 AM, Jiang Jiacheng wrote: ... @@ -476,33 +459,29 @@ AppArmorGetSecurityProcessLabel(virSecurityManager *mgr G_GNUC_UNUSED, { int rc = -1; 'rc' variable doesn't seem to be used anymore. int status; -char *profile_name = NULL; +g_autofree char

Re: [PATCH 1/9] conf: use g_autofree and remove unnecessary label

2023-01-05 Thread Jonathon Jongsma
On 1/5/23 6:26 AM, Jiang Jiacheng wrote: Signed-off-by: Jiang Jiacheng ... diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 9a95ae6c12..39f36ca29d 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c ... @@ -2571,8 +2564,8 @@

Re: [PATCH V6 10/11] spec: Remove libvirt-daemon dependency from hypervisor subpackages

2023-01-05 Thread Andrea Bolognani
On Thu, Jan 05, 2023 at 10:05:01AM -0700, Jim Fehlig wrote: > On 1/4/23 02:14, Andrea Bolognani wrote: > > On Tue, Jan 03, 2023 at 02:22:14PM -0700, Jim Fehlig wrote: > > > Remove the libvirt-daemon dependency from the various > > > libvirt-daemon- subpackages, replacing it with a set of the > > >

Re: [PATCH V6 10/11] spec: Remove libvirt-daemon dependency from hypervisor subpackages

2023-01-05 Thread Jim Fehlig
On 1/4/23 02:14, Andrea Bolognani wrote: On Tue, Jan 03, 2023 at 02:22:14PM -0700, Jim Fehlig wrote: Remove the libvirt-daemon dependency from the various libvirt-daemon- subpackages, replacing it with a set of the new sub subpackages providing the same functionality. Maybe we could add

[PATCH 16/36] remote_driver: Refactor few functions as example of auto-locking

2023-01-05 Thread Peter Krempa
Signed-off-by: Peter Krempa --- src/remote/remote_driver.c | 31 +-- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 8310326ad0..7946e9d9bd 100644 --- a/src/remote/remote_driver.c +++

[PATCH 19/36] qemuxml2xmltest: Remove 'disk-backing-chain' case and output files

2023-01-05 Thread Peter Krempa
The test is superseded by 'disk-backing-chains-(no)index' cases. Signed-off-by: Peter Krempa --- .../qemuxml2argvdata/disk-backing-chains.xml | 98 .../disk-backing-chains-active.xml| 110 -- .../disk-backing-chains-inactive.xml | 110

[PATCH 31/36] security: selinux: Handle security labelling of FD-passed images

2023-01-05 Thread Peter Krempa
Unfortunately unlike with DAC we can't simply ignore labelling for the FD and it also influences the on-disk state. Thus we need to relabel the FD and we also store the existing label in cases when the user will request best-effort label replacement. Signed-off-by: Peter Krempa ---

[PATCH 24/36] qemuxml2argvtest: Add support for populating 'fds' in private data

2023-01-05 Thread Peter Krempa
Introduce a new argument type for testQemuInfoSetArgs named ARG_FD_GROUP which allows users to instantiate tests with populated FD passing hash table. Signed-off-by: Peter Krempa --- src/conf/storage_source_conf.c | 1 + src/conf/storage_source_conf.h | 1 + tests/qemuxml2argvtest.c |

[PATCH 20/36] lib: Introduce virDomainFDAssociate API

2023-01-05 Thread Peter Krempa
The API can be used to associate one or more (e.g. a RO and RW fd for a disk backend image) FDs to a VM. They can be then used per definition. The primary use case for now is for complex deployment where libvirtd/virtqemud may be run inside a container and getting the image into the container is

[PATCH 18/36] qemuxml2argvtest: Add seclabels in to disk-backing-chains-(no)index

2023-01-05 Thread Peter Krempa
Commit da9f3cd84b250088 added the seclabel example into the 'disk-backing-chains' case. Since the only thing that 'disk-backing-chains' tests which 'disk-backing-chains-(no)index' don't test is the seclabel we'll be able to remove the test case if we add the seclabel example. Signed-off-by:

[PATCH 33/36] qemu: driver: Don't allow certain operations with FD-passed disks

2023-01-05 Thread Peter Krempa
Probing stats and block copy to a FD passed image is not yet supported. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c086d4069b..4df7f42ae4 100644 ---

[PATCH 14/36] gendispatch: Add 'G_GNUC_WARN_UNUSED_RESULT' to output of 'aclheader'

2023-01-05 Thread Peter Krempa
Require check of return value of the ACL checking functions. Signed-off-by: Peter Krempa --- src/rpc/gendispatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 5f2b163ea0..54d55d91e7 100755 ---

[PATCH 21/36] virsh: Introduce 'dom-fd-associate' for invoking virDomainFDAssociate()

2023-01-05 Thread Peter Krempa
Signed-off-by: Peter Krempa --- docs/manpages/virsh.rst | 22 +++ tools/virsh-domain.c| 83 + 2 files changed, 105 insertions(+) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index c85bc8151d..7e57796384 100644 ---

[PATCH 34/36] qemu: cgroup: Don't setup cgroups for FD-passed images

2023-01-05 Thread Peter Krempa
Signed-off-by: Peter Krempa --- src/qemu/qemu_cgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 9cf2d6474a..aac7c70054 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -206,7 +206,9 @@

[PATCH 10/36] qemu: Use new connection close callbacks API

2023-01-05 Thread Peter Krempa
The qemu driver uses connection close callbacks in more places requiring more changes than other drivers, but luckily the changes are very straightforward. The migration code was written in a way ensuring that there's just one callback present so this can be preserved directly. Signed-off-by:

[PATCH 27/36] conf: storage_source: Introduce virStorageSourceIsFD

2023-01-05 Thread Peter Krempa
The helper will be used in various places that need to check that a disk source struct is using FD passing. Signed-off-by: Peter Krempa --- src/conf/storage_source_conf.c | 7 +++ src/conf/storage_source_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 11 insertions(+)

[PATCH 02/36] datatypes: Clean up whitespace in definition of struct _virConnect

2023-01-05 Thread Peter Krempa
Remove extraneous spaces and put comment on a single line. Signed-off-by: Peter Krempa --- src/datatypes.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/datatypes.h b/src/datatypes.h index 0f9730d9e8..f8b1a83407 100644 --- a/src/datatypes.h +++ b/src/datatypes.h

[PATCH 26/36] qemu: domain: Introduce qemuDomainStartupCleanup

2023-01-05 Thread Peter Krempa
The new helper qemuDomainStartupCleanup is used to perform cleanup after a startup of a VM (successful or not). The initial implementation just calls qemuDomainSecretDestroy, which can be un-exported. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 15 ++-

[PATCH 30/36] secuirity: DAC: Don't relabel FD-passed virStorageSource images

2023-01-05 Thread Peter Krempa
DAC security label is irrelevant once you have the FD. Disable all labelling for such images. Signed-off-by: Peter Krempa --- src/security/security_dac.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/security/security_dac.c

[PATCH 35/36] qemu: Enable support for FD passed disk sources

2023-01-05 Thread Peter Krempa
Assert support for VIR_DOMAIN_DEF_FEATURE_DISK_FD in the qemu driver now that all code paths are adapted. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index

[PATCH 29/36] qemu: block: Add support for passing FDs of disk images

2023-01-05 Thread Peter Krempa
Prepare the internal data for passing FDs instead of having qemu open the file internally. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 31 --- src/qemu/qemu_command.c | 22 ++ 2 files changed, 50 insertions(+), 3 deletions(-) diff

[PATCH 36/36] qemuxml2*test: Enable testing of disks with 'fdgroup'

2023-01-05 Thread Peter Krempa
Enable the qemuxml2xml variant and add output data for qemuxml2argvtest. Signed-off-by: Peter Krempa --- .../disk-source-fd.x86_64-latest.args | 49 + tests/qemuxml2argvtest.c | 4 ++ .../disk-source-fd.x86_64-latest.xml | 52

[PATCH 32/36] qemu: Prepare storage backing chain traversal code for FD passed images

2023-01-05 Thread Peter Krempa
We assume that FD passed images already exist so all existance checks are skipped. For the case that a FD-passed image is passed without a terminated backing chain (thus forcing us to detect) we attempt to read the header from the FD. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c

[PATCH 28/36] qemu: Prepare data for FD-passed disk image sources

2023-01-05 Thread Peter Krempa
When starting up a VM with FD-passed images we need to look up the corresponding named FD set and associate it with the virStorageSource based on the name. The association is brought into virStorageSource as security labelling code will need to access the FD to perform selinux labelling.

[PATCH 23/36] qemu: Implement qemuDomainFDAssociate

2023-01-05 Thread Peter Krempa
Implement passing and storage of FDs for the qemu driver. The FD tuples are g_object instances stored in a per-domain hash table and are automatically removed once the connection is closed. In the future we can consider supporting also to not tie the lifetime of the passed FDs bound to the

[PATCH 15/36] remote_driver: Return 'virLockGuard' from 'remoteDriverLock'

2023-01-05 Thread Peter Krempa
The function currently didn't have a return value. Returning the 'virLockGuard' struct allows the callers to use automatic unlocking of the mutex. Signed-off-by: Peter Krempa --- src/remote/remote_driver.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git

[PATCH 25/36] conf: Add 'fdgroup' attribute for 'file' disks

2023-01-05 Thread Peter Krempa
The 'fdgroup' will allow users to specify a passed FD (via the 'virDomainFDAssociate()' API) use instead of opening a path. This is useful in cases when e.g. the file is not accessible from inside a container. Since this uses the same disk type as when we open files via names this patch also

[PATCH 22/36] conf: storage_source: Introduce type for storing FDs associated for storage

2023-01-05 Thread Peter Krempa
For FD-passing of disk sources we'll need to keep the FDs around. Introduce a data type helper based on a g_object so that we get reference counting. One instance will (due to security labelling) will need to be part of the virStorageSource struct thus it's declared in the storage_source_conf

[PATCH 17/36] virStorageSourceIsSameLocation: Use switch statement for individual storage types

2023-01-05 Thread Peter Krempa
Convert to a switch instead of a bunch of 'if (type == ...). Signed-off-by: Peter Krempa --- src/conf/storage_source_conf.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index

[PATCH 13/36] virclosecallbacks: Remove old close callbacks code

2023-01-05 Thread Peter Krempa
Now that all code was refactored to use the new version we can remove the old code. For now the new close callbacks code has no error messages so syntax-check forced me to remove the POTFILES entry for virclosecallbacks.c Signed-off-by: Peter Krempa --- po/POTFILES| 1

[PATCH 07/36] virclosecallbacks: Add new close callbacks APIs

2023-01-05 Thread Peter Krempa
The new APIs store the list of callbacks for a VM inside the virDomainObj and also allow registering multiple callbacks for a single domain and also for multiple connections. For now this code is dormant until each driver using the old APIs is not refactored to use the new APIs. Signed-off-by:

[PATCH 11/36] qemuMigrationSrcIsAllowed: Remove unused 'driver' argument

2023-01-05 Thread Peter Krempa
Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c| 4 ++-- src/qemu/qemu_migration.c | 8 +++- src/qemu/qemu_migration.h | 3 +-- src/qemu/qemu_snapshot.c | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index

[PATCH 12/36] qemuMigrationSrcBeginResumePhase: Remove unused 'driver' argument

2023-01-05 Thread Peter Krempa
Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index a561e1bc63..54626bd851 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2733,7

[PATCH 09/36] bhyve: Use new connection close callbacks API

2023-01-05 Thread Peter Krempa
The rewrite is straightforward as bhyve registers only the 'bhyveProcessAutoDestroy' callback which by design doesn't need any special handling (there's just one caller which can start the VM thus implicitly there's only one possible registration for that function). Signed-off-by: Peter Krempa

[PATCH 08/36] lxc: Use new connection close callbacks API

2023-01-05 Thread Peter Krempa
The rewrite is straightforward as LXC registers only the 'lxcProcessAutoDestroy' callback which by design doesn't need any special handling (there's just one caller which can start the VM thus implicitly there's only one possible registration for that function). Signed-off-by: Peter Krempa ---

[PATCH 06/36] conf: domain: Add helper infrastructure for new connection close callbacks

2023-01-05 Thread Peter Krempa
The new connect close callbacks for domains will be represented by a virObject associated with the domain object itself. To simplify handling the pointer to the close callback data will be done by an immutable pointer allocated directly when allocating the corresponding virDomainObj struct. This

[PATCH 01/36] datatypes: Simplify error path of 'virGetDomain'

2023-01-05 Thread Peter Krempa
'virObjectNew' can't return NULL. If we pre-check the arguments we don't need a cleanup label. Signed-off-by: Peter Krempa --- src/datatypes.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/datatypes.c b/src/datatypes.c index da8a9970f1..c83a74edd5

[PATCH 05/36] conf: virdomainobjlist: Remove return value from virDomainObjListCollect

2023-01-05 Thread Peter Krempa
The function can't fail so there's no point in returning anything. Signed-off-by: Peter Krempa --- src/conf/virdomainobjlist.c | 7 ++- src/conf/virdomainobjlist.h | 2 +- src/qemu/qemu_driver.c | 7 +++ src/test/test_driver.c | 4 +--- src/vz/vz_driver.c | 7 +++

[PATCH 03/36] conf: virdomainobjlist: Convert header to contemporary style

2023-01-05 Thread Peter Krempa
Use the new style which doesn't require re-aligning the argument list once you change the return type. Signed-off-by: Peter Krempa --- src/conf/virdomainobjlist.h | 156 1 file changed, 86 insertions(+), 70 deletions(-) diff --git

[PATCH 04/36] conf: virdomainobjlist: Introduce 'virDomainObjListCollectAll'

2023-01-05 Thread Peter Krempa
Introduce a helper which will return a list of all domain objects inside of the list without filtering and thus without the need to lock individual members. Signed-off-by: Peter Krempa --- src/conf/virdomainobjlist.c | 32 src/conf/virdomainobjlist.h | 4

[PATCH 00/36] Add support for passing FDs to access disk images

2023-01-05 Thread Peter Krempa
First part of the series refactors close callbacks to allow having more of them and then implements new API virDomainFDAssociate and plumbs it to pass to qemu. Peter Krempa (36): datatypes: Simplify error path of 'virGetDomain' datatypes: Clean up whitespace in definition of struct

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

2023-01-05 Thread Michal Prívozník
On 1/5/23 16:37, Michal Privoznik wrote: > In a recent commit I've introduced an umount() call. But the > function where the call lives is compiled on all OSes, not just > Linux. But umount() is Linux specific. Other OSes have unmount > (FreeBSD), or maybe something else. But since namespaces are

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

2023-01-05 Thread Michal Privoznik
In a recent commit I've introduced an umount() call. But the function where the call lives is compiled on all OSes, not just Linux. But umount() is Linux specific. Other OSes have unmount (FreeBSD), or maybe something else. But since namespaces are Linux specific, we can wrap the call in #ifdef

Re: [PATCH 2/2] qemuxml2xmltest: add serial append=on test

2023-01-05 Thread Martin Kletzander
On Tue, Nov 29, 2022 at 09:54:52PM +0600, Oleg Vasilev wrote: Previous commit has introduced the config option to enable append=on for serial files. Here we test it. Signed-off-by: Oleg Vasilev --- tests/qemuxml2argvdata/serial-append.xml | 56 +++

Re: [PATCH 1/2] qemu: add append mode config for serial file

2023-01-05 Thread Martin Kletzander
On Tue, Nov 29, 2022 at 09:54:51PM +0600, Oleg Vasilev wrote: Serial log file contains lots of useful information for debugging configuration problems. It makes sense to preserve the log in between restarts, so that one can later figure out what was going on. I don't understand why is the

[PATCH 3/9] locking: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/locking/lock_driver_lockd.c | 36 +--- src/locking/lock_driver_sanlock.c | 46 --- 2 files changed, 31 insertions(+), 51 deletions(-) diff --git a/src/locking/lock_driver_lockd.c

[PATCH 7/9] util: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/util/virconf.c | 27 --- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index 8a96805642..c39489973b 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -716,7 +716,7 @@

[PATCH 5/9] rpc: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/rpc/virnetclientprogram.c | 6 ++ src/rpc/virnettlscontext.c| 16 +--- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c index 5da118bfd3..b93c495347 100644 ---

[PATCH 9/9] vz: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/vz/vz_utils.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c index fcf6d363a9..219d13823b 100644 --- a/src/vz/vz_utils.c +++ b/src/vz/vz_utils.c @@ -151,7 +151,8 @@

[PATCH 2/9] interface: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/interface/interface_backend_udev.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 979f187d87..54b43fb999 100644 ---

[PATCH 8/9] vmware: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/vmware/vmware_conf.c | 28 ++-- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 80a85f4d0f..5703ce717e 100644 --- a/src/vmware/vmware_conf.c +++

[PATCH 4/9] remote: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/remote/remote_driver.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index b0dba9057b..316a11b10f 100644 --- a/src/remote/remote_driver.c +++

[PATCH 6/9] security: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/security/security_apparmor.c | 91 +++- 1 file changed, 31 insertions(+), 60 deletions(-) diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c index 36e8ce42b5..64b57f6a22 100644 ---

[PATCH 1/9] conf: use g_autofree and remove unnecessary label

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/conf/domain_audit.c | 121 ++- src/conf/node_device_util.c | 49 + src/conf/nwfilter_conf.c | 51 - src/conf/virnetworkobj.c | 85 --

[PATCH 0/9] use g_autofree

2023-01-05 Thread Jiang Jiacheng
Use g_autofree more often and remove unnecessary cleanup/error labels. Jiang Jiacheng (9): conf: use g_autofree and remove unnecessary label interface: use g_autofree and remove unnecessary label locking: use g_autofree and remove unnecessary label remote: use g_autofree and remove

Re: [PATCH v2] virQEMUDriverGetDomainCapabilities: Validate arguments

2023-01-05 Thread Martin Kletzander
On Thu, Dec 22, 2022 at 01:00:06PM +0100, Michal Privoznik wrote: When calling virConnectGetDomainCapabilities() (exposed as virsh domcapabilities) users have option to specify whatever sub-set of { emulatorbin, arch, machine, virttype } they want. Then we have a logic (hidden in

[PATCH 0/3] fix some coding issues

2023-01-05 Thread Jiang Jiacheng
Jiang Jiacheng (3): qemu:fix a misspelling in log remote: fix misspelling in the documation of 'daemonCreateClientStream' storage/util: replace unnecessary while loop by if src/qemu/qemu_process.c | 2 +- src/remote/remote_daemon_stream.c | 4 ++-- src/storage/storage_util.c

[PATCH 3/3] storage/util: replace unnecessary while loop by if

2023-01-05 Thread Jiang Jiacheng
These while loops exit directly due to break after entering. Use if instead of these while loops. Signed-off-by: Jiang Jiacheng --- src/storage/storage_util.c | 4 +--- src/util/virutil.c | 6 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git

[PATCH 2/3] remote: fix misspelling in the documation of 'daemonCreateClientStream'

2023-01-05 Thread Jiang Jiacheng
Fix a misspelling in the documation of 'daemonCreateClientStream'. Signed-off-by: Jiang Jiacheng --- src/remote/remote_daemon_stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/remote/remote_daemon_stream.c b/src/remote/remote_daemon_stream.c index

[PATCH 1/3] qemu: fix a misspelling in log

2023-01-05 Thread Jiang Jiacheng
Signed-off-by: Jiang Jiacheng --- src/qemu/qemu_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b6adcf2f2a..04d14e7eb0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7590,7 +7590,7 @@

Re: [PATCH] qemu_namespace: Umount the original /dev before replacing it with tmpfs

2023-01-05 Thread Martin Kletzander
On Fri, Dec 16, 2022 at 04:04:01PM +0100, Michal Privoznik wrote: Our code relies on mount events propagating into the namespace we create for a domain. However, there's one caveat. In v8.8.0-rc1~8 I've tried to make us detect differences in mount tables between the namespace in which libvirtd

[PATCH] qemuBuildThreadContextProps: Generate ThreadContext less frequently

2023-01-05 Thread Michal Privoznik
Currently, the ThreadContext object is generated whenever we see .host-nodes attribute for a memory-backend-* object. The idea was that when the backend is pinned to a specific set of host NUMA nodes, then the allocation could be happening on CPUs from those nodes too. But this may not be always

[libvirt PATCH v2 28/31] qemu_process: abort snapshot delete when daemon starts

2023-01-05 Thread Pavel Hrdina
If the daemon crashes or is restarted while the snapshot delete is in progress we have to handle it gracefully to not leave any block jobs active. For now we will simply abort the snapshot delete operation so user can start it again. We need to refuse deleting external snapshots if there is

[libvirt PATCH v2 24/31] qemu_snapshot: prepare data for external snapshot deletion

2023-01-05 Thread Pavel Hrdina
In order to save some CPU cycles we will collect all the necessary data to delete external snapshot before we even start. They will be later used by code that deletes the snapshots and updates metadata when needed. With external snapshots we need data that libvirt gets from running QEMU process

[libvirt PATCH v2 23/31] qemu_snapshot: convert snapshot delete to async domain job

2023-01-05 Thread Pavel Hrdina
Deleting external snapshots will require to run it as async domain job, the same way as we do for snapshot creation. For internal snapshots modify the job mask in order to forbid any other job to be started. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c |

[libvirt PATCH v2 10/31] qemu_block: change qemuBlockCommit to return job pointer

2023-01-05 Thread Pavel Hrdina
The created job will be needed by external snapshot delete code so rework qemuBlockCommit to return that pointer. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_block.c | 57 ++ src/qemu/qemu_block.h | 2 +- src/qemu/qemu_driver.c | 5 +++- 3 files

[libvirt PATCH v2 18/31] qemu_snapshot: move snapshot metadata reparent code

2023-01-05 Thread Pavel Hrdina
Previously the reparent happened before the actual snapshot deletion. This change moves the code closer to the rest of the code handling snapshot metadata when deletion happens. This makes the metadate deletion happen after the data files are deleted. Following patch will extract it into separate

[libvirt PATCH v2 29/31] qemu_snapshot: enable deletion of external snapshots

2023-01-05 Thread Pavel Hrdina
Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index f5b88daa5d..4f83eb6bf9 100644 --- a/src/qemu/qemu_snapshot.c +++

[libvirt PATCH v2 27/31] qemu_snapshot: when deleting snapshot invalidate parent snapshot

2023-01-05 Thread Pavel Hrdina
When deleting external snapshots the operation may fail at any point which could lead to situation that some disks finished the block commit operation but for some disks it failed and the libvirt job ends. In order to make sure that the qcow2 images are in consistent state introduce new element

[libvirt PATCH v2 26/31] qemu_snapshot: update metadata when deleting snapshots

2023-01-05 Thread Pavel Hrdina
With external snapshots we need to modify the metadata bit more then what is required for internal snapshots. Mainly the storage source location changes with every external snapshot. This means that if we delete non-leaf snapshot we need to update all children snapshots and modify the disk

[libvirt PATCH v2 30/31] api: document support for external snapshot deletion

2023-01-05 Thread Pavel Hrdina
Now that deletion of external snapshot is implemented document the current virDomainSnapshotDelete supported state. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/libvirt-domain-snapshot.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/libvirt-domain-snapshot.c

[libvirt PATCH v2 31/31] NEWS: document support for external snapshot deletion

2023-01-05 Thread Pavel Hrdina
Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- NEWS.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 39f508a6ce..fecca64344 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -17,6 +17,12 @@ v9.0.0 (unreleased) * **New features** + * QEMU: implement

[libvirt PATCH v2 25/31] qemu_snapshot: implement deletion of external snapshot

2023-01-05 Thread Pavel Hrdina
When deleting snapshot we are starting block-commit job over all disks that are part of the snapshot. This operation may fail as it writes data changes to the backing qcow2 image so we need to wait for all the disks to finish the operation and wait for correct signal from QEMU. If deleting active

[libvirt PATCH v2 16/31] qemu_snapshot: rework snapshot children deletion

2023-01-05 Thread Pavel Hrdina
This simplifies the code a bit by reusing existing parts that deletes a single snapshot. The drawback of this change is that we will now call the re-parent bits to keep the metadata in sync for every child even though it will get deleted as well. Signed-off-by: Pavel Hrdina Reviewed-by: Peter

[libvirt PATCH v2 20/31] qemu_snapshot: introduce qemuSnapshotDeleteValidate function

2023-01-05 Thread Pavel Hrdina
Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 42 ++-- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 3051e5c8df..cb4e0dcb78 100644 ---

[libvirt PATCH v2 22/31] qemu_snapshot: error out when deleting internal snapshot on non-active disk

2023-01-05 Thread Pavel Hrdina
Deleting internal snapshot when the currently active disk image is different than where the internal snapshot was taken doesn't work correctly. This applies to a running VM only as we are using QMP command and talking to the QEMU process that is using different disk. This works correctly when

[libvirt PATCH v2 21/31] qemu_snapshot: refactor validation of snapshot delete

2023-01-05 Thread Pavel Hrdina
Prepare the validation function for external snapshot delete support. There is one exception when deleting `children-only` snapshots. If the snapshot tree is like this example: snap1 (external) | +- snap2 (internal) | +- snap3 (internal) |

[libvirt PATCH v2 19/31] qemu_snapshot: introduce qemuSnapshotDiscardMetadata

2023-01-05 Thread Pavel Hrdina
Extract the code deleting external snapshot metadata to separate function. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 88 +++- 1 file changed, 50 insertions(+), 38 deletions(-) diff --git a/src/qemu/qemu_snapshot.c

[libvirt PATCH v2 12/31] storage_source: introduce virStorageSourceChainLookupBySource

2023-01-05 Thread Pavel Hrdina
Looks up disk storage source within storage source chain using storage source object instead of path to make it work with all disk types. Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 1 + src/storage_file/storage_source.c | 39 +++

[libvirt PATCH v2 15/31] qemu_snapshot: introduce qemuSnapshotDeleteChildren

2023-01-05 Thread Pavel Hrdina
Extract code that deletes children of specific snapshot to separate function. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 109 --- 1 file changed, 68 insertions(+), 41 deletions(-) diff --git

[libvirt PATCH v2 13/31] qemu_snapshot: refactor qemuSnapshotDelete

2023-01-05 Thread Pavel Hrdina
Move code around to make it clear what is called when deleting single snapshot or children snapshots. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 37 - 1 file changed, 20 insertions(+), 17 deletions(-) diff --git

[libvirt PATCH v2 14/31] qemu_snapshot: introduce qemuSnapshotDeleteSingle

2023-01-05 Thread Pavel Hrdina
Extract code that deletes single snapshot to separate function. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 47 ++-- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_snapshot.c

[libvirt PATCH v2 07/31] qemu_monitor_json: allow configuring autofinalize for block commit

2023-01-05 Thread Pavel Hrdina
Deleting external snapshots will require configuring autofinalize to synchronize the block jobs for disks withing single snapshot in order to be able safely abort of one of the jobs fails. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_block.c| 3 ++-

[libvirt PATCH v2 08/31] qemu_block: allow configuring autofinalize for block commit

2023-01-05 Thread Pavel Hrdina
External snapshots will use this to synchronize qemu block jobs. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_block.c | 9 - src/qemu/qemu_block.h | 1 + src/qemu/qemu_driver.c | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git

[libvirt PATCH v2 17/31] qemu_snapshot: move snapshot discard out of qemu_domain.c

2023-01-05 Thread Pavel Hrdina
Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 95 +-- src/qemu/qemu_domain.h | 9 src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_snapshot.c | 96 +++- src/qemu/qemu_snapshot.h

[libvirt PATCH v2 11/31] qemu_blockjob: process QEMU_MONITOR_JOB_STATUS_PENDING signal

2023-01-05 Thread Pavel Hrdina
QEMU emits this signal when the job finished its work and is about to be finalized. If the job is started with autofinalize disabled the job waits for user input to finalize the job. This will be used by snapshot delete code. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_backup.c | 1 +

[libvirt PATCH v2 05/31] qemu_block: add async domain job support to qemuBlockPivot

2023-01-05 Thread Pavel Hrdina
This will allow to use it while having async domain job active which we will use when deleting external snapshots. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_block.c | 4 +++- src/qemu/qemu_block.h | 1 + src/qemu/qemu_driver.c | 2 +- 3 files changed, 5

[libvirt PATCH v2 01/31] libvirt: introduce VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_DELETE

2023-01-05 Thread Pavel Hrdina
This will be used by snapshot delete async domain job. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- include/libvirt/libvirt-domain.h | 1 + tools/virsh-domain.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/libvirt/libvirt-domain.h

[libvirt PATCH v2 09/31] qemu_block: introduce qemuBlockFinalize

2023-01-05 Thread Pavel Hrdina
Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_block.c | 32 src/qemu/qemu_block.h | 5 + 2 files changed, 37 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index da3a1e8557..70811aa861 100644 ---

[libvirt PATCH v2 06/31] qemu_monitor: introduce qemuMonitorJobFinalize

2023-01-05 Thread Pavel Hrdina
Upcoming snapshot deletion code will require that multiple commit jobs are finished in sync. To allow aborting then if one fails we will need to use manual finalization of the jobs. This commit implements the monitor code for `job-finalize`. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa

[libvirt PATCH v2 04/31] qemu_block: add async domain job support to qemuBlockCommit

2023-01-05 Thread Pavel Hrdina
This will allow to use it while having async domain job active which we will use when deleting external snapshots. At the same time we will need to have the block job started as synchronous. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_block.c | 23

[libvirt PATCH v2 03/31] qemu_block: move qemuDomainBlockPivot out of qemu_driver

2023-01-05 Thread Pavel Hrdina
Move the code for finishing a job in the ready state to qemu_block.c. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_block.c | 121 src/qemu/qemu_block.h | 5 ++ src/qemu/qemu_driver.c | 123

[libvirt PATCH v2 02/31] qemu_block: extract block commit code to separate function

2023-01-05 Thread Pavel Hrdina
Signed-off-by: Pavel Hrdina --- src/qemu/qemu_block.c | 177 + src/qemu/qemu_block.h | 9 +++ src/qemu/qemu_driver.c | 162 + 3 files changed, 187 insertions(+), 161 deletions(-) diff --git a/src/qemu/qemu_block.c

  1   2   >