From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF100C433E0 for ; Thu, 18 Mar 2021 15:17:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5893464E90 for ; Thu, 18 Mar 2021 15:17:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5893464E90 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMuOS-0004Nz-Dw for qemu-devel@archiver.kernel.org; Thu, 18 Mar 2021 11:17:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMuMo-0002yR-Ew; Thu, 18 Mar 2021 11:15:18 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:45937) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lMuMm-0006Ha-J9; Thu, 18 Mar 2021 11:15:18 -0400 Received: by mail-ot1-x32e.google.com with SMTP id f73-20020a9d03cf0000b02901b4d889bce0so5481382otf.12; Thu, 18 Mar 2021 08:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wwfX3rVj67NkYhC1ceFz0SuZ6D5Wm1ZGPkDXcugvkbA=; b=dx+58LKVUklnH7t0xWdoKSBd9JwL5t/T23MFdWsuI/YJ+6i00W7JqKD5KTh9ikc7Fx K7FBuvOAwgridTgqwELhazYBN6AlXu2eE0QK2F8LS9qIzOe1ZRq7Rdu86X/Wwukd18nU cZKrSj8RMLopCU9uasLjLYtzI+lWJr42H8WCJicp+KIo45GwO4T1jIZcuTUgyi84mOva cXQDkVbW5xhySz8R8HpRVJfRgFk2zFtTssfg/TjiqcRxz+Dz1vGiVebbY8C/+So7GBoj IqDBRJl5ANzgjW68BL9nG4PRKxdiQl5GerGzy9ycZWi37S6IJIgpTOh62h2C6Gn5s0du xxPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wwfX3rVj67NkYhC1ceFz0SuZ6D5Wm1ZGPkDXcugvkbA=; b=hP1/Ij0gNeGQX5rG0X3MM407KVsd9T/NGDTdQQU7c2fUsPXxcc+0RdF+7rWmHGtWTp lk9ZTfoI3zBG87LbR5c6rc3NFt4hE3dunU8C4Zm8f/eqYQ9ZTKYBIQcFOr8m1my19CXw 4G07TmV6jMUg9uks2PHFzJ4Vx/63/v9iJiudu01R2Td9RLeRUP80RZQrJGCeDqCeAn3e 9Z4r3TRnbb4ONpqxyeTOq5DvsdfC09wybvf6NcsOW0tWPSoolLblWTjM8mD3wJa4jfKU mnsGxYBm05qktcbT2rfA8HkOUmAvllWhfViX7f/R3bvvMoLbnAf8c/GOy0+J8i4jXu6m GFew== X-Gm-Message-State: AOAM531Q+hu4r+ryWrKLoabq69k2KMtgyAkyUpbIoK83A2j5dkLm3iem 7hObXMx7I/1RWcDtWKJWwC7izOHE9pLAaquI+Ec= X-Google-Smtp-Source: ABdhPJzD3gjZGUsqN952rRNHkJR/o/vQwLRZOnxfN546JUnamSrcfV+kZaFSI1iYUxDLb13X6EQaFyzp6jM1wiIS5do= X-Received: by 2002:a9d:6e18:: with SMTP id e24mr5357535otr.284.1616080514826; Thu, 18 Mar 2021 08:15:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: zhao xiaojun Date: Thu, 18 Mar 2021 23:15:04 +0800 Message-ID: Subject: Re: Can not use hmp block_resize command with -blockdev option To: Kevin Wolf Content-Type: multipart/alternative; boundary="00000000000003c42405bdd1112d" Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=xiaojun.zhao141@gmail.com; helo=mail-ot1-x32e.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Snow , qemu-devel@nongnu.org, Qemu-block Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --00000000000003c42405bdd1112d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 =3D 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 =E4=BA=8E2021=E5=B9=B43=E6=9C=8818=E6=97=A5= =E5=91=A8=E5=9B=9B =E4=B8=8B=E5=8D=886:50=E5=86=99=E9=81=93=EF=BC=9A > 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 t= o > > > 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 file= d > > > 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 devic= e > > > 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 > > --00000000000003c42405bdd1112d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks you, that's really good idea. And I also h= ave the following question:

There are some hmp and qmp = commands in my scripts, they need the device as an argument.=C2=A0Recently.= i used the -blockdev replace the -drive to specify=C2=A0the disk drive, th= en use=C2=A0=C2=A0qmp's query_block to query th= e device,=C2=A0 but the device is NULL string. For the hmp's block_resi= ze, I can use qmp's block_resize do. But the other commands(qpm's= =C2=A0block-job-cancel etc.), they only supp= ort the device argument. So I can only continue to use -drive to specify di= sk drive.=C2=A0=C2=A0

I w= as trying to see the source(qemu v5.1.0):
qmp_query_device()
=C2=A0 = ->=C2=A0bdrv_query_info()
=C2=A0 =C2=A0 =C2=A0 info->= ;device =3D g_strdup(blk_name(blk))
the device is set to=C2=A0blk= _name(blk), and the blk->name is set in the=C2=A0monitor_add_blk()
=

the -blockdev:
qmp_blockdev_add()
= =C2=A0 =C2=A0->=C2=A0bds_tree_init()
=C2=A0 =C2=A0 =C2=A0->= =C2=A0bdrv_open()
=C2=A0 =C2=A0...
the qmp_blockdev_add= () doesn't call the monitor_add_blk().

Questio= ns:
Why can not qmp_blockdev_add() call the monitor_add_blk()?=C2= =A0
Will the hmp and qmp commands that only support device as an = argument be compat with the -blockdev option?=C2=A0

Kevin Wolf <kwolf@redhat.com> =E4=BA=8E2021=E5= =B9=B43=E6=9C=8818=E6=97=A5=E5=91=A8=E5=9B=9B =E4=B8=8B=E5=8D=886:50=E5=86= =99=E9=81=93=EF=BC=9A
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 wa= nt to
> > resize it with hmp block_resize command. The hmp block_resize com= and'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:
> > {
> >=C2=A0 =C2=A0 "return": [
> >=C2=A0 =C2=A0 =C2=A0 {
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 "io-status": "ok",=
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 "device": "",
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ...
> > }
> >
> > I noticed that the qmp block_resize command supports device or no= de-name
> > as argument.
> >
> > If i can continue use the the hmp block_resize command with the d= evice
> > argument?
> >
> > Regards.
>
> I'm not sure what you're asking: hmp's block_resize doesn&= #39;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

--00000000000003c42405bdd1112d--