mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
qemuMigrationSrcRun: Don't attempt any storage migration if no disks will be migrated
Don't even try to setup storage migration if there are no eligible disks. This also fixes migration from older libvirts which didn't format an empty <nbd/> element in the migration cookie if there weren't any disks to migrate. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Tested-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
da69f4b208
commit
763a88a358
@ -312,6 +312,22 @@ qemuMigrationAnyCopyDisk(virDomainDiskDef const *disk,
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
qemuMigrationHasAnyStorageMigrationDisks(virDomainDef *def,
|
||||
const char **migrate_disks,
|
||||
size_t nmigrate_disks)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->ndisks; i++) {
|
||||
if (qemuMigrationAnyCopyDisk(def->disks[i], nmigrate_disks, migrate_disks))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuMigrationDstPrecreateStorage(virDomainObj *vm,
|
||||
qemuMigrationCookieNBD *nbd,
|
||||
@ -4011,6 +4027,11 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
|
||||
spec, spec->destType, spec->fwdType, dconn,
|
||||
NULLSTR(graphicsuri), nmigrate_disks, migrate_disks);
|
||||
|
||||
if (storageMigration)
|
||||
storageMigration = qemuMigrationHasAnyStorageMigrationDisks(vm->def,
|
||||
migrate_disks,
|
||||
nmigrate_disks);
|
||||
|
||||
if (storageMigration) {
|
||||
cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user