Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
5e7caacb
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看板
提交
5e7caacb
编写于
11月 25, 2011
作者:
L
Luiz Capitulino
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qapi: Convert block_resize
Signed-off-by:
N
Luiz Capitulino
<
lcapitulino@redhat.com
>
上级
d72f3264
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
38 addition
and
18 deletion
+38
-18
blockdev.c
blockdev.c
+7
-11
blockdev.h
blockdev.h
+0
-1
hmp-commands.hx
hmp-commands.hx
+1
-2
hmp.c
hmp.c
+10
-0
hmp.h
hmp.h
+1
-0
qapi-schema.json
qapi-schema.json
+18
-0
qmp-commands.hx
qmp-commands.hx
+1
-4
未找到文件。
blockdev.c
浏览文件 @
5e7caacb
...
...
@@ -861,27 +861,23 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
* existing QERR_ macro mess is cleaned up. A good example for better
* error reports can be found in the qemu-img resize code.
*/
int
do_block_resize
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
)
void
qmp_block_resize
(
const
char
*
device
,
int64_t
size
,
Error
**
errp
)
{
const
char
*
device
=
qdict_get_str
(
qdict
,
"device"
);
int64_t
size
=
qdict_get_int
(
qdict
,
"size"
);
BlockDriverState
*
bs
;
bs
=
bdrv_find
(
device
);
if
(
!
bs
)
{
qerror_report
(
QERR_DEVICE_NOT_FOUND
,
device
);
return
-
1
;
error_set
(
errp
,
QERR_DEVICE_NOT_FOUND
,
device
);
return
;
}
if
(
size
<
0
)
{
qerror_report
(
QERR_UNDEFINED_ERROR
);
return
-
1
;
error_set
(
errp
,
QERR_UNDEFINED_ERROR
);
return
;
}
if
(
bdrv_truncate
(
bs
,
size
))
{
qerror_report
(
QERR_UNDEFINED_ERROR
);
return
-
1
;
error_set
(
errp
,
QERR_UNDEFINED_ERROR
);
return
;
}
return
0
;
}
blockdev.h
浏览文件 @
5e7caacb
...
...
@@ -65,6 +65,5 @@ 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
);
int
do_snapshot_blkdev
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
);
int
do_block_resize
(
Monitor
*
mon
,
const
QDict
*
qdict
,
QObject
**
ret_data
);
#endif
hmp-commands.hx
浏览文件 @
5e7caacb
...
...
@@ -57,8 +57,7 @@ ETEXI
.args_type = "device:B,size:o",
.params = "device size",
.help = "resize a block image",
.user_print = monitor_user_noop,
.mhandler.cmd_new = do_block_resize,
.mhandler.cmd = hmp_block_resize,
},
STEXI
...
...
hmp.c
浏览文件 @
5e7caacb
...
...
@@ -633,3 +633,13 @@ void hmp_balloon(Monitor *mon, const QDict *qdict)
error_free
(
errp
);
}
}
void
hmp_block_resize
(
Monitor
*
mon
,
const
QDict
*
qdict
)
{
const
char
*
device
=
qdict_get_str
(
qdict
,
"device"
);
int64_t
size
=
qdict_get_int
(
qdict
,
"size"
);
Error
*
errp
=
NULL
;
qmp_block_resize
(
device
,
size
,
&
errp
);
hmp_handle_error
(
mon
,
&
errp
);
}
hmp.h
浏览文件 @
5e7caacb
...
...
@@ -44,5 +44,6 @@ void hmp_inject_nmi(Monitor *mon, const QDict *qdict);
void
hmp_set_link
(
Monitor
*
mon
,
const
QDict
*
qdict
);
void
hmp_block_passwd
(
Monitor
*
mon
,
const
QDict
*
qdict
);
void
hmp_balloon
(
Monitor
*
mon
,
const
QDict
*
qdict
);
void
hmp_block_resize
(
Monitor
*
mon
,
const
QDict
*
qdict
);
#endif
qapi-schema.json
浏览文件 @
5e7caacb
...
...
@@ -1052,3 +1052,21 @@
#
Since:
0.14
.
0
##
{
'command':
'balloon'
,
'data':
{
'value':
'int'
}
}
##
#
@block_resize
#
#
Resize
a
block
image
while
a
guest
is
running.
#
#
@device:
the
name
of
the
device
to
get
the
image
resized
#
#
@size:
new
image
size
in
bytes
#
#
Returns:
nothing
on
success
#
If
@device
is
not
a
valid
block
device,
DeviceNotFound
#
#
Notes:
This
command
returns
UndefinedError
in
a
number
of
error
conditions.
#
#
Since:
0.14
.
0
##
{
'command':
'block_resize'
,
'data':
{
'device':
'str'
,
'size':
'int'
}}
qmp-commands.hx
浏览文件 @
5e7caacb
...
...
@@ -642,10 +642,7 @@ EQMP
{
.
name
=
"block_resize"
,
.
args_type
=
"device:B,size:o"
,
.
params
=
"device size"
,
.
help
=
"resize a block image"
,
.
user_print
=
monitor_user_noop
,
.
mhandler
.
cmd_new
=
do_block_resize
,
.
mhandler
.
cmd_new
=
qmp_marshal_input_block_resize
,
},
SQMP
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录