Added the qmp interface to know about the information of the bitmap dump process. When the command is executed, one can know about the current epoch value in which the process is in, the total iterations value and the current frequency value.
Currently, I do not think that that one needs to modify the other values except frequency, so that is why I have not added the generic set-tuning interface. If required, I will add it. Signed-off-by: Sanidhya Kashyap <[email protected]> --- qapi-schema.json | 31 +++++++++++++++++++++++++++++++ qmp-commands.hx | 24 ++++++++++++++++++++++++ savevm.c | 26 ++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/qapi-schema.json b/qapi-schema.json index 90977eb..1b09235d 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3487,6 +3487,24 @@ { 'command': 'rtc-reset-reinjection' } ## +# @BitmapLogStateInfo +# +# Provides information for the bitmap logging process +# +# @currepoch: provides the value of the running epoch value +# +# @epochs: provides the information about the actual epoch +# +# @frequency: the time difference in milliseconds between each epcoh +# +# Since 2.2 +## +{ 'type': 'BitmapLogStateInfo', + 'data': { 'currepoch': 'int', + 'epochs': 'int', + 'frequency': 'int' } } + +## # @log-dirty-bitmap # # dumps the dirty bitmap to a file by logging the @@ -3524,3 +3542,16 @@ { 'command': 'log-dirty-bitmap-set-frequency', 'data': {'frequency': 'int' } } +## +# @log-dirty-bitmap-get-tuning +# +# Get the current values of the parameters involved in bitmap logging process +# +# This command returns the following elements in the form of BitmapLogStateInfo: +# - currepoch: current epoch value +# - epochs: total epochs for which the bitmap dumping will continue +# - frequently: the current sleep interval between each epoch +# +# Since 2.2 +## +{ 'command': 'log-dirty-bitmap-get-tuning', 'returns': 'BitmapLogStateInfo' } diff --git a/qmp-commands.hx b/qmp-commands.hx index 0a13b74..3bd60e1 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3830,3 +3830,27 @@ Example: EQMP + { + .name = "log-dirty-bitmap-get-tuning", + .args_type = "", + .mhandler.cmd_new = qmp_marshal_input_log_dirty_bitmap_get_tuning, + }, + +SQMP +log-dirty-bitmap-get-tuning +-------------------- + +Get the parameters information + +- "currepoch": the current epoch going on +- "epochs" the total number of assigned epochs +- "frequency": the sleep interval between each epoch (in milliseconds) + +Example: + +-> { "execute": "log-dirty-bitmap-get-tuning" } +<- { "return": { + "currepoch": 3 + "epochs": 100 + "frequency": 100 } } +EQMP diff --git a/savevm.c b/savevm.c index d22771c..260c919 100644 --- a/savevm.c +++ b/savevm.c @@ -1495,6 +1495,32 @@ void qmp_log_dirty_bitmap_set_frequency(int64_t frequency, Error **errp) b->current_frequency = frequency; } +BitmapLogStateInfo *qmp_log_dirty_bitmap_get_tuning(Error **errp) +{ + BitmapLogState *b = logging_current_state(); + BitmapLogStateInfo *info = NULL; + + if (!runstate_check(RUN_STATE_DUMP_BITMAP) || + b->state != LOG_BITMAP_STATE_ACTIVE) { + return info; + } + + info = g_malloc0(sizeof(BitmapLogStateInfo)); + info->currepoch = b->current_epoch; + info->epochs = b->total_epochs; + info->frequency = b->current_frequency; + + if (!runstate_check(RUN_STATE_DUMP_BITMAP) || + b->state != LOG_BITMAP_STATE_ACTIVE) { + g_free(info); + info = NULL; + error_setg(errp, "Dirty bitmap dump process is not running\n"); + return info; + }; + + return info; +} + void qmp_xen_save_devices_state(const char *filename, Error **errp) { QEMUFile *f; -- 1.9.3
