45 lines
1.7 KiB
Diff
45 lines
1.7 KiB
Diff
|
|
From 63846560cf12789ff592374dfc6211d83e693e9d Mon Sep 17 00:00:00 2001
|
||
|
|
From: Michal Privoznik <mprivozn@redhat.com>
|
||
|
|
Date: Mon, 18 May 2020 15:07:46 +0200
|
||
|
|
Subject: [PATCH] qemuProcessStop: Use XATTRs to restore seclabels on disks a
|
||
|
|
domain is mirroring into
|
||
|
|
|
||
|
|
In v5.10.0-rc1~42 (which was later fixed in v6.0.0-rc1~487) I am
|
||
|
|
removing XATTRs for a file that QEMU is mirroring a disk into but
|
||
|
|
it is killed meanwhile. Well, we can call
|
||
|
|
qemuSecurityRestoreImageLabel() which will not only remove XATTRs
|
||
|
|
but also use them to restore the original owner of the file.
|
||
|
|
|
||
|
|
This would be done by blockjob code when the job finishes, but in
|
||
|
|
this case the job won't finish - QEMU is killed meanwhile
|
||
|
|
|
||
|
|
cherry-pick from commit: 0230e3838402624756d6cd913b7d92639fafc7d0
|
||
|
|
|
||
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||
|
|
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||
|
|
Signed-off-by: Jin Yan <jinyan12@huawei.com>
|
||
|
|
---
|
||
|
|
src/qemu/qemu_process.c | 6 ++++--
|
||
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||
|
|
index 6fbe0c1..9285ace 100644
|
||
|
|
--- a/src/qemu/qemu_process.c
|
||
|
|
+++ b/src/qemu/qemu_process.c
|
||
|
|
@@ -7603,8 +7603,10 @@ void qemuProcessStop(virQEMUDriverPtr driver,
|
||
|
|
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) {
|
||
|
|
+ if (qemuSecurityRestoreImageLabel(driver, vm, disk->mirror, false) < 0)
|
||
|
|
+ VIR_WARN("Unable to restore security label on %s", disk->dst);
|
||
|
|
+ }
|
||
|
|
|
||
|
|
qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);
|
||
|
|
}
|
||
|
|
--
|
||
|
|
1.8.3.1
|
||
|
|
|