[libvirt] [PATCH] qemuProcessStop: Remove image metadata only when allowed

Michal Privoznik posted 1 patch 4 years, 11 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/7e27df7351077ebf23c309ba0d161707a779cde7.1575477647.git.mprivozn@redhat.com
There is a newer version of this series
src/qemu/qemu_process.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
[libvirt] [PATCH] qemuProcessStop: Remove image metadata only when allowed
Posted by Michal Privoznik 4 years, 11 months ago
In v5.9.0-370-g8fa0374c5b I've tried to fix a bug by removing
some stale XATTRs in qemuProcessStop(). However, I forgot to
do nothing when the VIR_QEMU_PROCESS_STOP_NO_RELABEL flag was
specified. 🤦

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_process.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 75ee3893c6..df19977bb3 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7648,13 +7648,15 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     /* Do this explicitly after vm->pid is reset so that security drivers don't
      * try to enter the domain's namespace which is non-existent by now as qemu
      * is no longer running. */
-    for (i = 0; i < def->ndisks; i++) {
-        virDomainDiskDefPtr disk = def->disks[i];
+    if ((flags & VIR_QEMU_PROCESS_STOP_NO_RELABEL)) {
+        for (i = 0; i < def->ndisks; i++) {
+            virDomainDiskDefPtr disk = def->disks[i];
 
-        if (disk->mirror)
-            qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirror);
+            if (disk->mirror)
+                qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirror);
 
-        qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);
+            qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);
+        }
     }
 
     /* clear all private data entries which are no longer needed */
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemuProcessStop: Remove image metadata only when allowed
Posted by Peter Krempa 4 years, 11 months ago
On Wed, Dec 04, 2019 at 17:40:53 +0100, Michal Privoznik wrote:
> In v5.9.0-370-g8fa0374c5b I've tried to fix a bug by removing
> some stale XATTRs in qemuProcessStop(). However, I forgot to
> do nothing when the VIR_QEMU_PROCESS_STOP_NO_RELABEL flag was
> specified. 🤦

My font does not have the symbol at the end of the line. Please remove
it.

> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_process.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 75ee3893c6..df19977bb3 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -7648,13 +7648,15 @@ void qemuProcessStop(virQEMUDriverPtr driver,
>      /* Do this explicitly after vm->pid is reset so that security drivers don't
>       * try to enter the domain's namespace which is non-existent by now as qemu
>       * is no longer running. */
> -    for (i = 0; i < def->ndisks; i++) {
> -        virDomainDiskDefPtr disk = def->disks[i];
> +    if ((flags & VIR_QEMU_PROCESS_STOP_NO_RELABEL)) {

So you execute this with _NO_RELABEL rather than skipping it in direct
contrast with the commit message.

> +        for (i = 0; i < def->ndisks; i++) {
> +            virDomainDiskDefPtr disk = def->disks[i];
>  
> -        if (disk->mirror)
> -            qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirror);
> +            if (disk->mirror)
> +                qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->mirror);
>  
> -        qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);
> +            qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);
> +        }
>      }
>  
>      /* clear all private data entries which are no longer needed */
> -- 
> 2.23.0
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list