History | View | Annotate | Download (121.5 kB)
Monitor: Drop QMP documentation from code
Previous commit added QMP documentation to the qemu-monitor.hxfile, it's is a copy of this information.
While it's good to keep it near code, maintaining two copies ofthe same information is too hard and has little benefit as we...
Monitor: Return before exiting with 'quit'
This is a new version of the (now reverted) following commit:
0e8d2b5575938b8876a3c4bb66ee13c5d306fb6d
The 'quit' Monitor command (implemented by do_quit()) callsexit() directly, this is problematic under QMP because QEMU...
Revert "Monitor: Return before exiting with 'quit'"
This reverts commit 0e8d2b5575938b8876a3c4bb66ee13c5d306fb6d.
Next commits will do the same thing in a better way.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
sparc: Fix lazy flag calculation on interrupts, refactor
Recalculate Sparc64 CPU flags on interrupts, otherwise some earlierflags could be stored to pstate.
Refactor PSR/CCR/CWP handling: concentrate the actualfunctions to op_helper.c.
Thanks to Igor Kovalenko for reporting....
block: read-only: open cdrom as read-only when using monitor's change command
Current code of monitor command: 'change', used to open file for read-writeuncoditionally. Change to open it as read-only for CDROM, and read-write for all others.
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>...
QMP: Introduce RESUME event
It's emitted when the Virtual Machine resumes execution.
We currently have the STOP event but don't have the matchingRESUME one, this means that clients are notified when the VMis stopped but don't get anything when it resumes....
stash away SCM_RIGHTS fd until a getfd command arrives
If there is already a fd in s->msgfd before recvmsg it isclosed by parts that this patch does not touch. So, onlyone descriptor can be "leaked" by attaching it to a commandother than getfd.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
The 'quit' Monitor command (implemented by do_quit()) callsexit() directly, this is problematic under QMP because QEMUexits before having a chance to send the ok response.
Clients don't know if QEMU exited because of a problem or...
QMP: Check "arguments" member's type
Otherwise the following input crashes QEMU:
{ "execute": "migrate", "arguments": "tcp:0:4446" }
QMP: Use QERR_QMP_BAD_INPUT_OBJECT_MEMBER
The QERR_QMP_BAD_INPUT_OBJECT error is going to be used onlyfor two problems: the input is not an object or the "execute" key is missing.
Replace calls of old bdrv_open
What is known today as bdrv_open2 becomes the new bdrv_open. All remainingcallers of the old function are converted to the new one. In some places theyeven know the right format, so they should have used bdrv_open2 from the...
monitor: Rename argument type 'b' to 'f'
To make 'b' available for boolean argument.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
monitor: New argument type 'b'
This is a boolean value. Human monitor accepts "on" or "off".Consistent with option parsing (see parse_option_bool()).
Monitor: Convert do_screen_dump() to QObject
Trivial, as it never fails, doesn't have output nor returnany data.
Note that it's also available under QMP, as kvm-autotestneeds this.
error: Use QERR_INVALID_PARAMETER_VALUE instead of QERR_INVALID_PARAMETER
Add qerror message if the 'change' target filename can't be opened
Currently when using the change command to switch the file in the cd drivethe command doesn't complain if the file doesn't exit or can't be openedand the drive keeps the existing image. This patch adds a qerror_report...
move balloon handling to balloon.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
error: Trim includes after "Move qemu_error & friends..."
Missed in commit 2f792016.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Wrong error message in block_passwd command
Signed-off-by: Shahar Havivi <shaharh@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: New argument type 'O'
In the human monitor, it declares a single optional argument to beparsed according to the QemuOptsList given by its name.
In QMP, it declares an optional argument for each member of theQemuOptsList.
Restriction: only lists with empty desc are supported for now. Good...
monitor: New monitor_cur_is_qmp()
error: Let converted handlers print in human monitor
While fully converted handlers are not supposed to print anything whenrunning in a QMP monitor, they are free to print in a human monitor.For instance, device_add (not yet converted) prints help, and will...
error: Rename qemu_error_new() to qerror_report()
savevm: Fix -loadvm to report errors to stderr, not the monitor
A monitor may not even exist.
Change load_vmstate() to use qemu_error() instead of monitor_printf().Parameter mon is now unused, remove it.
monitor: Separate "default monitor" and "current monitor" cleanly
Commits 376253ec..731b0364 introduced global variable cur_mon, whichpoints to the "default monitor" (if any), except during execution ofmonitor_read() or monitor_control_read() it points to the monitor from...
monitor: Factor monitor_set_error() out of qemu_error_internal()
This separates the monitor part from the QError part.
error: Move qemu_error() & friends from monitor.c to own file
They're about reporting errors, not about the monitor.
error: Simplify error sink setup
qemu_error_sink can either point to a monitor or a file. In practice,it always points to the current monitor if we have one, else tostderr. Simply route errors to the current monitor or else to stderr,and remove qemu_error_sink along with the functions to control it....
QMP: Introduce WATCHDOG event
It's emitted whenever the watchdog device's timer expires. The actiontaken is provided in the 'data' member.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
QMP: Introduce RTC_CHANGE event
Emitted whenever the RTC time changes.
QMP: Drop DEBUG event
This event has been introduced in the first round of QMP commits,turns out that it's based on the usage of the EXCP_DEBUG macro,which has discussable semantics when exposed through QMP.
As libvirt doesn't use this, let's just drop it....
Fix hanging user monitor when using balloon command
This patch application failed. My patch adds a cb() call indo_balloon(), but the change in git has added the cb() call todo_info_balloon(). That is causing qemu segfaults. Applying thefollowing should correct the damage. Thanks....
fix 'i' format handling in memory dump
It was broken by 09b9418c6d0. (!env && = (!is_physical)when env is true.
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Arghh... Adding missing S-O-B
Hi Anthony. I wonder if there was a problem when importing my asynccommand handler patchset. Since the 'balloon' command completesimmediately, it must call the completion callback before returning....
Monitor: Debugging support
Add configure options (--enable-debug-mon and --disable-debug-mon)plus the MON_DEBUG() macro.
Monitor: Drop the print disabling mechanism
We can ignore calls to monitor_vprintf() in QMP mode and usemonitor_puts() directly in monitor_json_emitter().
This allows us to drop this ugly hack.
Monitor: Audit handler return
This commit verifies the following two rules specified byMarkus Armbruster:
1. If the handler returns failure, it must have passed an error.
If it didn't, it's broken. Report an internal error to the client, and report the bug to the programmer....
Monitor: Debug stray prints the right way
QObject Monitor handlers should not call any Monitor printfunction: they should only build objects, printing is doneby common code.
Current QMP code will ignore such calls, as we can't sendgarbage to clients, additionally it will also emit an...
Monitor: Report more than one error in handlers
Handlers can generate only one error in a call, we let theprogrammer know if they brake this rule and clients will onlyget the first generated error.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>...
Monitor: Convert do_getfd() to cmd_new_ret()
Monitor: Convert do_closefd() to cmd_new_ret()
Monitor: Convert do_memory_save() to cmd_new_ret()
Monitor: Convert do_physical_memory_save() to cmd_new_ret()
Monitor: Convert do_info() to cmd_new_ret()
Note that this function only fails in QMP, in the user Monitorit prints the help text instead.
Monitor: Convert do_change() to cmd_new_ret()
Not that trivial as the call chain also has to be modified.
Monitor: Rename cmd_new_ret()
Now that all handlers are converted to cmd_new_ret(), we can renameit back to cmd_new(). But now it returns a value.
Monitor: Introduce cmd_new_ret()
In order to implement the new error handling and debuggingmechanism for command handlers, we need to change the cmd_new()callback to return a value.
This commit introduces cmd_new_ret(), which returns a value andwill be used only temporarily to handle the transition from...
Monitor: Convert simple handlers to cmd_new_ret()
The following handlers always succeed and hence can be convertedto cmd_new_ret() in the same commit.
- do_stop()- do_quit()- do_system_reset()- do_system_powerdown()- do_migrate_cancel()- do_qmp_capabilities()...
Monitor: Convert do_cont() to cmd_new_ret()
Monitor: Convert do_eject() to cmd_new_ret()
Monitor: Convert do_cpu_set() to cmd_new_ret()
Monitor: Convert do_block_set_passwd() to cmd_new_ret()
Monitor: remove unneeded checks
It's not needed to check the return of qobject_from_jsonf()anymore, as an assert() has been added there.
QError: Don't abort on multiple faults
Ideally, Monitor code should report an error only once andreturn the error information up the call chain.
To assure that this happens as expected and that no error islost, we have an assert() in qemu_error_internal()....
QMP: Don't leak on connection close
QMP's chardev event callback doesn't calljson_message_parser_destroy() on CHR_EVENT_CLOSED. As the callto json_message_parser_init() on CHR_EVENT_OPENED allocates memory,we'are leaking on close.
Fix that by just calling json_message_parser_destroy() on...
QMP: Add QEMU's version to the greeting message
With capability negotiation support clients will only have a chanceto check QEMU's version (ie. issue 'query-version') after thenegotiation procedure is done.
It might be useful to clients to check QEMU's version before...
QMP: Introduce the qmp_capabilities command
This command will be used to enable QMP capabilities advertisedby the capabilities array.
Note that it will be mandatory to issue this command in orderto make QMP functional (although this behavior is not being...
QMP: Enforce capability negotiation rules
With this commit QMP will be started in Capabilities Negotiationmode, where the only command allowed to run is 'qmp_capabilities'.
All other commands will return CommandNotFound error. Asynchronousmessages are not delivered either....
QMP: BLOCK_IO_ERROR event handling
This commit adds the basic definitions for the BLOCK_IO_ERRORevent, but actual event emission will be introduced by thenext commits.
monitor: Use QERR_INVALID_PARAMETER instead of QERR_INVALID_CPU_INDEX
This changes the error message from "Invalid CPU index" to "Invalidparameter index" in the human monitor.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This is a double value with optional suffixes G, g, M, m, K, k. We'llneed this to get migrate_set_speed() QMP-ready.
monitor: New argument type 'T'
This is a double value with optional suffixes ms, us, ns. We'll needthis to get migrate_set_downtime() QMP-ready.
monitor: Document argument type 'M'
Was forgotten in commit b6e098d7.
Monitor: Fix command execution regression
Function is_async_return() added by commit 940cc30d0d4 assumesthat 'data', which is returned by handlers, is always a QDict.
This is not true, as QLists can also be returned, in this casewe'll get a segfault....
New API for asynchronous monitor commands
Qemu has a number of commands that can operate asynchronously (savevm, migrate,etc) and it will be getting more. For these commands, the user monitor needsto be suspended, but QMP monitors could continue to to accept other commands....
virtio: Add memory statistics reporting to the balloon driver
When using ballooning to manage overcommitted memory on a host, a system forguests to communicate their memory usage to the host can provide informationthat will minimize the impact of ballooning on the guests. The current method...
PCI: Convert pci_info() to QObject
The returned QObject is a QList of all buses. Each bus isrepresented by a QDict, which has a key with a QList of allPCI devices attached to it. Each device is represented bya QDict.
As has happended to other complex conversions, it's hard to...
monitor.c: fix warnings with _FORTIFY_SOURCE
CC i386-softmmu/monitor.occ1: warnings being treated as errors/usr/src/RPM/BUILD/qemu-0.11.92/monitor.c: In function 'do_memory_save':/usr/src/RPM/BUILD/qemu-0.11.92/monitor.c:1318: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result...
monitor: convert do_physical_memory_save() to QError
monitor: convert do_cpu_set() to QObject, QError
monitor: Don't check for mon_get_cpu() failure
mon_get_cpu() can't return null pointer, because it passes its returnvalue to cpu_synchronize_state() first, which crashes if its argumentis null.
Remove the (pretty cheesy) handling of this non-existing error....
monitor: convert do_memory_save() to QError
QMP: Fix asynchronous events delivery
Commit f039a563f200beee80cc10fd70b21ea396979dab introducesa regression as monitor_protocol_event() will return inthe first user Monitor it finds in the QLIST_FOREACH()loop.
The right thing to do is to only delivery an asynchronous...
Clean-up a little bit the RW related bits of BDRV_O_FLAGS. BDRV_O_RDONLY gone (and so is BDRV_O_ACCESS). Default value for bdrv_flags (0/zero) is READ-ONLY. Need to explicitly request READ-WRITE.
Instead of using the field 'readonly' of the BlockDriverState struct for passing the request,...
QMP: Introduce VNC_INITIALIZED event
It's emitted when a VNC client session is activated by QEMU,client's information such as port, IP and auth ID (if thesession is authenticated) are provided.
Event example:
{ "event": "VNC_INITIALIZED", "timestamp": {"seconds": 1263475302, "microseconds": 150772},...
QMP: Emit asynchronous events on all QMP monitors
When using a control/QMP monitor in tandem with a regular monitor, asynchronousmessages can get lost depending on the order of the QEMU program arguments.QEMU events issued by monitor_protocol_event() always go to cur_mon. If the...
QMP: Introduce VNC_CONNECTED event
It's emitted when a VNC client connects to QEMU, client's informationsuch as port and IP address are provided.
Note that this event is emitted right when the connection isestablished. This means that it happens before authentication...
QMP: Introduce VNC_DISCONNECTED event
It's emitted when a VNC client disconnects from QEMU, client'sinformation such as port and IP address are provided.
{ "event": "VNC_DISCONNECTED", "timestamp": { "seconds": 1262976601, "microseconds": 975795 },...
monitor: fix dead assignment spotted by clang
Value stored to 'nb_per_line' is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
QMP: Don't free async event's 'data'
The monitor_protocol_event() function will free theevent's data, this is wrong as 'data' management is upto the caller.
QMP: Drop wrong assert()
Some commands return a QList of QDicts, which is valid,but will trig the assert().
Just drop it.
Reported-by: Nathan Baum <nathan@parenthephobia.org.uk>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Introduce 'M' argument type
This is a target long value in megabytes which should beconverted to bytes.
It will be used by handlers which accept a megabyte valuewhen in "user mode".
monitor: do_balloon(): Use 'M' argument type
This makes do_balloon() accept megabyte values from the userMonitor while accepting byte values for QMP.
QMP: Return an empty dict by default
Currently, when a regular command doesn't have any data to output,QMP will emit:
{ "return": "OK" }
Returning an empty dict is better though, because dicts can supportsome protocol changes in a compatible way.
So, with this commit we will return:...
QMP: Assure that returned data is a QDict
This is for debug purposes only.
QMP: Only handle converted commands
Looks like I dropped this check when addressing the 'query-'commands request.
QMP should only handle converted commands, obviously.
Reported-by: Markus Armbruster <armbru@redhat.com>
monitor: Accept input only byte-wise
This allows to suspend command interpretation and executionsynchronously, e.g. during migration.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Use 'device' in eject
Monitor's eject command uses 'filename' for the device nameargument, but 'device' is a better name.
monitor: do_balloon(): Check for errors
do_balloon() should check for ballooning availability asdo_info_balloon() does.
Noted by Daniel P. Berrange <berrange@redhat.com>.
monitor: Avoid readline functions in QMP
The monitor_read_command() function is readline specificand should only be used when readline is available.
monitor: Catch printing to non-existent monitor
The monitor_vprintf() function now touches the 'mon' pointerbefore calling monitor_puts(), this causes block migrationto segfault as its functions call monitor_printf() with aNULL 'mon'.
To fix the problem this commit moves the 'mon' NULL check...
monitor: Convert do_info_mice() to QObject
Each mouse is represented by a QDict, the returned QObject is a QList ofall mice.
This commit should not change user output.
migration: Convert do_info_migrate() to QObject
Return a QDict, which may contain up to more two QDicts, dependingon the type of migration we're performing.
IMPORTANT: as a QInt stores a int64_t integer, RAM values are goingto be stored as int64_t and not as uint64_t as they are today. If...
block: Convert bdrv_info() to QObject
Each block device information is stored in a QDict and thereturned QObject is a QList of all devices.
block: Convert bdrv_info_stats() to QObject
Each device statistic information is stored in a QDict andthe returned QObject is a QList of all devices.
char: Convert qemu_chr_info() to QObject
Each device is represented by a QDict. The returned QObject is a QListof all devices.
VNC: Convert do_info_vnc() to QObject
Return a QDict with server information. Connected clients are returnedas a QList of QDicts.
The new functions (vnc_qdict_remote_addr(), vnc_qdict_local_addr() andput_addr_qdict()) are used to insert 'host' and 'service' information...
monitor: Convert do_info_name() to QObject
monitor: Convert do_info_hpet() to QObject
monitor: Convert do_info_uuid() to QObject
snprintf() is used because the UUID_FMT is too complex forqobject_from_jsonf().