All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: [Qemu-devel] [PATCH 05/10] qga: introduce three guest memory block commmands with stubs
Date: Mon, 16 Feb 2015 21:14:47 -0600	[thread overview]
Message-ID: <1424142892-7275-6-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1424142892-7275-1-git-send-email-mdroth@linux.vnet.ibm.com>

From: zhanghailiang <zhang.zhanghailiang@huawei.com>

Introduce three new guest commands:
guest-get-memory-blocks, guest-set-memory-blocks, guest-get-memory-block-size.

With these three commands, we can support online/offline guest's memory block
(logical memory hotplug/unplug) as required from host.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qga/commands-posix.c |  38 +++++++++++++++++
 qga/commands-win32.c |  19 +++++++++
 qga/qapi-schema.json | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 170 insertions(+)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index ed527a3..0ce27a4 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1992,6 +1992,25 @@ out:
     }
 }
 
+GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+GuestMemoryBlockResponseList *
+qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+int64_t qmp_guest_get_memory_block_size(Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return -1;
+}
+
 #else /* defined(__linux__) */
 
 void qmp_guest_suspend_disk(Error **errp)
@@ -2035,6 +2054,25 @@ void qmp_guest_set_user_password(const char *username,
     error_set(errp, QERR_UNSUPPORTED);
 }
 
+GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+GuestMemoryBlockResponseList *
+qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+int64_t qmp_guest_get_memory_block_size(Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return -1;
+}
+
 #endif
 
 #if !defined(CONFIG_FSFREEZE)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 9af7950..30e377b 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -684,6 +684,25 @@ void qmp_guest_set_user_password(const char *username,
     error_set(errp, QERR_UNSUPPORTED);
 }
 
+GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+GuestMemoryBlockResponseList *
+qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
+int64_t qmp_guest_get_memory_block_size(Error **errp)
+{
+    error_set(errp, QERR_UNSUPPORTED);
+    return -1;
+}
+
 /* add unsupported commands to the blacklist */
 GList *ga_command_blacklist_init(GList *blacklist)
 {
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index 5117b65..b69cfe1 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -765,3 +765,116 @@
 ##
 { 'command': 'guest-set-user-password',
   'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
+
+# @GuestMemoryBlock:
+#
+# @phys-index: Arbitrary guest-specific unique identifier of the MEMORY BLOCK.
+#
+# @online: Whether the MEMORY BLOCK is enabled in guest.
+#
+# @can-offline: #optional Whether offlining the MEMORY BLOCK is possible.
+#               This member is always filled in by the guest agent when the
+#               structure is returned, and always ignored on input (hence it
+#               can be omitted then).
+#
+# Since: 2.3
+##
+{ 'type': 'GuestMemoryBlock',
+  'data': {'phys-index': 'uint64',
+           'online': 'bool',
+           '*can-offline': 'bool'} }
+
+##
+# @guest-get-memory-blocks:
+#
+# Retrieve the list of the guest's memory blocks.
+#
+# This is a read-only operation.
+#
+# Returns: The list of all memory blocks the guest knows about.
+# Each memory block is put on the list exactly once, but their order
+# is unspecified.
+#
+# Since: 2.3
+##
+{ 'command': 'guest-get-memory-blocks',
+  'returns': ['GuestMemoryBlock'] }
+
+##
+# @GuestMemoryBlockResponseType
+#
+# An enumeration of memory block operation result.
+#
+# @sucess: the operation of online/offline memory block is successful.
+# @not-found: can't find the corresponding memoryXXX directory in sysfs.
+# @operation-not-supported: for some old kernels, it does not support
+#                           online or offline memory block.
+# @operation-failed: the operation of online/offline memory block fails,
+#                    because of some errors happen.
+#
+# Since: 2.3
+##
+{ 'enum': 'GuestMemoryBlockResponseType',
+  'data': ['success', 'not-found', 'operation-not-supported',
+           'operation-failed'] }
+
+##
+# @GuestMemoryBlockResponse:
+#
+# @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
+#
+# @response: the result of memory block operation.
+#
+# @error-code: #optional the error number.
+#               When memory block operation fails, we assign the value of
+#               'errno' to this member, it indicates what goes wrong.
+#               When the operation succeeds, it will be omitted.
+#
+# Since: 2.3
+##
+{ 'type': 'GuestMemoryBlockResponse',
+  'data': { 'phys-index': 'uint64',
+            'response': 'GuestMemoryBlockResponseType',
+            '*error-code': 'int' }}
+
+##
+# @guest-set-memory-blocks:
+#
+# Attempt to reconfigure (currently: enable/disable) state of memory blocks
+# inside the guest.
+#
+# The input list is processed node by node in order. In each node @phys-index
+# is used to look up the guest MEMORY BLOCK, for which @online specifies the
+# requested state. The set of distinct @phys-index's is only required to be a
+# subset of the guest-supported identifiers. There's no restriction on list
+# length or on repeating the same @phys-index (with possibly different @online
+# field).
+# Preferably the input list should describe a modified subset of
+# @guest-get-memory-blocks' return value.
+#
+# Returns: The operation results, it is a list of @GuestMemoryBlockResponse,
+#          which is corresponding to the input list.
+#
+#          Note: it will return NULL if the @mem-blks list was empty on input,
+#          or there is an error, and in this case, guest state will not be
+#          changed.
+#
+# Since: 2.3
+##
+{ 'command': 'guest-set-memory-blocks',
+  'data':    {'mem-blks': ['GuestMemoryBlock'] },
+  'returns': ['GuestMemoryBlockResponse'] }
+
+##
+# @guest-get-memory-block-size:
+#
+# Get the the size (in bytes) of a memory block in guest.
+# It is the unit of memory block online/offline operation (also called Logical
+# Memory Hotplug).
+#
+# Returns: memory block size in bytes.
+#
+# Since 2.3
+##
+{ 'command': 'guest-get-memory-block-size',
+  'returns': 'int' }
-- 
1.9.1

  parent reply	other threads:[~2015-02-17  3:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17  3:14 [Qemu-devel] [PULL 00/10] Fixes and new commands for QEMU Guest Agent Michael Roth
2015-02-17  3:14 ` [Qemu-devel] [PATCH 01/10] qga: add guest-set-user-password command Michael Roth
2015-02-17  3:14 ` [Qemu-devel] [PATCH 02/10] utils: drop strtok_r from envlist_parse Michael Roth
2015-02-17  3:14 ` [Qemu-devel] [PATCH 03/10] guest agent: guest-file-open: refactoring Michael Roth
2015-02-17 15:27   ` Eric Blake
2015-02-17 16:06     ` Denis V. Lunev
2015-02-17 17:56       ` Michael Roth
2015-02-17 17:59         ` Eric Blake
2015-02-19 17:50           ` Denis V. Lunev
2015-02-17 18:05         ` Denis V. Lunev
2015-02-17  3:14 ` [Qemu-devel] [PATCH 04/10] qga: implement file commands for Windows guest Michael Roth
2015-02-17  3:14 ` Michael Roth [this message]
2015-02-17 15:26   ` [Qemu-devel] [PATCH 05/10] qga: introduce three guest memory block commmands with stubs Eric Blake
2015-02-17 18:10     ` Michael Roth
2015-02-25  2:46       ` zhanghailiang
2015-02-25  2:51     ` zhanghailiang
2015-02-17  3:14 ` [Qemu-devel] [PATCH 06/10] qga: implement qmp_guest_get_memory_blocks() for Linux with sysfs Michael Roth
2015-02-17  3:14 ` [Qemu-devel] [PATCH 07/10] qga: implement qmp_guest_set_memory_blocks() " Michael Roth
2015-02-17  3:14 ` [Qemu-devel] [PATCH 08/10] qga: implement qmp_guest_get_memory_block_size() " Michael Roth
2015-02-17  3:14 ` [Qemu-devel] [PATCH 09/10] qga: add memory block command that unsupported Michael Roth
2015-02-17  3:14 ` [Qemu-devel] [PATCH 10/10] qemu-ga-win: Fail loudly on bare 'set-time' Michael Roth
2015-02-17 18:36 ` [Qemu-devel] [PULL 00/10] Fixes and new commands for QEMU Guest Agent Michael Roth
2015-02-17 22:40 [Qemu-devel] [PULL v2 " Michael Roth
2015-02-17 22:40 ` [Qemu-devel] [PATCH 05/10] qga: introduce three guest memory block commmands with stubs Michael Roth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424142892-7275-6-git-send-email-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.