Quoting zhanghailiang (2015-01-21 20:40:01) > This patch series add three guest commands about memory block: > guest-get-memory-blocks, guest-set-memory-blocks, guest-get-memory-block-size. > > With these three commands, we can get information about guest's memory block > online/offline status and memory block size (unit of memory online/offline > operation ). Also, we can change guest's memory block status (Logical memory > hotplug/unplug) from host.
Thanks, applied to QGA tree: https://github.com/mdroth/qemu/commits/qga with a small change to patch 2 that replaces an assertion that the block list isn't NULL with a reported error instead. This is more of an assertion about the guest OS than the code itself, so it's best to avoid tying the life-cycle of the agent to it. Otherwise looks good. > > Example of usage: > > {"execute":"guest-get-memory-blocks"} > {"return":[{"online":true,"can-offline":false,"phys-index":0},{"online":true,"can-offline":true,"phys-index":1},{"online":true,"can-offline":false,"phys-index":2},{"online":true,"can-offline":false,"phys-index":3}]} > > {"execute":"guest-set-memory-blocks","arguments":{"mem-blks":[{"phys-index":0,"online":false},{"phys-index":1,"online":false},{"phys-index":3,"online":false}]}} > {"return":[{"response":"operation-failed","error-code":22,"phys-index":0},{"response":"success","phys-index":1},{"response":"operation-failed","error-code":16,"phys-index":3}]} > > {"execute":"guest-get-memory-block-size"} > {"return":134217728} > > v2: > - Change return value of 'guest-set-memory-blocks' command from 'int' to a > list > of 'GuestMemoryBlockResponse', which contains more info about the > operation > results. It is suggested by Michael Roth. It is more useful for callers to > know the exact operation result for each memory block, and also they can > help > callers to decide what to do next according to different error-code. > > zhanghailiang (5): > qga: introduce three guest memory block commmands with stubs > qga: implement qmp_guest_get_memory_blocks() for Linux with sysfs > qga: implement qmp_guest_set_memory_blocks() for Linux with sysfs > qga: implement qmp_guest_get_memory_block_size() for Linux with sysfs > qga: add memory block command that unsupported to blacklist > > qga/commands-posix.c | 324 > ++++++++++++++++++++++++++++++++++++++++++++++++++- > qga/commands-win32.c | 21 ++++ > qga/qapi-schema.json | 114 ++++++++++++++++++ > 3 files changed, 458 insertions(+), 1 deletion(-) > > -- > 1.7.12.4