Received: from eggs.gnu.org ([2001:4830:134:3::10]:57118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJMvT-0008MT-IP for qemu-devel@nongnu.org; Sat, 02 Jul 2016 11:33:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJMvR-0000dU-Ox for qemu-devel@nongnu.org; Sat, 02 Jul 2016 11:33:46 -0400 References: <1467296007-12252-1-git-send-email-kwolf@redhat.com> <1467296007-12252-2-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <429dc8d6-bff3-6918-71cc-c03efbe6c604@redhat.com> Date: Sat, 2 Jul 2016 17:33:36 +0200 MIME-Version: 1.0 In-Reply-To: <1467296007-12252-2-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ugeag9Mp87sDrBM6gq0Kilxe9nm1K3hq0" Subject: Re: [Qemu-devel] [PATCH v2 1/6] block/qdev: Allow node name for drive properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: eblake@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Ugeag9Mp87sDrBM6gq0Kilxe9nm1K3hq0 From: Max Reitz To: Kevin Wolf , qemu-block@nongnu.org Cc: eblake@redhat.com, qemu-devel@nongnu.org Message-ID: <429dc8d6-bff3-6918-71cc-c03efbe6c604@redhat.com> Subject: Re: [PATCH v2 1/6] block/qdev: Allow node name for drive properties References: <1467296007-12252-1-git-send-email-kwolf@redhat.com> <1467296007-12252-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1467296007-12252-2-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 30.06.2016 16:13, Kevin Wolf wrote: > If a node name instead of a BlockBackend name is specified as the drive= r > for a guest device, an anonymous BlockBackend is created now. >=20 > Signed-off-by: Kevin Wolf > --- > hw/core/qdev-properties-system.c | 22 +++++++++++++++++++--- > 1 file changed, 19 insertions(+), 3 deletions(-) I just noticed this won't work with (at least) USB mass storage devices. scsi_bus_legacy_add_drive() creates a new device and uses qdev_prop_set_drive() to set its drive, and that function uses blk_name() to get the required value for .drive. That can of course be fixed by using bdrv_get_node_name(blk_bs(value)) there if blk_name(value) is empty. But in addition we need to make sure that the BB is not deleted in usb_msd_realize_storage() (because that function has to detach the device from the BB before creating the SCSI disk), so we need to wrap the explicitly hacky block there in blk_ref(blk) and blk_unref(blk). Max --Ugeag9Mp87sDrBM6gq0Kilxe9nm1K3hq0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXd97QEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrR3n B/0ZXZ4I7bmjV+0kuDRDVKooiArBx8/OuZqfcZ8huN3v4E77E7Zn9dsI+e8zzUZK 7T1N9zdCN98IDVfxdpjcWMpz8CioerF9SY1sLw9k8UVwa6cgqrcKUhZOXzbKbONr h/03Of6yympuvzdsnBFQsFtdPV/ZHTkQeQqDHg7Q5lpKqcmf/qpcOe0PF2LeWsSy +BmWq9j20pjkA8mU4WRK68kxWKz5MXwm3pbmP6h0WMg6NCjynR9bNunFa0XPFRH9 8zIQcMs4kwOpCCPE5Ct19SKda+KbX0phU1j9Qn0qtYiBhAOSKXzEfiM1Yyo1rFzy UaDZ2rKQ/PMeeYVNrl/Sg9m2 =Z1t9 -----END PGP SIGNATURE----- --Ugeag9Mp87sDrBM6gq0Kilxe9nm1K3hq0--