Hi all, This series adds a python framework aiming to provide some ways to do fault injection in a running vm. In its current state, it allows to easily interact with memory, change gpios and qom properties.
The framework consists in a python script based on the qmp existing module which allows to interact with the vm. The series introduces a QMP command to schedule some virtual-clock-time-based notifications. The notification is sent back to the python framework and can be used to build time-driven fault scenario. Additionaly the series adds some new QMP commands: Commands are added to read/write memory or memory-mapped registers. Arguments are similar to the existing [p]memsave commands. A command is added to set a value to a qdev gpio. Here's is a simple visual example which inject characters on the uart output of the zynq platform: $ # qemu must have been launched with -qmp unix:/tmp/qmpsock,server $ # create the python framework object $ import fault_injection $ inj = fault_injection.FaultInjectionFramework("/tmp/qmpsock", 0) $ $ # function which display a 'X' to the first uart $ # it access directly the register using the physical address $ def cb(): $ inj.write_pmem(0xe0000030,4, 88) $ $ # schedule the function on a notification in 10s $ inj.notify(10 * 1000 * 1000 * 1000, cb, True) $ $ # handle one notification $ inj.run_once() The framework has been tested using python 2, on qemu running xilinx_zynq or virt arm machines. The series is organised as follows. Patches 1 and 2 adds the memory qmp and gpio commands. Patch 3 adds the notification mechanism. Patches 4 and 5 add a python helper module and some documention. Thanks to the Xilinx's QEMU team who sponsored this work. Damien Hedde (5): introduce [p]mem(read|write) qmp commands introduce a qmp command to set gpios add qmp time-notify event triggering system fault_injection: introduce Python scripting framework docs: add fault injection framework documentation cpus.c | 126 +++++++++++++++ docs/fault_injection.txt | 149 ++++++++++++++++++ monitor/Makefile.objs | 1 + monitor/qmp-cmd-time-notify.c | 116 ++++++++++++++ monitor/qmp-cmds.c | 30 ++++ monitor/trace-events | 4 + qapi/misc.json | 196 +++++++++++++++++++++++ scripts/qmp/fault_injection.py | 278 +++++++++++++++++++++++++++++++++ 8 files changed, 900 insertions(+) create mode 100644 docs/fault_injection.txt create mode 100644 monitor/qmp-cmd-time-notify.c create mode 100644 scripts/qmp/fault_injection.py -- 2.22.0