Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
80047da5
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
80047da5
编写于
12月 14, 2011
作者:
L
Luiz Capitulino
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qapi: Convert block_set_io_throttle
Signed-off-by:
N
Luiz Capitulino
<
lcapitulino@redhat.com
>
上级
333a96ec
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
60 addition
and
41 deletion
+60
-41
blockdev.c
blockdev.c
+14
-33
blockdev.h
blockdev.h
+0
-2
hmp-commands.hx
hmp-commands.hx
+1
-2
hmp.c
hmp.c
+14
-0
hmp.h
hmp.h
+1
-0
qapi-schema.json
qapi-schema.json
+29
-0
qmp-commands.hx
qmp-commands.hx
+1
-4
未找到文件。
blockdev.c
浏览文件 @
80047da5
...
...
@@ -775,46 +775,29 @@ void qmp_change_blockdev(const char *device, const char *filename,
}
/* throttling disk I/O limits */
int
do_block_set_io_throttle
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
)
void
qmp_block_set_io_throttle
(
const
char
*
device
,
int64_t
bps
,
int64_t
bps_rd
,
int64_t
bps_wr
,
int64_t
iops
,
int64_t
iops_rd
,
int64_t
iops_wr
,
Error
**
errp
)
{
BlockIOLimit
io_limits
;
const
char
*
devname
=
qdict_get_str
(
qdict
,
"device"
);
BlockDriverState
*
bs
;
io_limits
.
bps
[
BLOCK_IO_LIMIT_TOTAL
]
=
qdict_get_try_int
(
qdict
,
"bps"
,
-
1
);
io_limits
.
bps
[
BLOCK_IO_LIMIT_READ
]
=
qdict_get_try_int
(
qdict
,
"bps_rd"
,
-
1
);
io_limits
.
bps
[
BLOCK_IO_LIMIT_WRITE
]
=
qdict_get_try_int
(
qdict
,
"bps_wr"
,
-
1
);
io_limits
.
iops
[
BLOCK_IO_LIMIT_TOTAL
]
=
qdict_get_try_int
(
qdict
,
"iops"
,
-
1
);
io_limits
.
iops
[
BLOCK_IO_LIMIT_READ
]
=
qdict_get_try_int
(
qdict
,
"iops_rd"
,
-
1
);
io_limits
.
iops
[
BLOCK_IO_LIMIT_WRITE
]
=
qdict_get_try_int
(
qdict
,
"iops_wr"
,
-
1
);
bs
=
bdrv_find
(
devname
);
bs
=
bdrv_find
(
device
);
if
(
!
bs
)
{
qerror_report
(
QERR_DEVICE_NOT_FOUND
,
devnam
e
);
return
-
1
;
error_set
(
errp
,
QERR_DEVICE_NOT_FOUND
,
devic
e
);
return
;
}
if
((
io_limits
.
bps
[
BLOCK_IO_LIMIT_TOTAL
]
==
-
1
)
||
(
io_limits
.
bps
[
BLOCK_IO_LIMIT_READ
]
==
-
1
)
||
(
io_limits
.
bps
[
BLOCK_IO_LIMIT_WRITE
]
==
-
1
)
||
(
io_limits
.
iops
[
BLOCK_IO_LIMIT_TOTAL
]
==
-
1
)
||
(
io_limits
.
iops
[
BLOCK_IO_LIMIT_READ
]
==
-
1
)
||
(
io_limits
.
iops
[
BLOCK_IO_LIMIT_WRITE
]
==
-
1
))
{
qerror_report
(
QERR_MISSING_PARAMETER
,
"bps/bps_rd/bps_wr/iops/iops_rd/iops_wr"
);
return
-
1
;
}
io_limits
.
bps
[
BLOCK_IO_LIMIT_TOTAL
]
=
bps
;
io_limits
.
bps
[
BLOCK_IO_LIMIT_READ
]
=
bps_rd
;
io_limits
.
bps
[
BLOCK_IO_LIMIT_WRITE
]
=
bps_wr
;
io_limits
.
iops
[
BLOCK_IO_LIMIT_TOTAL
]
=
iops
;
io_limits
.
iops
[
BLOCK_IO_LIMIT_READ
]
=
iops_rd
;
io_limits
.
iops
[
BLOCK_IO_LIMIT_WRITE
]
=
iops_wr
;
if
(
!
do_check_io_limits
(
&
io_limits
))
{
qerror_report
(
QERR_INVALID_PARAMETER_COMBINATION
);
return
-
1
;
error_set
(
errp
,
QERR_INVALID_PARAMETER_COMBINATION
);
return
;
}
bs
->
io_limits
=
io_limits
;
...
...
@@ -829,8 +812,6 @@ int do_block_set_io_throttle(Monitor *mon,
qemu_mod_timer
(
bs
->
block_timer
,
qemu_get_clock_ns
(
vm_clock
));
}
}
return
0
;
}
int
do_drive_del
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
)
...
...
blockdev.h
浏览文件 @
80047da5
...
...
@@ -62,6 +62,4 @@ void qmp_change_blockdev(const char *device, const char *filename,
bool
has_format
,
const
char
*
format
,
Error
**
errp
);
void
do_commit
(
Monitor
*
mon
,
const
QDict
*
qdict
);
int
do_drive_del
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
);
int
do_block_set_io_throttle
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
);
#endif
hmp-commands.hx
浏览文件 @
80047da5
...
...
@@ -1202,8 +1202,7 @@ ETEXI
.args_type = "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l",
.params = "device bps bps_rd bps_wr iops iops_rd iops_wr",
.help = "change I/O throttle limits for a block drive",
.user_print = monitor_user_noop,
.mhandler.cmd_new = do_block_set_io_throttle,
.mhandler.cmd = hmp_block_set_io_throttle,
},
STEXI
...
...
hmp.c
浏览文件 @
80047da5
...
...
@@ -769,3 +769,17 @@ void hmp_change(Monitor *mon, const QDict *qdict)
}
hmp_handle_error
(
mon
,
&
err
);
}
void
hmp_block_set_io_throttle
(
Monitor
*
mon
,
const
QDict
*
qdict
)
{
Error
*
err
=
NULL
;
qmp_block_set_io_throttle
(
qdict_get_str
(
qdict
,
"device"
),
qdict_get_int
(
qdict
,
"bps"
),
qdict_get_int
(
qdict
,
"bps_rd"
),
qdict_get_int
(
qdict
,
"bps_wr"
),
qdict_get_int
(
qdict
,
"iops"
),
qdict_get_int
(
qdict
,
"iops_rd"
),
qdict_get_int
(
qdict
,
"iops_wr"
),
&
err
);
hmp_handle_error
(
mon
,
&
err
);
}
hmp.h
浏览文件 @
80047da5
...
...
@@ -53,5 +53,6 @@ void hmp_set_password(Monitor *mon, const QDict *qdict);
void
hmp_expire_password
(
Monitor
*
mon
,
const
QDict
*
qdict
);
void
hmp_eject
(
Monitor
*
mon
,
const
QDict
*
qdict
);
void
hmp_change
(
Monitor
*
mon
,
const
QDict
*
qdict
);
void
hmp_block_set_io_throttle
(
Monitor
*
mon
,
const
QDict
*
qdict
);
#endif
qapi-schema.json
浏览文件 @
80047da5
...
...
@@ -1402,3 +1402,32 @@
##
{
'command':
'change'
,
'data':
{
'device':
'str'
,
'target':
'str'
,
'*arg':
'str'
}
}
##
#
@block_set_io_throttle:
#
#
Change
I/O
throttle
limits
for
a
block
drive.
#
#
@device:
The
name
of
the
device
#
#
@bps:
total
throughput
limit
in
bytes
per
second
#
#
@bps_rd:
read
throughput
limit
in
bytes
per
second
#
#
@bps_wr:
write
throughput
limit
in
bytes
per
second
#
#
@iops:
total
I/O
operations
per
second
#
#
@ops_rd:
read
I/O
operations
per
second
#
#
@iops_wr:
write
I/O
operations
per
second
#
#
Returns:
Nothing
on
success
#
If
@device
is
not
a
valid
block
device,
DeviceNotFound
#
If
the
argument
combination
is
invalid,
InvalidParameterCombination
#
#
Since:
1.1
##
{
'command':
'block_set_io_throttle'
,
'data':
{
'device':
'str'
,
'bps':
'int'
,
'bps_rd':
'int'
,
'bps_wr':
'int'
,
'iops':
'int'
,
'iops_rd':
'int'
,
'iops_wr':
'int'
}
}
qmp-commands.hx
浏览文件 @
80047da5
...
...
@@ -807,10 +807,7 @@ EQMP
{
.name = "block_set_io_throttle",
.args_type = "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l",
.params = "device bps bps_rd bps_wr iops iops_rd iops_wr",
.help = "change I/O throttle limits for a block drive",
.user_print = monitor_user_noop,
.mhandler.cmd_new = do_block_set_io_throttle,
.mhandler.cmd_new = qmp_marshal_input_block_set_io_throttle,
},
SQMP
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录