From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHZcp-00015r-WA for qemu-devel@nongnu.org; Wed, 13 Aug 2014 10:34:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHZcj-0003L0-Mq for qemu-devel@nongnu.org; Wed, 13 Aug 2014 10:34:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHZcj-0003Kq-DJ for qemu-devel@nongnu.org; Wed, 13 Aug 2014 10:33:57 -0400 Date: Wed, 13 Aug 2014 15:33:38 +0100 From: Stefan Hajnoczi Message-ID: <20140813143338.GD4750@stefanha-thinkpad.redhat.com> References: <1407905321-10219-1-git-send-email-mitake.hitoshi@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6Nae48J/T25AfBN4" Content-Disposition: inline In-Reply-To: <1407905321-10219-1-git-send-email-mitake.hitoshi@lab.ntt.co.jp> Subject: Re: [Qemu-devel] [PATCH RFC] blkdebug: make the fault injection functionality callable from QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hitoshi Mitake Cc: Kevin Wolf , qemu-devel@nongnu.org, mitake.hitoshi@gmail.com --6Nae48J/T25AfBN4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 13, 2014 at 01:48:41PM +0900, Hitoshi Mitake wrote: > @@ -485,6 +493,10 @@ static BlockDriverAIOCB *blkdebug_aio_readv(BlockDri= verState *bs, > BDRVBlkdebugState *s =3D bs->opaque; > BlkdebugRule *rule =3D NULL; > =20 > + if (s->qmp_fault_state !=3D BLOCK_FAULT_STATE_NONE) { > + return inject_error(bs, cb, opaque, rule); > + } > + > QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) { > if (rule->options.inject.sector =3D=3D -1 || > (rule->options.inject.sector >=3D sector_num && A QMP command is a good idea but the hardcoded s->qmp_fault_state error injection is much less powerful than the rules that blkdebug already supports. Can you make the QMP command take a list of rules instead of setting s->qmp_fault_state? For example: # Clear all rules blkdebug-set-rules drive0 [] # Return EIO on disk flush after L1 update blkdebug-set-rules drive0 [ {"type": "set-state", "event": "BLKDBG_L1_UPDATE", "state": 0, "new-state" 1} {"type": "inject-error", "state": 1, "event": "BLKDBG_FLUSH_TO_DISK", "errno": "EIO", "once": true}, ] In other words, instead of adding a new (more limited) mechanism for triggering error injection, please make the QMP command install a list of blkdebug rules. Stefan --6Nae48J/T25AfBN4 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT63dCAAoJEJykq7OBq3PITnQH/05oea4cMRS17fzQRMGkKugw ZHUDpg6BtYvk+adwJmBeHv6ewIyemYCCQ+KiRG839tHh8HYkYF+Qiaf9g/MTXaZo N5rZD+uv5cZ+M2dvZ6wttgLAmkdAH9F5yoOHvIZzV44fNQGH/ZKXSQBSqPT8RUfw iNJZsbxD4Cn3BhiUOCvaG7Hk49rZpRblu1gSTW51MFyfpNaz44xKRHlsWKremjpS PtKYlWwt10UAzh7gcBqoM+bMOz2MYPki+AQTRsEn4LajC+/XaNbUT/sust3/fbSm OWyt/0ho8fp2OfRKR+s/xjml7VD0uM+Tzjqs5hQvmDL2tW/lj0e3f4YfxsUq51k= =ABh0 -----END PGP SIGNATURE----- --6Nae48J/T25AfBN4--