Signed-off-by: Sanidhya Kashyap <sanidhya.ii...@gmail.com> --- Removed acronyms, no functional change.
hmp-commands.hx | 15 +++++++++++++++ hmp.c | 12 ++++++++++++ hmp.h | 1 + qapi-schema.json | 12 ++++++++++++ qmp-commands.hx | 24 ++++++++++++++++++++++++ savevm.c | 14 ++++++++++++++ 6 files changed, 78 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index b253239..c480309 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1818,6 +1818,21 @@ STEXI Cancel the current bitmap dump process ETEXI + { + .name = "log_dirty_bitmap_set_period", + .args_type = "period:i", + .params = "period", + .help = "set the period for bitmap dump process\n\t\t\t" + "period: the new period value to replace the existing", + .mhandler.cmd = hmp_log_dirty_bitmap_set_period, + }, + +STEXI +@item log_dirty_bitmap_set_period @var{period} +@findex log_dirty_bitmap_set_period +Set the period to @var{period} (int) for bitmap dump process. +ETEXI + STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index 80b4e5d..4f9b807 100644 --- a/hmp.c +++ b/hmp.c @@ -1341,6 +1341,18 @@ void hmp_log_dirty_bitmap_cancel(Monitor *mon, const QDict *qdict) qmp_log_dirty_bitmap_cancel(NULL); } +void hmp_log_dirty_bitmap_set_period(Monitor *mon, const QDict *qdict) +{ + int64_t period = qdict_get_int(qdict, "period"); + Error *err = NULL; + qmp_log_dirty_bitmap_set_period(period, &err); + if (err) { + monitor_printf(mon, "log_dirty_bitmap_set_period: %s\n", + error_get_pretty(err)); + error_free(err); + } +} + void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) { Error *err = NULL; diff --git a/hmp.h b/hmp.h index fcfb10f..a5a0571 100644 --- a/hmp.h +++ b/hmp.h @@ -97,6 +97,7 @@ void hmp_object_del(Monitor *mon, const QDict *qdict); void hmp_info_memdev(Monitor *mon, const QDict *qdict); void hmp_log_dirty_bitmap(Monitor *mon, const QDict *qdict); void hmp_log_dirty_bitmap_cancel(Monitor *mon, const QDict *qdict); +void hmp_log_dirty_bitmap_set_period(Monitor *mon, const QDict *qdict); void object_add_completion(ReadLineState *rs, int nb_args, const char *str); void object_del_completion(ReadLineState *rs, int nb_args, const char *str); void device_add_completion(ReadLineState *rs, int nb_args, const char *str); diff --git a/qapi-schema.json b/qapi-schema.json index 0e90e9a..87b9297 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3555,3 +3555,15 @@ # Since 2.2 ## { 'command': 'log-dirty-bitmap-cancel' } + +## +# @log-dirty-bitmap-set-period +# +# sets the period of the dirty bitmap logging process +# @frequency: the updated period value (in milliseconds). +# The min and max values are 10 and 100000 respectively. +# +# Since 2.2 +## +{ 'command': 'log-dirty-bitmap-set-period', + 'data': { 'period': 'int' } } diff --git a/qmp-commands.hx b/qmp-commands.hx index 890a393..f229a2f 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3831,3 +3831,27 @@ Example: -> { "execute": "log-dirty-bitmap-cancel" } <- { "return": {} } EQMP + + { + .name = "log-dirty-bitmap-set-period", + .args_type = "period:i", + .mhandler.cmd_new = qmp_marshal_input_log_dirty_bitmap_set_period, + }, + +SQMP +log-dirty-bitmap-set-period +--------------------------- + +Update the period for the remaining iterations. + +Arguments: + +- "period": The updated period (json-int) (in milliseconds). + The min and max values are 10 and 100000 respectively. + +Example: + +-> { "execute": "log-dirty-bitmap-set-period", "arguments": { "period": 1024 } } +<- { "return": {} } + +EQMP diff --git a/savevm.c b/savevm.c index 51995b4..17af116 100644 --- a/savevm.c +++ b/savevm.c @@ -1546,6 +1546,20 @@ void qmp_log_dirty_bitmap_cancel(Error **errp) } while (b->state != LOG_BITMAP_STATE_CANCELING); } +void qmp_log_dirty_bitmap_set_period(int64_t period, Error **errp) +{ + BitmapLogState *b = log_bitmap_get_current_state(); + Error *local_err = NULL; + if (value_in_range(period, MIN_PERIOD_VALUE, + MAX_PERIOD_VALUE, "period", &local_err)) { + if (local_err) { + error_propagate(errp, local_err); + return; + } + } + b->current_period = period; +} + void qmp_xen_save_devices_state(const char *filename, Error **errp) { QEMUFile *f; -- 1.9.1