[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/10] qga: implement qmp_guest_set_memory_blocks()
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 07/10] qga: implement qmp_guest_set_memory_blocks() for Linux with sysfs |
Date: |
Mon, 16 Feb 2015 21:14:49 -0600 |
From: zhanghailiang <address@hidden>
We can change guest's online/offline state of memory blocks, by using
command 'guest-set-memory-blocks'.
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
---
qga/commands-posix.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 6cd21b2..1c8080f 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2233,7 +2233,35 @@ GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error
**errp)
GuestMemoryBlockResponseList *
qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, Error **errp)
{
- error_set(errp, QERR_UNSUPPORTED);
+ GuestMemoryBlockResponseList *head, **link;
+ Error *local_err = NULL;
+
+ head = NULL;
+ link = &head;
+
+ while (mem_blks != NULL) {
+ GuestMemoryBlockResponse *result;
+ GuestMemoryBlockResponseList *entry;
+ GuestMemoryBlock *current_mem_blk = mem_blks->value;
+
+ result = g_malloc0(sizeof(*result));
+ result->phys_index = current_mem_blk->phys_index;
+ transfer_memory_block(current_mem_blk, false, result, &local_err);
+ if (local_err) { /* should never happen */
+ goto err;
+ }
+ entry = g_malloc0(sizeof *entry);
+ entry->value = result;
+
+ *link = entry;
+ link = &entry->next;
+ mem_blks = mem_blks->next;
+ }
+
+ return head;
+err:
+ qapi_free_GuestMemoryBlockResponseList(head);
+ error_propagate(errp, local_err);
return NULL;
}
--
1.9.1
- [Qemu-devel] [PATCH 10/10] qemu-ga-win: Fail loudly on bare 'set-time', (continued)
- [Qemu-devel] [PATCH 10/10] qemu-ga-win: Fail loudly on bare 'set-time', Michael Roth, 2015/02/16
- [Qemu-devel] [PATCH 01/10] qga: add guest-set-user-password command, Michael Roth, 2015/02/16
- [Qemu-devel] [PATCH 02/10] utils: drop strtok_r from envlist_parse, Michael Roth, 2015/02/16
- [Qemu-devel] [PATCH 09/10] qga: add memory block command that unsupported, Michael Roth, 2015/02/16
- [Qemu-devel] [PATCH 04/10] qga: implement file commands for Windows guest, Michael Roth, 2015/02/16
- [Qemu-devel] [PATCH 05/10] qga: introduce three guest memory block commmands with stubs, Michael Roth, 2015/02/16
- [Qemu-devel] [PATCH 07/10] qga: implement qmp_guest_set_memory_blocks() for Linux with sysfs,
Michael Roth <=
- [Qemu-devel] [PATCH 06/10] qga: implement qmp_guest_get_memory_blocks() for Linux with sysfs, Michael Roth, 2015/02/16
- [Qemu-devel] [PATCH 03/10] guest agent: guest-file-open: refactoring, Michael Roth, 2015/02/16
[Qemu-devel] [PATCH 08/10] qga: implement qmp_guest_get_memory_block_size() for Linux with sysfs, Michael Roth, 2015/02/16
Re: [Qemu-devel] [PULL 00/10] Fixes and new commands for QEMU Guest Agent, Michael Roth, 2015/02/17