mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
qemu-img: add support for rate limit in qemu-img commit
add support for rate limit in qemu-img commit. Signed-off-by: Zhengui <lizhengui@huawei.com> Message-Id: <1603205264-17424-2-git-send-email-lizhengui@huawei.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
d55450df99
commit
a0441b66e8
3 changed files with 14 additions and 5 deletions
11
qemu-img.c
11
qemu-img.c
|
@ -980,6 +980,7 @@ static int img_commit(int argc, char **argv)
|
|||
CommonBlockJobCBInfo cbi;
|
||||
bool image_opts = false;
|
||||
AioContext *aio_context;
|
||||
int64_t rate_limit = 0;
|
||||
|
||||
fmt = NULL;
|
||||
cache = BDRV_DEFAULT_CACHE;
|
||||
|
@ -991,7 +992,7 @@ static int img_commit(int argc, char **argv)
|
|||
{"image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
c = getopt_long(argc, argv, ":f:ht:b:dpq",
|
||||
c = getopt_long(argc, argv, ":f:ht:b:dpqr:",
|
||||
long_options, NULL);
|
||||
if (c == -1) {
|
||||
break;
|
||||
|
@ -1026,6 +1027,12 @@ static int img_commit(int argc, char **argv)
|
|||
case 'q':
|
||||
quiet = true;
|
||||
break;
|
||||
case 'r':
|
||||
rate_limit = cvtnum("rate limit", optarg);
|
||||
if (rate_limit < 0) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case OPTION_OBJECT: {
|
||||
QemuOpts *opts;
|
||||
opts = qemu_opts_parse_noisily(&qemu_object_opts,
|
||||
|
@ -1099,7 +1106,7 @@ static int img_commit(int argc, char **argv)
|
|||
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
aio_context_acquire(aio_context);
|
||||
commit_active_start("commit", bs, base_bs, JOB_DEFAULT, 0,
|
||||
commit_active_start("commit", bs, base_bs, JOB_DEFAULT, rate_limit,
|
||||
BLOCKDEV_ON_ERROR_REPORT, NULL, common_block_job_cb,
|
||||
&cbi, false, &local_err);
|
||||
aio_context_release(aio_context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue