int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)

{

    MigrationState *s = migrate_get_current();

    const char *p;

    int detach = qdict_get_try_bool(qdict, "detach", 0);

    int blk = qdict_get_try_bool(qdict, "blk", 0);

    int inc = qdict_get_try_bool(qdict, "inc", 0);

    const char *uri = qdict_get_str(qdict, "uri");

    int ret;



    if (s->state == MIG_STATE_ACTIVE) {

        monitor_printf(mon, "migration already in progress\n");

        return -1;

    }



    if (qemu_savevm_state_blocked(mon)) {

        return -1;

    }



    if (migration_blockers) {

        Error *err = migration_blockers->data;

        qerror_report_err(err);

        return -1;

    }



    s = migrate_init(mon, detach, blk, inc);



    if (strstart(uri, "tcp:", &p)) {

        ret = tcp_start_outgoing_migration(s, p);

#if !defined(WIN32)

    } else if (strstart(uri, "exec:", &p)) {

        ret = exec_start_outgoing_migration(s, p);

    } else if (strstart(uri, "unix:", &p)) {

        ret = unix_start_outgoing_migration(s, p);

    } else if (strstart(uri, "fd:", &p)) {

        ret = fd_start_outgoing_migration(s, p);

#endif

    } else {

        monitor_printf(mon, "unknown migration protocol: %s\n", uri);

        ret  = -EINVAL;

    }



    if (ret < 0) {

        monitor_printf(mon, "migration failed: %s\n", strerror(-ret));

        return ret;

    }



    if (detach) {

        s->mon = NULL;

    }



    notifier_list_notify(&migration_state_notifiers, s);

    return 0;

}

int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)

{

    MigrationState *s = migrate_get_current();

    const char *p;

    int detach = qdict_get_try_bool(qdict, "detach", 0);

    int blk = qdict_get_try_bool(qdict, "blk", 0);

    int inc = qdict_get_try_bool(qdict, "inc", 0);

    const char *uri = qdict_get_str(qdict, "uri");

    int ret;



    if (s->state == MIG_STATE_ACTIVE) {

        monitor_printf(mon, "migration already in progress\n");

        return -1;

    }



    if (qemu_savevm_state_blocked(mon)) {

        return -1;

    }



    if (migration_blockers) {

        Error *err = migration_blockers->data;

        qerror_report_err(err);

        return -1;

    }



    s = migrate_init(mon, detach, blk, inc);



    if (strstart(uri, "tcp:", &p)) {

        ret = tcp_start_outgoing_migration(s, p);

#if !defined(WIN32)

    } else if (strstart(uri, "exec:", &p)) {

        ret = exec_start_outgoing_migration(s, p);

    } else if (strstart(uri, "unix:", &p)) {

        ret = unix_start_outgoing_migration(s, p);

    } else if (strstart(uri, "fd:", &p)) {

        ret = fd_start_outgoing_migration(s, p);

#endif

    } else {

        monitor_printf(mon, "unknown migration protocol: %s\n", uri);

        ret  = -EINVAL;

    }



    if (ret < 0) {

        monitor_printf(mon, "migration failed: %s\n", strerror(-ret));

        return ret;

    }



    if (detach) {

        s->mon = NULL;

    }



    notifier_list_notify(&migration_state_notifiers, s);

    return 0;

}

int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2)

{

    MigrationState *s = migrate_get_current();

    const char *VAR_3;

    int VAR_4 = qdict_get_try_bool(VAR_1, "VAR_4", 0);

    int VAR_5 = qdict_get_try_bool(VAR_1, "VAR_5", 0);

    int VAR_6 = qdict_get_try_bool(VAR_1, "VAR_6", 0);

    const char *VAR_7 = qdict_get_str(VAR_1, "VAR_7");

    int VAR_8;



    if (s->state == MIG_STATE_ACTIVE) {

        monitor_printf(VAR_0, "migration already in progress\n");

        return -1;

    }



    if (qemu_savevm_state_blocked(VAR_0)) {

        return -1;

    }



    if (migration_blockers) {

        Error *err = migration_blockers->data;

        qerror_report_err(err);

        return -1;

    }



    s = migrate_init(VAR_0, VAR_4, VAR_5, VAR_6);



    if (strstart(VAR_7, "tcp:", &VAR_3)) {

        VAR_8 = tcp_start_outgoing_migration(s, VAR_3);

#if !defined(WIN32)

    } else if (strstart(VAR_7, "exec:", &VAR_3)) {

        VAR_8 = exec_start_outgoing_migration(s, VAR_3);

    } else if (strstart(VAR_7, "unix:", &VAR_3)) {

        VAR_8 = unix_start_outgoing_migration(s, VAR_3);

    } else if (strstart(VAR_7, "fd:", &VAR_3)) {

        VAR_8 = fd_start_outgoing_migration(s, VAR_3);

#endif

    } else {

        monitor_printf(VAR_0, "unknown migration protocol: %s\n", VAR_7);

        VAR_8  = -EINVAL;

    }



    if (VAR_8 < 0) {

        monitor_printf(VAR_0, "migration failed: %s\n", strerror(-VAR_8));

        return VAR_8;

    }



    if (VAR_4) {

        s->VAR_0 = NULL;

    }



    notifier_list_notify(&migration_state_notifiers, s);

    return 0;

}

int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2)
{ MigrationState *s = migrate_get_current(); const char *VAR_3; int VAR_4 = qdict_get_try_bool(VAR_1, "VAR_4", 0); int VAR_5 = qdict_get_try_bool(VAR_1, "VAR_5", 0); int VAR_6 = qdict_get_try_bool(VAR_1, "VAR_6", 0); const char *VAR_7 = qdict_get_str(VAR_1, "VAR_7"); int VAR_8; if (s->state == MIG_STATE_ACTIVE) { monitor_printf(VAR_0, "migration already in progress\n"); return -1; } if (qemu_savevm_state_blocked(VAR_0)) { return -1; } if (migration_blockers) { Error *err = migration_blockers->data; qerror_report_err(err); return -1; } s = migrate_init(VAR_0, VAR_4, VAR_5, VAR_6); if (strstart(VAR_7, "tcp:", &VAR_3)) { VAR_8 = tcp_start_outgoing_migration(s, VAR_3); #if !defined(WIN32)
} else if (strstart(VAR_7, "exec:", &VAR_3)) { VAR_8 = exec_start_outgoing_migration(s, VAR_3); } else if (strstart(VAR_7, "unix:", &VAR_3)) { VAR_8 = unix_start_outgoing_migration(s, VAR_3); } else if (strstart(VAR_7, "fd:", &VAR_3)) { VAR_8 = fd_start_outgoing_migration(s, VAR_3); #endif
} else { monitor_printf(VAR_0, "unknown migration protocol: %s\n", VAR_7); VAR_8  = -EINVAL; } if (VAR_8 < 0) { monitor_printf(VAR_0, "migration failed: %s\n", strerror(-VAR_8)); return VAR_8; } if (VAR_4) { s->VAR_0 = NULL; } notifier_list_notify(&migration_state_notifiers, s); return 0; }