Skip to contentSkip to conversation

Make info migrate output consistent

PATCH In review Juan Quintela 4 participants 8 messages Jun 7, 2017 – Jun 12, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover Make info migrate output consistent

Hi

Changes for v2:
- patches 1 & 2 in previous pull requset
- create function populate_disk_info (dave suggestion)

Please, review.

Thanks, Juan.

[v1]
This series make the output of info migrate be printed in a single place for the states ACTIVE, CANCELLING and POSTCOPY_ACTIVE.

The code was duplicated, just use the same code. Once done that, fix the inconsistences that were not needed.

Juan Quintela (2):
ram: Print block stats also in the complete case
ram: Now POSTCOPY_ACTIVE is the same that STATUS_ACTIVE

 migration/migration.c | 43 +++++++++++++------------------------------
 1 file changed, 13 insertions(+), 30 deletions(-)
Signature · 1 line
2.9.4
#1 lore raw

PATCH v2 1/2 ram: Print block stats also in the complete case

Once there, create populate_disk_info.

--

- create populate_disk_info instead of "abusing" populate_ram_info

---
 migration/migration.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)
migration/migration.c +13 -18
index 4dbc4f2..cfa266b 100644
@@ -515,6 +515,17 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
     }
 }
 
+static void populate_disk_info(MigrationInfo *info)
+{
+    if (blk_mig_active()) {
+        info->has_disk = true;
+        info->disk = g_malloc0(sizeof(*info->disk));
+        info->disk->transferred = blk_mig_bytes_transferred();
+        info->disk->remaining = blk_mig_bytes_remaining();
+        info->disk->total = blk_mig_bytes_total();
+    }
+}
+
 MigrationInfo *qmp_query_migrate(Error **errp)
 {
     MigrationInfo *info = g_malloc0(sizeof(*info));
@@ -540,15 +551,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         info->setup_time = s->setup_time;
 
         populate_ram_info(info, s);
-
-        if (blk_mig_active()) {
-            info->has_disk = true;
-            info->disk = g_malloc0(sizeof(*info->disk));
-            info->disk->transferred = blk_mig_bytes_transferred();
-            info->disk->remaining = blk_mig_bytes_remaining();
-            info->disk->total = blk_mig_bytes_total();
-        }
-
+        populate_disk_info(info);
         break;
     case MIGRATION_STATUS_POSTCOPY_ACTIVE:
         /* Mostly the same as active; TODO add some postcopy stats */
@@ -562,15 +565,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         info->setup_time = s->setup_time;
 
         populate_ram_info(info, s);
-
-        if (blk_mig_active()) {
-            info->has_disk = true;
-            info->disk = g_malloc0(sizeof(*info->disk));
-            info->disk->transferred = blk_mig_bytes_transferred();
-            info->disk->remaining = blk_mig_bytes_remaining();
-            info->disk->total = blk_mig_bytes_total();
-        }
-
+        populate_disk_info(info);
         break;
     case MIGRATION_STATUS_COLO:
         info->has_status = true;
Signature · 1 line
2.9.4
#4 lore raw

PATCH v2 2/2 ram: Now POSTCOPY_ACTIVE is the same that STATUS_ACTIVE

In reply to Juan Quintela

Merge them.

---
 migration/migration.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
migration/migration.c +1 -13
index cfa266b..b31a195 100644
@@ -541,20 +541,8 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         break;
     case MIGRATION_STATUS_ACTIVE:
     case MIGRATION_STATUS_CANCELLING:
-        info->has_status = true;
-        info->has_total_time = true;
-        info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
-            - s->total_time;
-        info->has_expected_downtime = true;
-        info->expected_downtime = s->expected_downtime;
-        info->has_setup_time = true;
-        info->setup_time = s->setup_time;
-
-        populate_ram_info(info, s);
-        populate_disk_info(info);
-        break;
     case MIGRATION_STATUS_POSTCOPY_ACTIVE:
-        /* Mostly the same as active; TODO add some postcopy stats */
+         /* TODO add some postcopy stats */
         info->has_status = true;
         info->has_total_time = true;
         info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
Signature · 1 line
2.9.4
Reviewed-by on the v2 series
#7 lore raw
In reply to Juan Quintela
Quoted 8 lines · Juan Quintela

Hi

Changes for v2:
- patches 1 & 2 in previous pull requset
- create function populate_disk_info (dave suggestion)

Please, review.

Quoted 8 lines

Thanks, Juan.

[v1]
This series make the output of info migrate be printed in a single place for the states ACTIVE, CANCELLING and POSTCOPY_ACTIVE.

The code was duplicated, just use the same code. Once done that, fix the inconsistences that were not needed.

I feel that putting cpu throttling info into populate_ram_info() is still slightly weird, but hmm it's okay and that's trivial.

Thanks,

Signature · 1 line
Peter Xu
Reviewed-by on v2 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH v2 1/2] ram: Print block stats also in the complete case

In reply to Juan Quintela
Quoted 3 lines · * Juan Quintela ([email protected]) wrote:

Once there, create populate_disk_info.

Quoted 67 lines

--

- create populate_disk_info instead of "abusing" populate_ram_info

---
 migration/migration.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)
migration/migration.c +13 -18
index 4dbc4f2..cfa266b 100644
@@ -515,6 +515,17 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
     }
 }
 
+static void populate_disk_info(MigrationInfo *info)
+{
+    if (blk_mig_active()) {
+        info->has_disk = true;
+        info->disk = g_malloc0(sizeof(*info->disk));
+        info->disk->transferred = blk_mig_bytes_transferred();
+        info->disk->remaining = blk_mig_bytes_remaining();
+        info->disk->total = blk_mig_bytes_total();
+    }
+}
+
 MigrationInfo *qmp_query_migrate(Error **errp)
 {
     MigrationInfo *info = g_malloc0(sizeof(*info));
@@ -540,15 +551,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         info->setup_time = s->setup_time;
 
         populate_ram_info(info, s);
-
-        if (blk_mig_active()) {
-            info->has_disk = true;
-            info->disk = g_malloc0(sizeof(*info->disk));
-            info->disk->transferred = blk_mig_bytes_transferred();
-            info->disk->remaining = blk_mig_bytes_remaining();
-            info->disk->total = blk_mig_bytes_total();
-        }
-
+        populate_disk_info(info);
         break;
     case MIGRATION_STATUS_POSTCOPY_ACTIVE:
         /* Mostly the same as active; TODO add some postcopy stats */
@@ -562,15 +565,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         info->setup_time = s->setup_time;
 
         populate_ram_info(info, s);
-
-        if (blk_mig_active()) {
-            info->has_disk = true;
-            info->disk = g_malloc0(sizeof(*info->disk));
-            info->disk->transferred = blk_mig_bytes_transferred();
-            info->disk->remaining = blk_mig_bytes_remaining();
-            info->disk->total = blk_mig_bytes_total();
-        }
-
+        populate_disk_info(info);
         break;
     case MIGRATION_STATUS_COLO:
         info->has_status = true;
Signature · 1 line
2.9.4

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Reviewed-by on v2 2/2
#5 lore raw

Re: [Qemu-devel] [PATCH v2 2/2] ram: Now POSTCOPY_ACTIVE is the same that STATUS_ACTIVE

In reply to Juan Quintela
Quoted 4 lines · * Juan Quintela ([email protected]) wrote:

Merge them.

Quoted 33 lines
---
 migration/migration.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
migration/migration.c +1 -13
index cfa266b..b31a195 100644
@@ -541,20 +541,8 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         break;
     case MIGRATION_STATUS_ACTIVE:
     case MIGRATION_STATUS_CANCELLING:
-        info->has_status = true;
-        info->has_total_time = true;
-        info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
-            - s->total_time;
-        info->has_expected_downtime = true;
-        info->expected_downtime = s->expected_downtime;
-        info->has_setup_time = true;
-        info->setup_time = s->setup_time;
-
-        populate_ram_info(info, s);
-        populate_disk_info(info);
-        break;
     case MIGRATION_STATUS_POSTCOPY_ACTIVE:
-        /* Mostly the same as active; TODO add some postcopy stats */
+         /* TODO add some postcopy stats */
         info->has_status = true;
         info->has_total_time = true;
         info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
Signature · 1 line
2.9.4

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Reviewed-by on v2 1/2
#3 lore raw

Re: [Qemu-devel] [PATCH v2 1/2] ram: Print block stats also in the complete case

In reply to Juan Quintela
Quoted 3 lines · Juan Quintela

Once there, create populate_disk_info.

Quoted 65 lines

--

- create populate_disk_info instead of "abusing" populate_ram_info

---
 migration/migration.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)
migration/migration.c +13 -18
index 4dbc4f2..cfa266b 100644
@@ -515,6 +515,17 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
     }
 }
 
+static void populate_disk_info(MigrationInfo *info)
+{
+    if (blk_mig_active()) {
+        info->has_disk = true;
+        info->disk = g_malloc0(sizeof(*info->disk));
+        info->disk->transferred = blk_mig_bytes_transferred();
+        info->disk->remaining = blk_mig_bytes_remaining();
+        info->disk->total = blk_mig_bytes_total();
+    }
+}
+
 MigrationInfo *qmp_query_migrate(Error **errp)
 {
     MigrationInfo *info = g_malloc0(sizeof(*info));
@@ -540,15 +551,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         info->setup_time = s->setup_time;
 
         populate_ram_info(info, s);
-
-        if (blk_mig_active()) {
-            info->has_disk = true;
-            info->disk = g_malloc0(sizeof(*info->disk));
-            info->disk->transferred = blk_mig_bytes_transferred();
-            info->disk->remaining = blk_mig_bytes_remaining();
-            info->disk->total = blk_mig_bytes_total();
-        }
-
+        populate_disk_info(info);
         break;
     case MIGRATION_STATUS_POSTCOPY_ACTIVE:
         /* Mostly the same as active; TODO add some postcopy stats */
@@ -562,15 +565,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         info->setup_time = s->setup_time;
 
         populate_ram_info(info, s);
-
-        if (blk_mig_active()) {
-            info->has_disk = true;
-            info->disk = g_malloc0(sizeof(*info->disk));
-            info->disk->transferred = blk_mig_bytes_transferred();
-            info->disk->remaining = blk_mig_bytes_remaining();
-            info->disk->total = blk_mig_bytes_total();
-        }
-
+        populate_disk_info(info);
         break;
     case MIGRATION_STATUS_COLO:
         info->has_status = true;
Reviewed-by on v2 2/2
#6 lore raw

Re: [Qemu-devel] [PATCH v2 2/2] ram: Now POSTCOPY_ACTIVE is the same that STATUS_ACTIVE

In reply to Juan Quintela
Quoted 4 lines · Juan Quintela

Merge them.

Quoted 31 lines
---
 migration/migration.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
migration/migration.c +1 -13
index cfa266b..b31a195 100644
@@ -541,20 +541,8 @@ MigrationInfo *qmp_query_migrate(Error **errp)
         break;
     case MIGRATION_STATUS_ACTIVE:
     case MIGRATION_STATUS_CANCELLING:
-        info->has_status = true;
-        info->has_total_time = true;
-        info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)
-            - s->total_time;
-        info->has_expected_downtime = true;
-        info->expected_downtime = s->expected_downtime;
-        info->has_setup_time = true;
-        info->setup_time = s->setup_time;
-
-        populate_ram_info(info, s);
-        populate_disk_info(info);
-        break;
     case MIGRATION_STATUS_POSTCOPY_ACTIVE:
-        /* Mostly the same as active; TODO add some postcopy stats */
+         /* TODO add some postcopy stats */
         info->has_status = true;
         info->has_total_time = true;
         info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME)