virt-launcher, migrate: Move migrate flags preparation
Move the migrate flags preparation closer to their usage usage.
@@ -528,13 +528,7 @@ func (l *LibvirtDomainManager) asyncMigrate(vmi *v1.VirtualMachineInstance, opti
}
defer dom.Free()
- migrateFlags := prepareMigrationFlags(isBlockMigration, options.UnsafeMigration, options.AllowAutoConverge, options.AllowPostCopy)
- if options.UnsafeMigration {
- log.Log.Object(vmi).Info("UNSAFE_MIGRATION flag is set, libvirt's migration checks will be disabled!")
- }
-
bandwidth, err := converter.QuantityToMebiByte(options.Bandwidth)
-
if err != nil {
log.Log.Object(vmi).Reason(err).Error("Live migration failed. Invalid bandwidth supplied.")
return
@@ -563,6 +557,11 @@ func (l *LibvirtDomainManager) asyncMigrate(vmi *v1.VirtualMachineInstance, opti
defer close(migrationErrorChan)
go liveMigrationMonitor(vmi, l, options, migrationErrorChan)
+ migrateFlags := prepareMigrationFlags(isBlockMigration, options.UnsafeMigration, options.AllowAutoConverge, options.AllowPostCopy)
+ if options.UnsafeMigration {
+ log.Log.Object(vmi).Info("UNSAFE_MIGRATION flag is set, libvirt's migration checks will be disabled!")
+ }
+
err = dom.MigrateToURI3(dstURI, params, migrateFlags)
if err != nil {
log.Log.Object(vmi).Reason(err).Error("Live migration failed.")
