From 516b8676850bf7d97fac1f1a2b7bd08654ef5281 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 4 Dec 2019 17:36:33 +0100 Subject: [PATCH] qemuProcessStop: Remove image metadata only when allowed 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 Reviewed-by: Peter Krempa --- 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..5e178b3c6c 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 */ -- GitLab