Currently cache setting of a block device cannot be changed without restarting a running VM. Following patchset is for enabling dynamic change of cache setting for block devices through qemu monitor. Code changes are based on patches from Christoph Hellwig and Prerna Saxena.
Monitor command "info block" is extended to display cache setting of block devices. New monitor command "cache_set" is added using which cache setting can be dynamically changed Usage: "cache_set <device> <cache>" <device> = block device <cache> = "off"/"none", "on"/"writeback", "writethrough", "unsafe" 1/3 Enhance "info block" to display cache setting 2/3 New error classes for file reopen and device insertion 3/3 Add monitor command "cache_set" for dynamic cache change qemu/block.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- qemu/block.h | 2 + qemu/blockdev.c | 20 +++++++++++++++++++ qemu/blockdev.h | 1 qemu/hmp-commands.hx | 14 +++++++++++++ qemu/qerror.c | 8 +++++++ qemu/qerror.h | 6 +++++ qemu/qmp-commands.hx | 28 ++++++++++++++++++++++++++ 8 files changed, 148 insertions(+), 2 deletions(-) ~