[PATCH 9/9] migration: update image labels in dst after migration

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

 



Bacause the timestamp (the uptime of the host) is used to validate the
remembered labels, it need to update after migration.

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

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index b441d0226c8f..a5f7bd4add97 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5624,6 +5624,7 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
     qemuDomainJobInfo *jobInfo = NULL;
     bool inPostCopy = false;
     bool doKill = true;
+    size_t i;
 
     VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
               "cookieout=%p, cookieoutlen=%p, flags=0x%lx, retcode=%d",
@@ -5831,6 +5832,17 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
     /* Guest is successfully running, so cancel previous auto destroy */
     qemuProcessAutoDestroyRemove(driver, vm);
 
+    for (i = 0; i < vm->def->ndisks; i++) {
+        virStorageSource *src = vm->def->disks[i]->src;
+
+        if (!virStorageSourceIsLocalStorage(src) || !src->path ||
+            virFileIsSharedFS(src->path) < 0)
+            continue;
+
+        if (qemuSecurityUpdateImageLabel(driver, vm, src) < 0)
+            VIR_WARN("Failed to update security label for %s", src->path);
+    }
+
  endjob:
     if (!dom &&
         !(flags & VIR_MIGRATE_OFFLINE) &&
-- 
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