[PATCH 8/9] migration: don't remove image labels after migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After migration, the image labels will be removed in the src host (on
success) or the dst host (on failure).  However, if we migrate using
shared fs and remove image labels after migration in one host, the image
labels will also lost in another host, which leads to that the ownership
of the image will be restore to root:root instead of the origin
ownership when shutting down the VM.  Hence, don't remove image labels
after migration with shared fs.

Signed-off-by: Peng Liang <liangpeng10@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 77da9992f4e3..1eda7898c861 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8059,7 +8059,10 @@ void qemuProcessStop(virQEMUDriver *driver,
                     qemuHostdevReAttachOneNVMeDisk(driver, vm->def->name, disk->mirror);
             }
 
-            qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);
+            if ((reason != VIR_DOMAIN_SHUTOFF_MIGRATED &&
+                 !(flags & VIR_QEMU_PROCESS_STOP_MIGRATED)) ||
+                virFileIsSharedFS(disk->src->path) <= 0)
+                qemuBlockRemoveImageMetadata(driver, vm, disk->dst, disk->src);
 
             /* for now transient disks are forbidden with migration so they
              * can be handled here */
-- 
2.31.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux