示例#1
0
void do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
    double d;
    char *ptr;
    FdMigrationState *s;
    const char *value = qdict_get_str(qdict, "value");

    d = strtod(value, &ptr);
    switch (*ptr) {
    case 'G': case 'g':
        d *= 1024;
    case 'M': case 'm':
        d *= 1024;
    case 'K': case 'k':
        d *= 1024;
    default:
        break;
    }

    max_throttle = (uint32_t)d;
    s = migrate_to_fms(current_migration);

    if (s) {
        qemu_file_set_rate_limit(s->file, max_throttle);
    }
    
}
示例#2
0
文件: migration.c 项目: daisu-mi/qemu
void migrate_fd_cancel(MigrationState *mig_state)
{
    FdMigrationState *s = migrate_to_fms(mig_state);

    if (s->state == MIG_STATE_CANCELLED) {
        return;
    }

    DPRINTF("cancelling migration\n");

    s->state = MIG_STATE_CANCELLED;
    notifier_list_notify(&migration_state_notifiers);

    if (ft_mode) {
        if (s->file) {
            qemu_ft_trans_cancel(s->file);
        }
        ft_mode = FT_OFF;
        event_tap_unregister();
    }

    if (s->file) {
        qemu_savevm_state_cancel(s->mon, s->file);
        migrate_fd_cleanup(s);
    }
}
示例#3
0
文件: migration.c 项目: CPFL/gxen
void migrate_fd_release(MigrationState *mig_state)
{
    FdMigrationState *s = migrate_to_fms(mig_state);

    dprintf("releasing state\n");
   
    if (s->state == MIG_STATE_ACTIVE) {
        s->state = MIG_STATE_CANCELLED;
        migrate_fd_cleanup(s);
    }
    free(s);
}
示例#4
0
void migrate_fd_release(MigrationState *mig_state)
{
    FdMigrationState *s = migrate_to_fms(mig_state);

    DPRINTF("releasing state\n");
   
    if (s->state == MIG_STATE_ACTIVE) {
        s->state = MIG_STATE_CANCELLED;
        notifier_list_notify(&migration_state_notifiers, NULL);
        migrate_fd_cleanup(s);
    }
    g_free(s);
}
示例#5
0
文件: migration.c 项目: CPFL/gxen
void migrate_fd_cancel(MigrationState *mig_state)
{
    FdMigrationState *s = migrate_to_fms(mig_state);

    if (s->state != MIG_STATE_ACTIVE)
        return;

    dprintf("cancelling migration\n");

    s->state = MIG_STATE_CANCELLED;

    migrate_fd_cleanup(s);
}
示例#6
0
文件: migration.c 项目: iggy/qemu
void migrate_fd_cancel(MigrationState *mig_state)
{
    FdMigrationState *s = migrate_to_fms(mig_state);

    if (s->state != MIG_STATE_ACTIVE)
        return;

    DPRINTF("cancelling migration\n");

    s->state = MIG_STATE_CANCELLED;
    qemu_savevm_state_cancel(s->mon, s->file);

    migrate_fd_cleanup(s);
}
示例#7
0
int do_migrate_set_perfvalue(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
    double d;
    FdMigrationState *s;

    d = qdict_get_int(qdict, "value");
    d = MAX(0, d);

    s = migrate_to_fms(current_migration);
    if (s) {
       s->mig_state.metricvalue=d; 
    }

    return 0;
}
示例#8
0
int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
    double d;
    FdMigrationState *s;

    d = qdict_get_double(qdict, "value");
    d = MAX(0, MIN(UINT32_MAX, d));
    max_throttle = d;

    s = migrate_to_fms(current_migration);
    if (s && s->file) {
        qemu_file_set_rate_limit(s->file, max_throttle);
    }

    return 0;
}
示例#9
0
int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
    int64_t d;
    FdMigrationState *s;

    d = qdict_get_int(qdict, "value");
    if (d < 0) {
        d = 0;
    }
    max_throttle = d;

    s = migrate_to_fms(current_migration);
    if (s && s->file) {
        qemu_file_set_rate_limit(s->file, max_throttle);
    }

    return 0;
}
示例#10
0
int migrate_fd_get_status(MigrationState *mig_state)
{
    FdMigrationState *s = migrate_to_fms(mig_state);
    return s->state;
}
示例#11
0
文件: migration.c 项目: daisu-mi/qemu
static int migrate_ft_trans_put_ready(void)
{
    FdMigrationState *s = migrate_to_fms(current_migration);
    int ret = -1, init = 0, timeout;
    static int64_t start, now;

    switch (ft_mode) {
    case FT_INIT:
        init = 1;
        ft_mode = FT_TRANSACTION_BEGIN;
    case FT_TRANSACTION_BEGIN:
        now = start = qemu_get_clock_ns(vm_clock);
        /* start transatcion at best effort */
        qemu_file_set_rate_limit(s->file, 1);

        if (qemu_ft_trans_begin(s->file) < 0) {
            fprintf(stderr, "qemu_transaction_begin failed\n");
            goto error_out;
        }

        vm_stop(0);

        ret = qemu_savevm_trans_begin(s->mon, s->file, init);
        if (ret < 0) {
            fprintf(stderr, "qemu_savevm_trans_begin\n");
            goto error_out;
        }

        if (ret) {
            ft_mode = FT_TRANSACTION_ITER;
            vm_start();
        } else {
            ft_mode = FT_TRANSACTION_COMMIT;
            if (migrate_ft_trans_commit(s) < 0) {
                goto error_out;
            }
        }
        break;

    case FT_TRANSACTION_ITER:
        now = qemu_get_clock_ns(vm_clock);
        timeout = ((now - start) >= max_downtime);
        if (timeout || qemu_savevm_state_iterate(s->mon, s->file) == 1) {
            DPRINTF("ft trans iter timeout %d\n", timeout);

            ft_mode = FT_TRANSACTION_COMMIT;
            if (migrate_ft_trans_commit(s) < 0) {
                goto error_out;
            }
            return 1;
        }

        ft_mode = FT_TRANSACTION_ITER;
        break;

    case FT_TRANSACTION_ATOMIC:
    case FT_TRANSACTION_COMMIT:
        if (migrate_ft_trans_commit(s) < 0) {
            goto error_out;
        }
        break;

    default:
        fprintf(stderr,
                "migrate_ft_trans_put_ready: invalid ft_mode %d", ft_mode);
        goto error_out;
    }

    ret = 0;
    goto out;

error_out:
    migrate_ft_trans_error(s);

out:
    return ret;
}