Commit 0746a926 authored by Dr. David Alan Gilbert's avatar Dr. David Alan Gilbert
Browse files

migration: Don't activate block devices if using -S

Activating the block devices causes the locks to be taken on
the backing file.  If we're running with -S and the destination libvirt
hasn't started the destination with 'cont', it's expecting the locks are
still untaken.

Don't activate the block devices if we're not going to autostart the VM;
'cont' already will do that anyway.

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1560854


Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20180328170207.49512-1-dgilbert@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
parent fc6008f3
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -306,6 +306,13 @@ static void process_incoming_migration_bh(void *opaque)
    Error *local_err = NULL;
    MigrationIncomingState *mis = opaque;

    /* Only fire up the block code now if we're going to restart the
     * VM, else 'cont' will do it.
     * This causes file locking to happen; so we don't want it to happen
     * unless we really are starting the VM.
     */
    if (autostart && (!global_state_received() ||
        global_state_get_runstate() == RUN_STATE_RUNNING)) {
        /* Make sure all file formats flush their mutable metadata.
         * If we get an error here, just don't restart the VM yet. */
        bdrv_invalidate_cache_all(&local_err);
@@ -314,6 +321,7 @@ static void process_incoming_migration_bh(void *opaque)
            local_err = NULL;
            autostart = false;
        }
    }

    /*
     * This must happen after all error conditions are dealt with and