mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
blkdebug: Add events and rules
Block drivers can trigger a blkdebug event whenever they reach a place where it could be useful to inject an error for testing/debugging purposes. Rules are read from a blkdebug config file and describe which action is taken when an event is triggered. For now this is only injecting an error (with a few options) or changing the state (which is an integer). Rules can be declared to be active only in a specific state; this way later rules can distiguish on which path we came to trigger their event. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
25920d6ad6
commit
8b9b0cc2fd
4 changed files with 272 additions and 1 deletions
12
block.c
12
block.c
|
@ -1535,6 +1535,18 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
|
|||
return drv->bdrv_load_vmstate(bs, buf, pos, size);
|
||||
}
|
||||
|
||||
void bdrv_debug_event(BlockDriverState *bs, BlkDebugEvent event)
|
||||
{
|
||||
BlockDriver *drv = bs->drv;
|
||||
|
||||
if (!drv || !drv->bdrv_debug_event) {
|
||||
return;
|
||||
}
|
||||
|
||||
return drv->bdrv_debug_event(bs, event);
|
||||
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
/* handling of snapshots */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue