From: Marc-André Lureau <marcandre.lur...@redhat.com>

Define a new guest agent message, and document it.

Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
---
 qga/commands-posix.c | 12 ++++++++++++
 qga/commands-win32.c |  6 ++++++
 qga/qapi-schema.json | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 675f4b4..eb4036e 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2328,8 +2328,20 @@ GuestMemoryBlockInfo 
*qmp_guest_get_memory_block_info(Error **errp)
     return info;
 }
 
+GuestMemoryInfo *qmp_guest_get_memory_info(Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
 #else /* defined(__linux__) */
 
+GuestMemoryInfo *qmp_guest_get_memory_info(Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
+
 void qmp_guest_suspend_disk(Error **errp)
 {
     error_setg(errp, QERR_UNSUPPORTED);
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 77d3c92..bf9cd93 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -1332,3 +1332,9 @@ void ga_command_state_init(GAState *s, GACommandState *cs)
     }
     ga_command_state_add(cs, guest_file_init, NULL);
 }
+
+GuestMemoryInfo *qmp_guest_get_memory_info(Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+    return NULL;
+}
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index 6b0bd16..3767896 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -929,3 +929,51 @@
 ##
 { 'command': 'guest-get-memory-block-info',
   'returns': 'GuestMemoryBlockInfo' }
+
+##
+# @GuestMemoryInfo
+#
+# Information about guest memory, in kiB.
+#
+# @mem-total: Total usable RAM.
+#
+# @mem-free:  Total of RAM that can be used without having to swap contents to 
disk.
+#
+# @mem-cached: In-RAM cache.
+#
+# @swap-total: Total amount of swap space available.
+#
+# @swap-free: Amount of swap space that is currently unused.
+#
+# @swap-in: Number of pages swapped-in per second.
+#
+# @swap-out: Number of pages swapped-out per second.
+#
+# @pf-major: Number of major page fault per second.
+#
+# @pf-minor: Number of minor page fault per second.
+#
+# Since: 2.5
+##
+{ 'struct': 'GuestMemoryInfo',
+  'data': { 'mem-total': 'uint64',
+            'mem-free': 'uint64',
+            'mem-cached': 'uint64',
+            'swap-total': 'uint64',
+            'swap-free': 'uint64',
+            'swap-in': 'uint64',
+            'swap-out': 'uint64',
+            'pf-major': 'uint64',
+            'pf-minor': 'uint64' } }
+
+##
+# @guest-get-memory-info:
+#
+# Get guest memory information.
+#
+# Returns: @GuestMemInfo
+#
+# Since: 2.5
+##
+{ 'command': 'guest-get-memory-info',
+  'returns': 'GuestMemoryInfo' }
-- 
2.4.3


Reply via email to