mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 19:03:38 +08:00
qapi: Restrict balloon-related commands to machine code
Only qemu-system-FOO and qemu-storage-daemon provide QMP monitors, therefore such declarations and definitions are irrelevant for user-mode emulation. Restricting the balloon-related commands to machine.json pulls less QAPI-generated code into user-mode. Reviewed-by: David Hildenbrand <david@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200913195348.1064154-4-philmd@redhat.com> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
81e248ce7b
commit
a83e24ba1a
@ -24,7 +24,7 @@
|
||||
#include "hw/virtio/virtio-balloon.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-events-misc.h"
|
||||
#include "qapi/qapi-events-machine.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "trace.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#define QEMU_BALLOON_H
|
||||
|
||||
#include "exec/cpu-common.h"
|
||||
#include "qapi/qapi-types-misc.h"
|
||||
#include "qapi/qapi-types-machine.h"
|
||||
|
||||
typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target);
|
||||
typedef void (QEMUBalloonStatus)(void *opaque, BalloonInfo *info);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "qapi/qapi-commands-block.h"
|
||||
#include "qapi/qapi-commands-char.h"
|
||||
#include "qapi/qapi-commands-control.h"
|
||||
#include "qapi/qapi-commands-machine.h"
|
||||
#include "qapi/qapi-commands-migration.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qapi-commands-net.h"
|
||||
|
@ -945,3 +945,93 @@
|
||||
'data': 'NumaOptions',
|
||||
'allow-preconfig': true
|
||||
}
|
||||
|
||||
##
|
||||
# @balloon:
|
||||
#
|
||||
# Request the balloon driver to change its balloon size.
|
||||
#
|
||||
# @value: the target logical size of the VM in bytes
|
||||
# We can deduce the size of the balloon using this formula:
|
||||
# logical_vm_size = vm_ram_size - balloon_size
|
||||
# From it we have: balloon_size = vm_ram_size - @value
|
||||
#
|
||||
# Returns: - Nothing on success
|
||||
# - If the balloon driver is enabled but not functional because the KVM
|
||||
# kernel module cannot support it, KvmMissingCap
|
||||
# - If no balloon device is present, DeviceNotActive
|
||||
#
|
||||
# Notes: This command just issues a request to the guest. When it returns,
|
||||
# the balloon size may not have changed. A guest can change the balloon
|
||||
# size independent of this command.
|
||||
#
|
||||
# Since: 0.14.0
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "balloon", "arguments": { "value": 536870912 } }
|
||||
# <- { "return": {} }
|
||||
#
|
||||
# With a 2.5GiB guest this command inflated the ballon to 3GiB.
|
||||
#
|
||||
##
|
||||
{ 'command': 'balloon', 'data': {'value': 'int'} }
|
||||
|
||||
##
|
||||
# @BalloonInfo:
|
||||
#
|
||||
# Information about the guest balloon device.
|
||||
#
|
||||
# @actual: the logical size of the VM in bytes
|
||||
# Formula used: logical_vm_size = vm_ram_size - balloon_size
|
||||
#
|
||||
# Since: 0.14.0
|
||||
#
|
||||
##
|
||||
{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
|
||||
|
||||
##
|
||||
# @query-balloon:
|
||||
#
|
||||
# Return information about the balloon device.
|
||||
#
|
||||
# Returns: - @BalloonInfo on success
|
||||
# - If the balloon driver is enabled but not functional because the KVM
|
||||
# kernel module cannot support it, KvmMissingCap
|
||||
# - If no balloon device is present, DeviceNotActive
|
||||
#
|
||||
# Since: 0.14.0
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-balloon" }
|
||||
# <- { "return": {
|
||||
# "actual": 1073741824,
|
||||
# }
|
||||
# }
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-balloon', 'returns': 'BalloonInfo' }
|
||||
|
||||
##
|
||||
# @BALLOON_CHANGE:
|
||||
#
|
||||
# Emitted when the guest changes the actual BALLOON level. This value is
|
||||
# equivalent to the @actual field return by the 'query-balloon' command
|
||||
#
|
||||
# @actual: the logical size of the VM in bytes
|
||||
# Formula used: logical_vm_size = vm_ram_size - balloon_size
|
||||
#
|
||||
# Note: this event is rate-limited.
|
||||
#
|
||||
# Since: 1.2
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# <- { "event": "BALLOON_CHANGE",
|
||||
# "data": { "actual": 944766976 },
|
||||
# "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
|
||||
#
|
||||
##
|
||||
{ 'event': 'BALLOON_CHANGE',
|
||||
'data': { 'actual': 'int' } }
|
||||
|
@ -187,65 +187,6 @@
|
||||
{ 'command': 'query-iothreads', 'returns': ['IOThreadInfo'],
|
||||
'allow-preconfig': true }
|
||||
|
||||
##
|
||||
# @BalloonInfo:
|
||||
#
|
||||
# Information about the guest balloon device.
|
||||
#
|
||||
# @actual: the logical size of the VM in bytes
|
||||
# Formula used: logical_vm_size = vm_ram_size - balloon_size
|
||||
#
|
||||
# Since: 0.14.0
|
||||
#
|
||||
##
|
||||
{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
|
||||
|
||||
##
|
||||
# @query-balloon:
|
||||
#
|
||||
# Return information about the balloon device.
|
||||
#
|
||||
# Returns: - @BalloonInfo on success
|
||||
# - If the balloon driver is enabled but not functional because the KVM
|
||||
# kernel module cannot support it, KvmMissingCap
|
||||
# - If no balloon device is present, DeviceNotActive
|
||||
#
|
||||
# Since: 0.14.0
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "query-balloon" }
|
||||
# <- { "return": {
|
||||
# "actual": 1073741824,
|
||||
# }
|
||||
# }
|
||||
#
|
||||
##
|
||||
{ 'command': 'query-balloon', 'returns': 'BalloonInfo' }
|
||||
|
||||
##
|
||||
# @BALLOON_CHANGE:
|
||||
#
|
||||
# Emitted when the guest changes the actual BALLOON level. This value is
|
||||
# equivalent to the @actual field return by the 'query-balloon' command
|
||||
#
|
||||
# @actual: the logical size of the VM in bytes
|
||||
# Formula used: logical_vm_size = vm_ram_size - balloon_size
|
||||
#
|
||||
# Note: this event is rate-limited.
|
||||
#
|
||||
# Since: 1.2
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# <- { "event": "BALLOON_CHANGE",
|
||||
# "data": { "actual": 944766976 },
|
||||
# "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
|
||||
#
|
||||
##
|
||||
{ 'event': 'BALLOON_CHANGE',
|
||||
'data': { 'actual': 'int' } }
|
||||
|
||||
##
|
||||
# @PciMemoryRange:
|
||||
#
|
||||
@ -756,37 +697,6 @@
|
||||
##
|
||||
{ 'command': 'inject-nmi' }
|
||||
|
||||
##
|
||||
# @balloon:
|
||||
#
|
||||
# Request the balloon driver to change its balloon size.
|
||||
#
|
||||
# @value: the target logical size of the VM in bytes
|
||||
# We can deduce the size of the balloon using this formula:
|
||||
# logical_vm_size = vm_ram_size - balloon_size
|
||||
# From it we have: balloon_size = vm_ram_size - @value
|
||||
#
|
||||
# Returns: - Nothing on success
|
||||
# - If the balloon driver is enabled but not functional because the KVM
|
||||
# kernel module cannot support it, KvmMissingCap
|
||||
# - If no balloon device is present, DeviceNotActive
|
||||
#
|
||||
# Notes: This command just issues a request to the guest. When it returns,
|
||||
# the balloon size may not have changed. A guest can change the balloon
|
||||
# size independent of this command.
|
||||
#
|
||||
# Since: 0.14.0
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# -> { "execute": "balloon", "arguments": { "value": 536870912 } }
|
||||
# <- { "return": {} }
|
||||
#
|
||||
# With a 2.5GiB guest this command inflated the balloon to 3GiB.
|
||||
#
|
||||
##
|
||||
{ 'command': 'balloon', 'data': {'value': 'int'} }
|
||||
|
||||
##
|
||||
# @human-monitor-command:
|
||||
#
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "sysemu/kvm.h"
|
||||
#include "sysemu/balloon.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qapi/qapi-commands-machine.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "trace.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user