Commit daa91de28dd011a39b80d76da96c432273fb5bf2

Authored by Glauber Costa
Committed by Anthony Liguori
1 parent 19629537

allow changing the speed of a running migration

This patch allow us to call migrate_set_speed on running
migrations. This should allow mgmt tools to increase the allocated
bandwidth of a running migration if there is no progress, and they
really want the migration to succeed.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 7 additions and 0 deletions
migration.c
@@ -84,6 +84,7 @@ void do_migrate_set_speed(Monitor *mon, const char *value) @@ -84,6 +84,7 @@ void do_migrate_set_speed(Monitor *mon, const char *value)
84 { 84 {
85 double d; 85 double d;
86 char *ptr; 86 char *ptr;
  87 + FdMigrationState *s;
87 88
88 d = strtod(value, &ptr); 89 d = strtod(value, &ptr);
89 switch (*ptr) { 90 switch (*ptr) {
@@ -98,6 +99,12 @@ void do_migrate_set_speed(Monitor *mon, const char *value) @@ -98,6 +99,12 @@ void do_migrate_set_speed(Monitor *mon, const char *value)
98 } 99 }
99 100
100 max_throttle = (uint32_t)d; 101 max_throttle = (uint32_t)d;
  102 + s = migrate_to_fms(current_migration);
  103 +
  104 + if (s) {
  105 + qemu_file_set_rate_limit(s->file, max_throttle);
  106 + }
  107 +
101 } 108 }
102 109
103 void do_info_migrate(Monitor *mon) 110 void do_info_migrate(Monitor *mon)