Received: from eggs.gnu.org ([2001:4830:134:3::10]:50190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW4sC-0005Mq-5k for qemu-devel@nongnu.org; Wed, 17 Feb 2016 11:22:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aW4sB-0006b0-05 for qemu-devel@nongnu.org; Wed, 17 Feb 2016 11:22:40 -0500 Date: Wed, 17 Feb 2016 17:22:30 +0100 From: Kevin Wolf Message-ID: <20160217162230.GL29494@noname.str.redhat.com> References: <1455646106-2047-1-git-send-email-mreitz@redhat.com> <1455646106-2047-9-git-send-email-mreitz@redhat.com> <20160217141835.GG29494@noname.str.redhat.com> <56C49626.2020509@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="U+BazGySraz5kW0T" Content-Disposition: inline In-Reply-To: <56C49626.2020509@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 08/14] blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, qemu-block@nongnu.org, Markus Armbruster --U+BazGySraz5kW0T Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 17.02.2016 um 16:47 hat Max Reitz geschrieben: > On 17.02.2016 15:18, Kevin Wolf wrote: > > Am 16.02.2016 um 19:08 hat Max Reitz geschrieben: > >> This function first removed the BlockBackend from the blk_backends list > >> and cleared its name so it would no longer be found by blk_name(); sin= ce > >> blk_next() now iterates through monitor_block_backends (which the BB is > >> removed from in hmp_drive_del()), this is no longer necessary. > >=20 > > Not clearing the name any more means that you can't create a new > > BlockBackend with the same ID until the hidden BB finally goes away. > >=20 > > As it happens, you already can't do that with drive_add, because we also > > keep the ID reserved in the QemuOpts, so it's already broken today. > > However, before this patch, you can still use blockdev-add to create a > > new BB with the ID of a BB that drive_del removed; after it, you get an > > error: > >=20 > > {"error": {"class": "GenericError", "desc": "Device with id 'disk' > > already exists"}} > >=20 > > In order to fix this, I suggested on IRC that we view the BB name as > > belonging to the monitor reference logically, i.e. we add a name with > > monitor_add_blk() (which would get a new ID parameter) and clear it > > again in monitor_remove_blk(). >=20 > Moving the @name parameter from blk_new() to monitor_add_blk() seems > reasonable but would necessitate pulling in two patches from the > follow-up series to this (there are places which try to emit the BB's > name while its BDS is created, which these two patches change so they no > longer do this). >=20 > Alternatively, as I said, we might want to call monitor_add_blk() in > blk_new() if the name is non-NULL (and allow NULL names). But if you allow NULL names, you need to fix those places, too. If the two patches aren't too bad, let's include them here. Kevin --U+BazGySraz5kW0T Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJWxJ5GAAoJEH8JsnLIjy/W/WgQAMIBKq0hW6TQLhxTD/fZPcRw 3dIvurd29Op6WHPfThkUVBcJLaAzlLZAbcJr3GMIWXkW+JT1pHmFOBW9aTBNf3XI Bj/fEMk8xA6sMwTRQdliiK+O9xtHQ2LYBC+h3wT2ZbPK3SN4h2CVPL5ct1NwasjP T4jN8x6F72F1HGhFCM6sahCaWEk6UDI0lN48XtvzwIiyman4jTjI77DerP90t0bw fLd7oQZ0zsmy4lDKDMh8x1sY7TeUoJjT+fpeSaks5kx6PDhheVAFA1dO6ECJa9OA 0UTGE2kO3O/lkGMtHHWY/xlNMI3QsAyZsWvOVoveCQ0SgkvYMN/QINq2yGfpLo/r OpVyz7fVhPrqICF84c7tS7f80vBvWPHpF1nkUXybV++HXb5s1LJyLWlJ+Xg/Sxl9 NhRZzhU7PzIDKjdMn+XrIuE93mbU4y6Is1GptpYg77qcQQrTZ3MeeLXnXf1t6eln 5Q0M3UoNZaJmQfTiMq1Yx1k5tBkEcwYzhx0OYudbKvFpdmsKs9Y7XQ7jrbe7Ujfi rLACJ6MotELaOsdsvqq0CyLlMrLsqikZSntWHNCVhIWLeTUiaK5OSOEdm0pI9pIc KTgpPp6Z+cDBFLFvcCsvagjRxEPBGU1vMFLqDSzCx7MwAW8JtRDvrJQMnElZiMz3 qSj/E9rc3Gpkrq0RoSHN =Pm+n -----END PGP SIGNATURE----- --U+BazGySraz5kW0T--