Add spent time for migration
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 2b6cf8e2cf421bb6645a653bd7d79a5d321faee1.1340987905.git.quintela@redhat.com
Quoted 5 lines · On Fri, 29 Jun 2012 18:43:57 +0200 Juan Quintela <[email protected]> wrote:
We add time spent for migration to the output of "info migrate" command. '
total_time' means time since the start fo migration if migration is 'active', and total time of migration if migration is completed. As we are also interested in transferred ram when migration completes, adding all ram statistics
I see this has already been merged and am sorry for being late with my review, but it turns out that there are a few issues to be addressed in this patch, comments inlined below.
Another point is that this patch extends the query-migrate command. We've decided not to extend QMP commands, however I think that we should relax that restriction for query commands, because the client doesn't need to know the new fields in advance.
Quoted 14 lines
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 2 ++ migration.c | 11 +++++++++++ migration.h | 1 + qapi-schema.json | 12 +++++++++--- 4 files changed, 23 insertions(+), 3 deletions(-)hmp.c +0
-0
hmp.c void hmp_info_migrate(Monitor *mon) · line 149
Quoted 5 lines
hmp.c +2
-0@@ -145,6 +145,8 @@ void hmp_info_migrate(Monitor *mon) info->ram->remaining >> 10);monitor_printf (mon,"total ram: %" PRIu64" kbytes\n" , info->ram->total >>10 ); +monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , + info->ram->total_time);
This adds a new line to the HMP output between the end of the ram stats and the disk stats. Iirc libvirt parses this output when in non-json mode, although I don't think it ever does it for disk migration.
Eric, does libvirt do that?
Btw, we'll need to change where 'total_time' is printed, see below.
Quoted 8 lines
hmp.c +0
-0}if (info->has_disk) {migration.c +0
-0
migration.c MigrationInfo *qmp_query_migrate(Error **errp) · line 136
Quoted 6 lines
migration.c +2
-0@@ -131,6 +131,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->transferred =ram_bytes_transferred (); info->ram->remaining =ram_bytes_remaining (); info->ram->total =ram_bytes_total (); + info->ram->total_time =qemu_get_clock_ms (rt_clock) + - s->total_time;
I really don't think that 'total_time' pertains to the ram stats info, I think it should be in the MigrationInfo dict.
migration.c MigrationInfo *qmp_query_migrate(Error **errp) · line 154
Quoted 13 lines
migration.c +7
-0if (blk_mig_active ()) { info->has_disk = true;@@ -143,6 +145,13 @@ MigrationInfo *qmp_query_migrate(Error **errp)case MIG_STATE_COMPLETED : info->has_status = true; info->status =g_strdup ("completed" ); + + info->has_ram = true; + info->ram =g_malloc0 (sizeof (*info->ram)); + info->ram->transferred =ram_bytes_transferred (); + info->ram->remaining =0 ; + info->ram->total =ram_bytes_total (); + info->ram->total_time = s->total_time;
Having the 'total_time' in the MigrationInfo dict would avoid this change.
Quoted 36 lines
migration.c +2
-0break ;case MIG_STATE_ERROR : info->has_status = true;@@ -260,6 +269,7 @@ static void migrate_fd_put_ready(void *opaque) }else {migrate_fd_completed (s); } + s->total_time =qemu_get_clock_ms (rt_clock) - s->total_time;if (s->state !=MIG_STATE_COMPLETED ) {if (old_vm_running) {vm_start ();@@ -372,6 +382,7 @@ static MigrationState *migrate_init(const MigrationParams *params) s->bandwidth_limit = bandwidth_limit; s->state =MIG_STATE_SETUP ; + s->total_time =qemu_get_clock_ms (rt_clock);return s; }migration.h +1
-0@@ -37,6 +37,7 @@ struct MigrationStateint (*write)(MigrationState *s,const void *buff,size_t size);void *opaque;MigrationParams params; +int64_t total_time; };void process_incoming_migration (QEMUFile *f);qapi-schema.json +0
-0
qapi-schema.json line 263
Quoted 4 lines
qapi-schema.json +1
-0@@ -260,10 +260,15 @@ # # @total: total amount of bytes involved in the migration process # +# @total_time: tota0l amount of ms since migration started. If
s/total0l/total
s/ms/miliseconds
Quoted 24 lines
qapi-schema.json +8
-3+# migration has ended, it returns the total migration +# time. (since 1.2) +# # Since: 0.14.0. ## { 'type': 'MigrationStats', - 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' } } + 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , + 'total_time': 'int' } } ## # @MigrationInfo@@ -275,8 +280,9 @@ # 'cancelled'. If this field is not returned, no migration process # has been initiated # -# @ram: #optional @MigrationStats containing detailed migration status, -# only returned if status is 'active' +# @ram: #optional @MigrationStats containing detailed migration +# status, only returned if status is 'active' or +# 'completed'. 'comppleted' (since 1.2) # # @disk: #optional @MigrationStats containing detailed disk migration # status, only returned if status is 'active' and it is a block
Quoted 9 lines · Luiz Capitulino
Quoted 5 lines · On Fri, 29 Jun 2012 18:43:57 +0200 Juan Quintela <[email protected]> wrote:
We add time spent for migration to the output of "info migrate" command. '
total_time' means time since the start fo migration if migration is 'active', and total time of migration if migration is completed. As we are also interested in transferred ram when migration completes, adding all ram statistics
Quoted 8 lines
I see this has already been merged and am sorry for being late with my review, but it turns out that there are a few issues to be addressed in this patch, comments inlined below.
Another point is that this patch extends the query-migrate command. We've decided not to extend QMP commands, however I think that we should relax that restriction for query commands, because the client doesn't need to know the new fields in advance.
I see a difference between extending output (such as query command return values), where clients can gracefully deal with the absence of a parameter from an older qemu, and extending input (where it is hard to tell up-front whether a parameter will be rejected by an older qemu). This is a case of extending output, so I am okay with it; in fact, I'd rather extend output of existing commands than add a new command, because then libvirt has to probe which command to call, instead of calling one command and then parsing everything available.
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ monitor_printf(mon, "total time: %" PRIu64 " milliseconds\n", + info->ram->total_time);This adds a new line to the HMP output between the end of the ram stats and the disk stats. Iirc libvirt parses this output when in non-json mode, although I don't think it ever does it for disk migration.
Eric, does libvirt do that?
Libvirt forces the use of QMP for qemu 0.15 and newer. So while there may be other users that care, libvirt could care less whether HMP output changes between qemu 1.1 and 1.2.
Quoted 11 lines
Review MigrationInfo *qmp_query_migrate(Error **errp) · line 136
Quoted 8 lines
+++
b/migration.c(quoted diff) +2
-0@@ -131,6 +131,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->transferred = ram_bytes_transferred(); info->ram->remaining = ram_bytes_remaining(); info->ram->total = ram_bytes_total(); + info->ram->total_time = qemu_get_clock_ms(rt_clock) + - s->total_time;I really don't think that '
total_time' pertains to the ram stats info, I think it should be in the MigrationInfo dict.
If so, now's the time to change it before it becomes locked in stone with the qemu 1.2 release. Libvirt has not yet been taught to use the new information.
Quoted 8 lines
Quoted 4 lines
(quoted diff) +0
-0# # @total: total amount of bytes involved in the migration process#
+# @total_time: tota0l amount of ms since migration started. Ifs/total0l/total
s/ms/miliseconds
Actually, milliseconds
Quoted 10 lines
Review
Quoted 10 lines
(quoted diff) +5
-1+# migration has ended, it returns the total migration +# time. (since 1.2) +# # Since: 0.14.0. ## { 'type': 'MigrationStats', - 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' } } + 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , + 'total_time': 'int' } }
Also, s/total_time/total-time/ - QMP favors '-' over '_'
Quoted 5 lines
Review line 280
Quoted 5 lines
##
# @MigrationInfo(quoted diff) +0
-0@@ -275,8 +280,9 @@ # 'cancelled'. If this field is not returned, no migration process
Did we ever decide whether to favor US (canceled) or UK (cancelled)?
Quoted 7 lines
Review line 285
Quoted 7 lines
(quoted diff) +3
-2# has been initiated # -# @ram: #optional @MigrationStats containing detailed migration status, -# only returned if status is 'active' +# @ram: #optional @MigrationStats containing detailed migration +# status, only returned if status is 'active' or +# 'completed'. 'comppleted' (since 1.2)
s/comppleted/completed/
Quoted 6 lines
Quoted 3 lines
(quoted diff) +0
-0# # @disk: #optional @MigrationStats containing detailed disk migration # status, only returned if status is 'active' and it is a block
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 19 lines · On Wed, 11 Jul 2012 12:25:38 -0600 Eric Blake <[email protected]> wrote:
Quoted 9 lines · Luiz Capitulino
Quoted 5 lines · On Fri, 29 Jun 2012 18:43:57 +0200 Juan Quintela <[email protected]> wrote:
We add time spent for migration to the output of "info migrate" command. '
total_time' means time since the start fo migration if migration is 'active', and total time of migration if migration is completed. As we are also interested in transferred ram when migration completes, adding all ram statisticsQuoted 8 lines
I see this has already been merged and am sorry for being late with my review, but it turns out that there are a few issues to be addressed in this patch, comments inlined below.
Another point is that this patch extends the query-migrate command. We've decided not to extend QMP commands, however I think that we should relax that restriction for query commands, because the client doesn't need to know the new fields in advance.
Quoted 8 lines
I see a difference between extending output (such as query command return values), where clients can gracefully deal with the absence of a parameter from an older qemu, and extending input (where it is hard to tell up-front whether a parameter will be rejected by an older qemu). This is a case of extending output, so I am okay with it; in fact, I'd rather extend output of existing commands than add a new command, because then libvirt has to probe which command to call, instead of calling one command and then parsing everything available.
Yes, agreed. At least until we have libqmp...
Quoted 7 lines
Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ monitor_printf(mon, "total time: %" PRIu64 " milliseconds\n", + info->ram->total_time);This adds a new line to the HMP output between the end of the ram stats and the disk stats. Iirc libvirt parses this output when in non-json mode, although I don't think it ever does it for disk migration.
Quoted 5 lines
Quoted 1 line
Eric, does libvirt do that?
Libvirt forces the use of QMP for qemu 0.15 and newer. So while there may be other users that care, libvirt could care less whether HMP output changes between qemu 1.1 and 1.2.
Good to know.
Quoted 13 lines
Quoted 12 lines
Review MigrationInfo *qmp_query_migrate(Error **errp) · line 136
Quoted 9 lines
+++
b/migration.c(quoted diff) +2
-0@@ -131,6 +131,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->transferred = ram_bytes_transferred(); info->ram->remaining = ram_bytes_remaining(); info->ram->total = ram_bytes_total(); + info->ram->total_time = qemu_get_clock_ms(rt_clock) + - s->total_time;I really don't think that '
total_time' pertains to the ram stats info, I think it should be in the MigrationInfo dict.
Quoted 3 lines
If so, now's the time to change it before it becomes locked in stone with the qemu 1.2 release. Libvirt has not yet been taught to use the new information.
Juan, if you agree with the change I can do it myself, or you could submit the patch and I'll apply it to the QMP tree.
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
(quoted diff) +0
-0# # @total: total amount of bytes involved in the migration process#
+# @total_time: tota0l amount of ms since migration started. Ifs/total0l/total
s/ms/miliseconds
Actually, milliseconds
Thanks.
Quoted 13 lines
Quoted 9 lines
Review
Quoted 9 lines
(quoted diff) +5
-1+# migration has ended, it returns the total migration +# time. (since 1.2) +# # Since: 0.14.0. ## { 'type': 'MigrationStats', - 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' } } + 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , + 'total_time': 'int' } }Also, s/total_time/total-time/ - QMP favors '-' over '_'
Quoted 1 line
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Review line 280
Quoted 4 lines
##
# @MigrationInfo(quoted diff) +0
-0@@ -275,8 +280,9 @@ # 'cancelled'. If this field is not returned, no migration processDid we ever decide whether to favor US (canceled) or UK (cancelled)?
I don't think so :) Maybe we should accept both?
Would a UK grammar teacher mark 'canceled' as wrong (or vice-versa in the US)? :)
Quoted 18 lines
Quoted 8 lines
Review line 285
Quoted 8 lines
(quoted diff) +3
-2# has been initiated # -# @ram: #optional @MigrationStats containing detailed migration status, -# only returned if status is 'active' +# @ram: #optional @MigrationStats containing detailed migration +# status, only returned if status is 'active' or +# 'completed'. 'comppleted' (since 1.2)s/comppleted/completed/
Quoted 6 lines
Quoted 3 lines
(quoted diff) +0
-0# # @disk: #optional @MigrationStats containing detailed disk migration # status, only returned if status is 'active' and it is a block
Quoted 63 lines · Luiz Capitulino
Quoted 19 lines · On Wed, 11 Jul 2012 12:25:38 -0600 Eric Blake <[email protected]> wrote:
Quoted 9 lines · Luiz Capitulino
Quoted 5 lines · On Fri, 29 Jun 2012 18:43:57 +0200 Juan Quintela <[email protected]> wrote:
We add time spent for migration to the output of "info migrate" command. '
total_time' means time since the start fo migration if migration is 'active', and total time of migration if migration is completed. As we are also interested in transferred ram when migration completes, adding all ram statisticsQuoted 8 lines
I see this has already been merged and am sorry for being late with my review, but it turns out that there are a few issues to be addressed in this patch, comments inlined below.
Another point is that this patch extends the query-migrate command. We've decided not to extend QMP commands, however I think that we should relax that restriction for query commands, because the client doesn't need to know the new fields in advance.
Quoted 8 lines
I see a difference between extending output (such as query command return values), where clients can gracefully deal with the absence of a parameter from an older qemu, and extending input (where it is hard to tell up-front whether a parameter will be rejected by an older qemu). This is a case of extending output, so I am okay with it; in fact, I'd rather extend output of existing commands than add a new command, because then libvirt has to probe which command to call, instead of calling one command and then parsing everything available.
Yes, agreed. At least until we have libqmp...
Quoted 8 lines
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ monitor_printf(mon, "total time: %" PRIu64 " milliseconds\n", + info->ram->total_time);This adds a new line to the HMP output between the end of the ram stats and the disk stats. Iirc libvirt parses this output when in non-json mode, although
I don't think it ever does it for disk migration.Quoted 5 lines
Quoted 1 line
Eric, does libvirt do that?
Libvirt forces the use of QMP for qemu 0.15 and newer. So while there may be other users that care, libvirt could care less whether HMP output changes between qemu 1.1 and 1.2.
Good to know.
Quoted 14 lines
Quoted 13 lines
Review MigrationInfo *qmp_query_migrate(Error **errp) · line 136
Quoted 9 lines
+++
b/migration.c(quoted diff) +2
-0@@ -131,6 +131,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->transferred = ram_bytes_transferred(); info->ram->remaining = ram_bytes_remaining(); info->ram->total = ram_bytes_total(); + info->ram->total_time = qemu_get_clock_ms(rt_clock) + - s->total_time;I really don't think that '
total_time' pertains to the ram stats info, I think
it should be in the MigrationInfo dict.
Quoted 6 lines
Quoted 3 lines
If so, now's the time to change it before it becomes locked in stone with the qemu 1.2 release. Libvirt has not yet been taught to use the new information.
Juan, if you agree with the change I can do it myself, or you could submit the patch and I'll apply it to the QMP tree.
I can send a patch.
Thanks for the review, Juan.
Quoted 5 lines · On Fri, 29 Jun 2012 18:43:57 +0200 Juan Quintela <[email protected]> wrote:
We add time spent for migration to the output of "info migrate" command. '
total_time' means time since the start fo migration if migration is 'active', and total time of migration if migration is completed. As we are also interested in transferred ram when migration completes, adding all ram statistics
I see this has already been merged and am sorry for being late with my review, but it turns out that there are a few issues to be addressed in this patch, comments inlined below.
Another point is that this patch extends the query-migrate command. We've decided not to extend QMP commands, however I think that we should relax that restriction for query commands, because the client doesn't need to know the new fields in advance.
Quoted 14 lines
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 2 ++ migration.c | 11 +++++++++++ migration.h | 1 + qapi-schema.json | 12 +++++++++--- 4 files changed, 23 insertions(+), 3 deletions(-)hmp.c +0
-0
hmp.c void hmp_info_migrate(Monitor *mon) · line 149
Quoted 5 lines
hmp.c +2
-0@@ -145,6 +145,8 @@ void hmp_info_migrate(Monitor *mon) info->ram->remaining >> 10);monitor_printf (mon,"total ram: %" PRIu64" kbytes\n" , info->ram->total >>10 ); +monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , + info->ram->total_time);
This adds a new line to the HMP output between the end of the ram stats and the disk stats. Iirc libvirt parses this output when in non-json mode, although I don't think it ever does it for disk migration.
Eric, does libvirt do that?
Btw, we'll need to change where 'total_time' is printed, see below.
Quoted 8 lines
hmp.c +0
-0}if (info->has_disk) {migration.c +0
-0
migration.c MigrationInfo *qmp_query_migrate(Error **errp) · line 136
Quoted 6 lines
migration.c +2
-0@@ -131,6 +131,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->transferred =ram_bytes_transferred (); info->ram->remaining =ram_bytes_remaining (); info->ram->total =ram_bytes_total (); + info->ram->total_time =qemu_get_clock_ms (rt_clock) + - s->total_time;
I really don't think that 'total_time' pertains to the ram stats info, I think it should be in the MigrationInfo dict.
migration.c MigrationInfo *qmp_query_migrate(Error **errp) · line 154
Quoted 13 lines
migration.c +7
-0if (blk_mig_active ()) { info->has_disk = true;@@ -143,6 +145,13 @@ MigrationInfo *qmp_query_migrate(Error **errp)case MIG_STATE_COMPLETED : info->has_status = true; info->status =g_strdup ("completed" ); + + info->has_ram = true; + info->ram =g_malloc0 (sizeof (*info->ram)); + info->ram->transferred =ram_bytes_transferred (); + info->ram->remaining =0 ; + info->ram->total =ram_bytes_total (); + info->ram->total_time = s->total_time;
Having the 'total_time' in the MigrationInfo dict would avoid this change.
Quoted 36 lines
migration.c +2
-0break ;case MIG_STATE_ERROR : info->has_status = true;@@ -260,6 +269,7 @@ static void migrate_fd_put_ready(void *opaque) }else {migrate_fd_completed (s); } + s->total_time =qemu_get_clock_ms (rt_clock) - s->total_time;if (s->state !=MIG_STATE_COMPLETED ) {if (old_vm_running) {vm_start ();@@ -372,6 +382,7 @@ static MigrationState *migrate_init(const MigrationParams *params) s->bandwidth_limit = bandwidth_limit; s->state =MIG_STATE_SETUP ; + s->total_time =qemu_get_clock_ms (rt_clock);return s; }migration.h +1
-0@@ -37,6 +37,7 @@ struct MigrationStateint (*write)(MigrationState *s,const void *buff,size_t size);void *opaque;MigrationParams params; +int64_t total_time; };void process_incoming_migration (QEMUFile *f);qapi-schema.json +0
-0
qapi-schema.json line 263
Quoted 4 lines
qapi-schema.json +1
-0@@ -260,10 +260,15 @@ # # @total: total amount of bytes involved in the migration process # +# @total_time: tota0l amount of ms since migration started. If
s/total0l/total
s/ms/miliseconds
Quoted 24 lines
qapi-schema.json +8
-3+# migration has ended, it returns the total migration +# time. (since 1.2) +# # Since: 0.14.0. ## { 'type': 'MigrationStats', - 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' } } + 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , + 'total_time': 'int' } } ## # @MigrationInfo@@ -275,8 +280,9 @@ # 'cancelled'. If this field is not returned, no migration process # has been initiated # -# @ram: #optional @MigrationStats containing detailed migration status, -# only returned if status is 'active' +# @ram: #optional @MigrationStats containing detailed migration +# status, only returned if status is 'active' or +# 'completed'. 'comppleted' (since 1.2) # # @disk: #optional @MigrationStats containing detailed disk migration # status, only returned if status is 'active' and it is a block
Quoted 42 lines · Luiz Capitulino
Quoted 5 lines · On Fri, 29 Jun 2012 18:43:57 +0200 Juan Quintela <[email protected]> wrote:
We add time spent for migration to the output of "info migrate" command. '
total_time' means time since the start fo migration if migration is 'active', and total time of migration if migration is completed. As we are also interested in transferred ram when migration completes, adding all ram statisticsI see this has already been merged and am sorry for being late with my review, but it turns out that there are a few issues to be addressed in this patch, comments inlined below.
Another point is that this patch extends the query-migrate command. We've decided not to extend QMP commands, however I think that we should relax that restriction for query commands, because the client doesn't need to know the new fields in advance.
Quoted 14 lines
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 2 ++ migration.c | 11 +++++++++++ migration.h | 1 + qapi-schema.json | 12 +++++++++--- 4 files changed, 23 insertions(+), 3 deletions(-)hmp.c +0
-0hmp.c void hmp_info_migrate(Monitor *mon) · line 149
Quoted 5 lines
hmp.c +2
-0@@ -145,6 +145,8 @@ void hmp_info_migrate(Monitor *mon) info->ram->remaining >> 10);monitor_printf (mon,"total ram: %" PRIu64" kbytes\n" , info->ram->total >>10 ); +monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , + info->ram->total_time);This adds a new line to the HMP output between the end of the ram stats and the disk stats. Iirc libvirt parses this output when in non-json mode, although I don't think it ever does it for disk migration.
Quoted 1 line
Eric, does libvirt do that?
Non-issue. Libvirt insists on using QMP (JSON mode) if qemu >= 0.15, precisely so that changes to HMP do not affect libvirt parsing.
Quoted 11 lines
hmp.c MigrationInfo *qmp_query_migrate(Error **errp) · line 136
Quoted 8 lines
hmp.c +3
-0+++ b/migration.c@@ -131,6 +131,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->ram->transferred =ram_bytes_transferred (); info->ram->remaining =ram_bytes_remaining (); info->ram->total =ram_bytes_total (); + info->ram->total_time =qemu_get_clock_ms (rt_clock) + - s->total_time;I really don't think that '
total_time' pertains to the ram stats info, I think it should be in the MigrationInfo dict.
Yes, Juan took care of that in
https://lists.gnu.org/archive/html/qemu-devel/2012-08/msg02142.html
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org