[PATCH 9/9] migration: update image labels in dst after migration
Peng Liang
liangpeng10 at huawei.com
Thu Sep 9 11:33:17 UTC 2021
On 9/9/2021 7:01 PM, Michal Prívozník wrote:
> On 8/23/21 4:41 AM, Peng Liang wrote:
>> 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 at huawei.com>
>> ---
>> 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)
>
> This last check is pretty much useless. virFileIsSharedFS() returns -1
> only on failure. The way it is written completely ignores whether
> src->path is on a shared FS or not.
Oops, I'll fix it in the next version.
Thanks,
Peng
>
>> + 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) &&
>>
>
> Michal
>
> .
>
More information about the libvir-list
mailing list