* Can not use hmp block_resize command with -blockdev option
@ 2021-03-17 3:43 zhao xiaojun
2021-03-17 22:49 ` John Snow
0 siblings, 1 reply; 6+ messages in thread
From: zhao xiaojun @ 2021-03-17 3:43 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 571 bytes --]
Hi,
I use -blockdev option to specify a drive when qemu boot and i want to
resize it with hmp block_resize command. The hmp block_resize comand's
arguments: block_resize device new_size.
So I query the device by qmp query_block command, but the device filed of
the result output is NULL string.
result output:
{
"return": [
{
"io-status": "ok",
"device": "",
...
}
I noticed that the qmp block_resize command supports device or node-name as
argument.
If i can continue use the the hmp block_resize command with the device
argument?
Regards.
[-- Attachment #2: Type: text/html, Size: 927 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can not use hmp block_resize command with -blockdev option
2021-03-17 3:43 Can not use hmp block_resize command with -blockdev option zhao xiaojun
@ 2021-03-17 22:49 ` John Snow
2021-03-18 10:50 ` Kevin Wolf
0 siblings, 1 reply; 6+ messages in thread
From: John Snow @ 2021-03-17 22:49 UTC (permalink / raw)
To: zhao xiaojun, qemu-devel; +Cc: Qemu-block
On 3/16/21 11:43 PM, zhao xiaojun wrote:
> Hi,
> I use -blockdev option to specify a drive when qemu boot and i want to
> resize it with hmp block_resize command. The hmp block_resize comand's
> arguments: block_resize device new_size.
> So I query the device by qmp query_block command, but the device filed
> of the result output is NULL string.
>
> result output:
> {
> "return": [
> {
> "io-status": "ok",
> "device": "",
> ...
> }
>
> I noticed that the qmp block_resize command supports device or node-name
> as argument.
>
> If i can continue use the the hmp block_resize command with the device
> argument?
>
> Regards.
I'm not sure what you're asking: hmp's block_resize doesn't accept
node-name arguments as you've found. Are you not able to use QMP's
block_resize?
--js
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can not use hmp block_resize command with -blockdev option
2021-03-17 22:49 ` John Snow
@ 2021-03-18 10:50 ` Kevin Wolf
2021-03-18 15:15 ` zhao xiaojun
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Wolf @ 2021-03-18 10:50 UTC (permalink / raw)
To: John Snow; +Cc: zhao xiaojun, qemu-devel, Qemu-block
Am 17.03.2021 um 23:49 hat John Snow geschrieben:
> On 3/16/21 11:43 PM, zhao xiaojun wrote:
> > Hi,
> > I use -blockdev option to specify a drive when qemu boot and i want to
> > resize it with hmp block_resize command. The hmp block_resize comand's
> > arguments: block_resize device new_size.
> > So I query the device by qmp query_block command, but the device filed
> > of the result output is NULL string.
> >
> > result output:
> > {
> > "return": [
> > {
> > "io-status": "ok",
> > "device": "",
> > ...
> > }
> >
> > I noticed that the qmp block_resize command supports device or node-name
> > as argument.
> >
> > If i can continue use the the hmp block_resize command with the device
> > argument?
> >
> > Regards.
>
> I'm not sure what you're asking: hmp's block_resize doesn't accept node-name
> arguments as you've found. Are you not able to use QMP's block_resize?
We should probably fix HMP block_resize to accept node names.
Kevin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can not use hmp block_resize command with -blockdev option
2021-03-18 10:50 ` Kevin Wolf
@ 2021-03-18 15:15 ` zhao xiaojun
2021-03-18 16:17 ` Kevin Wolf
0 siblings, 1 reply; 6+ messages in thread
From: zhao xiaojun @ 2021-03-18 15:15 UTC (permalink / raw)
To: Kevin Wolf; +Cc: John Snow, qemu-devel, Qemu-block
[-- Attachment #1: Type: text/plain, Size: 2272 bytes --]
Thanks you, that's really good idea. And I also have the following question:
There are some hmp and qmp commands in my scripts, they need the device as
an argument. Recently. i used the -blockdev replace the -drive to
specify the disk drive, then use qmp's query_block to query the device,
but the device is NULL string. For the hmp's block_resize, I can use qmp's
block_resize do. But the other commands(qpm's block-job-cancel etc.), they
only support the device argument. So I can only continue to use -drive to
specify disk drive.
I was trying to see the source(qemu v5.1.0):
qmp_query_device()
-> bdrv_query_info()
info->device = g_strdup(blk_name(blk))
the device is set to blk_name(blk), and the blk->name is set in
the monitor_add_blk()
the -blockdev:
qmp_blockdev_add()
-> bds_tree_init()
-> bdrv_open()
...
the qmp_blockdev_add() doesn't call the monitor_add_blk().
Questions:
Why can not qmp_blockdev_add() call the monitor_add_blk()?
Will the hmp and qmp commands that only support device as an argument be
compat with the -blockdev option?
Kevin Wolf <kwolf@redhat.com> 于2021年3月18日周四 下午6:50写道:
> Am 17.03.2021 um 23:49 hat John Snow geschrieben:
> > On 3/16/21 11:43 PM, zhao xiaojun wrote:
> > > Hi,
> > > I use -blockdev option to specify a drive when qemu boot and i want to
> > > resize it with hmp block_resize command. The hmp block_resize comand's
> > > arguments: block_resize device new_size.
> > > So I query the device by qmp query_block command, but the device filed
> > > of the result output is NULL string.
> > >
> > > result output:
> > > {
> > > "return": [
> > > {
> > > "io-status": "ok",
> > > "device": "",
> > > ...
> > > }
> > >
> > > I noticed that the qmp block_resize command supports device or
> node-name
> > > as argument.
> > >
> > > If i can continue use the the hmp block_resize command with the device
> > > argument?
> > >
> > > Regards.
> >
> > I'm not sure what you're asking: hmp's block_resize doesn't accept
> node-name
> > arguments as you've found. Are you not able to use QMP's block_resize?
>
> We should probably fix HMP block_resize to accept node names.
>
> Kevin
>
>
[-- Attachment #2: Type: text/html, Size: 3249 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can not use hmp block_resize command with -blockdev option
2021-03-18 15:15 ` zhao xiaojun
@ 2021-03-18 16:17 ` Kevin Wolf
2021-03-18 16:55 ` LKML
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Wolf @ 2021-03-18 16:17 UTC (permalink / raw)
To: zhao xiaojun; +Cc: John Snow, qemu-devel, Qemu-block
Am 18.03.2021 um 16:15 hat zhao xiaojun geschrieben:
> Thanks you, that's really good idea. And I also have the following question:
>
> There are some hmp and qmp commands in my scripts, they need the device as
> an argument. Recently. i used the -blockdev replace the -drive to
> specify the disk drive, then use qmp's query_block to query the device,
> but the device is NULL string. For the hmp's block_resize, I can use qmp's
> block_resize do. But the other commands(qpm's block-job-cancel etc.), they
> only support the device argument. So I can only continue to use -drive to
> specify disk drive.
>
> I was trying to see the source(qemu v5.1.0):
> qmp_query_device()
> -> bdrv_query_info()
> info->device = g_strdup(blk_name(blk))
> the device is set to blk_name(blk), and the blk->name is set in
> the monitor_add_blk()
>
> the -blockdev:
> qmp_blockdev_add()
> -> bds_tree_init()
> -> bdrv_open()
> ...
> the qmp_blockdev_add() doesn't call the monitor_add_blk().
>
> Questions:
> Why can not qmp_blockdev_add() call the monitor_add_blk()?
> Will the hmp and qmp commands that only support device as an argument be
> compat with the -blockdev option?
QMP doesn't have such commands. For commands that operate on the
frontend (the guest device), they accept the id of the -device. For
commands that relate to the backend, you can specify node-name.
It's only HMP that may not support these alternatives in some places. We
can just extend it.
Kevin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Can not use hmp block_resize command with -blockdev option
2021-03-18 16:17 ` Kevin Wolf
@ 2021-03-18 16:55 ` LKML
0 siblings, 0 replies; 6+ messages in thread
From: LKML @ 2021-03-18 16:55 UTC (permalink / raw)
To: Kevin Wolf; +Cc: zhao xiaojun, John Snow, qemu-devel, Qemu-block
On Thu, 18 Mar 2021 17:17:50 +0100
Kevin Wolf <kwolf@redhat.com> wrote:
> Am 18.03.2021 um 16:15 hat zhao xiaojun geschrieben:
> > Thanks you, that's really good idea. And I also have the following
> > question:
> >
> > There are some hmp and qmp commands in my scripts, they need the
> > device as an argument. Recently. i used the -blockdev replace the
> > -drive to specify the disk drive, then use qmp's query_block to
> > query the device, but the device is NULL string. For the hmp's
> > block_resize, I can use qmp's block_resize do. But the other
> > commands(qpm's block-job-cancel etc.), they only support the device
> > argument. So I can only continue to use -drive to specify disk
> > drive.
> >
> > I was trying to see the source(qemu v5.1.0):
> > qmp_query_device()
> > -> bdrv_query_info()
> > info->device = g_strdup(blk_name(blk))
> > the device is set to blk_name(blk), and the blk->name is set in
> > the monitor_add_blk()
> >
> > the -blockdev:
> > qmp_blockdev_add()
> > -> bds_tree_init()
> > -> bdrv_open()
> > ...
> > the qmp_blockdev_add() doesn't call the monitor_add_blk().
> >
> > Questions:
> > Why can not qmp_blockdev_add() call the monitor_add_blk()?
> > Will the hmp and qmp commands that only support device as an
> > argument be compat with the -blockdev option?
>
> QMP doesn't have such commands. For commands that operate on the
> frontend (the guest device), they accept the id of the -device. For
> commands that relate to the backend, you can specify node-name.
>
> It's only HMP that may not support these alternatives in some places.
> We can just extend it.
>
> Kevin
>
Ok, thank you very much.
Regards.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-03-18 17:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 3:43 Can not use hmp block_resize command with -blockdev option zhao xiaojun
2021-03-17 22:49 ` John Snow
2021-03-18 10:50 ` Kevin Wolf
2021-03-18 15:15 ` zhao xiaojun
2021-03-18 16:17 ` Kevin Wolf
2021-03-18 16:55 ` LKML
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).