Revision 5667c493

b/migration.c
109 109
void do_migrate_set_speed(Monitor *mon, const QDict *qdict)
110 110
{
111 111
    double d;
112
    char *ptr;
113 112
    FdMigrationState *s;
114
    const char *value = qdict_get_str(qdict, "value");
115

  
116
    d = strtod(value, &ptr);
117
    switch (*ptr) {
118
    case 'G': case 'g':
119
        d *= 1024;
120
    case 'M': case 'm':
121
        d *= 1024;
122
    case 'K': case 'k':
123
        d *= 1024;
124
    default:
125
        break;
126
    }
127 113

  
128
    max_throttle = (uint32_t)d;
114
    d = qdict_get_double(qdict, "value");
115
    d = MAX(0, MIN(UINT32_MAX, d));
116
    max_throttle = d;
129 117

  
130 118
    s = migrate_to_fms(current_migration);
131 119
    if (s && s->file) {
b/qemu-monitor.hx
761 761

  
762 762
    {
763 763
        .name       = "migrate_set_speed",
764
        .args_type  = "value:s",
764
        .args_type  = "value:b",
765 765
        .params     = "value",
766 766
        .help       = "set maximum speed (in bytes) for migrations",
767 767
        .mhandler.cmd = do_migrate_set_speed,

Also available in: Unified diff