From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZotkQ-0006Dp-Nb for qemu-devel@nongnu.org; Wed, 21 Oct 2015 09:48:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZotkM-0000eV-R6 for qemu-devel@nongnu.org; Wed, 21 Oct 2015 09:48:10 -0400 References: <1445270025-22999-1-git-send-email-mreitz@redhat.com> <1445270025-22999-32-git-send-email-mreitz@redhat.com> From: Max Reitz Message-ID: <5627978B.3090403@redhat.com> Date: Wed, 21 Oct 2015 15:47:55 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XhKa9lXI7oJ2o1bw56wJBWho1VsIel9aN" Subject: Re: [Qemu-devel] [PATCH v7 31/39] blockdev: Add blockdev-insert-medium List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XhKa9lXI7oJ2o1bw56wJBWho1VsIel9aN Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 21.10.2015 13:49, Alberto Garcia wrote: > On Mon 19 Oct 2015 05:53:37 PM CEST, Max Reitz wrote: >> And a helper function for that, which directly takes a pointer to the >> BDS to be inserted instead of its node-name (which will be used for >> implementing 'change' using blockdev-insert-medium). >=20 > Shouldn't this update bdrv_states? I hate bdrv_states. Yes, it should. Thanks! Max > Consider this scenario: >=20 > 1) We add a drive and eject its BDS > { "execute": "blockdev-add", "arguments": { > "options": { "driver": "qcow2", > "file": { "driver": "file", > "filename": "/tmp/hd0.img"}, > "id": "drive0" }}} >=20 > { "execute": "eject", "arguments": {"device": "drive0"}} >=20 > 2) We create a new BDS and insert it in drive0 > { "execute": "blockdev-add", "arguments": { > "options": { "driver": "qcow2", > "file": { "driver": "file", > "filename": "/tmp/hd0.img"}, > "node-name": "hd0" }}} >=20 > { "execute": "blockdev-insert-medium", "arguments": { > "device": "drive0", > "node-name": "hd0" }} >=20 > 3) Now we try to create a snapshot... >=20 > { "execute": "blockdev-snapshot-sync", "arguments": { > "device": "drive0", > "snapshot-file": "/tmp/new.img", > "format": "qcow2" }} >=20 > {"error": {"class": "GenericError", > "desc": "The feature 'snapshot' is not enabled"}} >=20 > Ooops! It seems that this is because the new node hd0 is not in the > bdrv_states list. >=20 > 4) Let's try to create a mirror instead >=20 > { "execute": "drive-mirror", "arguments": { > "device": "drive0", > "target": "/tmp/new.img", > "sync": "top"}} >=20 > {"return": {}} > {"timestamp": {"seconds": 1445427560, > "microseconds": 765993}, > "event": "BLOCK_JOB_READY", > "data": {"device": "drive0", > "len": 0, > "offset": 0, > "speed": 0, > "type": "mirror"}} >=20 > 5) Ok, the block job is ready, so let's complete it: >=20 > { "execute": "query-block-jobs" } > {"return": []} >=20 > Ooops! Again, hd0 is not in bdrv_states so QEMU cannot find the bloc= k > job. >=20 > 6) Anyway, we only need the backend name in order to complete a block > job, so surely we can do it even if it's not in the list: >=20 > { "execute": "block-job-complete", "arguments": { > "device": "drive0"}} >=20 > Segmentation fault >=20 > That's QTAILQ_INSERT_BEFORE() in change_parent_backing_link(). This > code assumes that since the 'from' BDS is attached to a backend, it > must also be in bdrv_states. >=20 > Berto >=20 --XhKa9lXI7oJ2o1bw56wJBWho1VsIel9aN 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 iQEcBAEBCAAGBQJWJ5eLAAoJEDuxQgLoOKytvSYH/jZZ+j2s6FFx0uRlDyz15Xmk +SOXiA0dHTS2fS5Pk4IrP+M/TPwaUEjs8mhFa74ydBppQ3i3MlZHO+Kf7wcxGLwX FRmcYx3BhLleD+9fPUk1feQJO+w54hWpmwzr0L6Qc1oIViRig5Cf/0ht1wkgTcQy SsoTqpIUdD3Tr09fUoS6yZ3efzyqhFHQLSi0JBObEoovcqvvkEWLtsbX+W3DKRkw R43RqyeWHG4qmmEDib0hGUVI8K8BtYhtOwydn3qceWhpT1Ur9wX4c3D3OwHLU32R uBymzMuWZhJ3N/wfrpnaVFSrc0fCUE1kCTBjydqmOn2OCub/mTjRz2dwpyxoRqs= =lacp -----END PGP SIGNATURE----- --XhKa9lXI7oJ2o1bw56wJBWho1VsIel9aN--