mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 14:24:02 +08:00
softmmu/dirtylimit: Add parameter check for hmp "set_vcpu_dirty_limit"
dirty_rate paraemter of hmp command "set_vcpu_dirty_limit" is invalid if less than 0, so add parameter check for it. Note that this patch also delete the unsolicited help message and clean up the code. Signed-off-by: Hyman Huang(黄勇) <yong.huang@smartx.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <168618975839.6361.17407633874747688653-1@git.sr.ht> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
01ec0f3a92
commit
140e5a7632
@ -515,14 +515,15 @@ void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
|
||||
int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
|
||||
Error *err = NULL;
|
||||
|
||||
qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
|
||||
if (err) {
|
||||
hmp_handle_error(mon, err);
|
||||
return;
|
||||
if (dirty_rate < 0) {
|
||||
error_setg(&err, "invalid dirty page limit %" PRId64, dirty_rate);
|
||||
goto out;
|
||||
}
|
||||
|
||||
monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query "
|
||||
"dirty limit for virtual CPU]\n");
|
||||
qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
|
||||
|
||||
out:
|
||||
hmp_handle_error(mon, err);
|
||||
}
|
||||
|
||||
static struct DirtyLimitInfo *dirtylimit_query_vcpu(int cpu_index)
|
||||
|
Loading…
Reference in New Issue
Block a user