Received: from eggs.gnu.org ([2001:4830:134:3::10]:38617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHpDm-0004Ao-Ip for qemu-devel@nongnu.org; Thu, 14 Aug 2014 03:13:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHpDd-0008O6-II for qemu-devel@nongnu.org; Thu, 14 Aug 2014 03:13:14 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:60906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHpDd-0008Nw-Bf for qemu-devel@nongnu.org; Thu, 14 Aug 2014 03:13:05 -0400 Received: by mail-pa0-f53.google.com with SMTP id rd3so1130643pab.12 for ; Thu, 14 Aug 2014 00:13:04 -0700 (PDT) Sender: Hitoshi Mitake Date: Thu, 14 Aug 2014 16:13:00 +0900 Message-ID: <87bnrnsfwj.wl%mitake.hitoshi@lab.ntt.co.jp> From: Hitoshi Mitake In-Reply-To: <20140813143338.GD4750@stefanha-thinkpad.redhat.com> References: <1407905321-10219-1-git-send-email-mitake.hitoshi@lab.ntt.co.jp> <20140813143338.GD4750@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII 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: Stefan Hajnoczi Cc: Hitoshi Mitake , Kevin Wolf , qemu-devel@nongnu.org, mitake.hitoshi@gmail.com At Wed, 13 Aug 2014 15:33:38 +0100, Stefan Hajnoczi wrote: > > [1 ] > On Wed, Aug 13, 2014 at 01:48:41PM +0900, Hitoshi Mitake wrote: > > @@ -485,6 +493,10 @@ static BlockDriverAIOCB *blkdebug_aio_readv(BlockDriverState *bs, > > BDRVBlkdebugState *s = bs->opaque; > > BlkdebugRule *rule = NULL; > > > > + if (s->qmp_fault_state != BLOCK_FAULT_STATE_NONE) { > > + return inject_error(bs, cb, opaque, rule); > > + } > > + > > QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) { > > if (rule->options.inject.sector == -1 || > > (rule->options.inject.sector >= sector_num && Hi Stefan, thanks a lot for your review. > > 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. It seems a better idea than current implementation. It will be more powerful and easy to maintain. I'll implement the above scheme in v2. Thanks, Hitoshi