History | View | Annotate | Download (118.1 kB)
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
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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>
Signed-off-by: Luiz Capitulino <lcapitulino@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: do_info_version(): Use QDict
All 'info' commands should use QDict, this commit also killsmonitor_print_qobject() as do_info_version() doesn't use itanymore (and no handler will).
monitor: Convert do_info_status() to QObject
monitor: Convert do_info_kvm() to QObject
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().
monitor: Fix do_info_balloon() output
Monitor commands should always return values in bytes and infocommands should always return a QDict.
monitor: Fix do_info_commands() output
Should return a QDict and should not print the user protocol bits(eg. "c|cont").
monitor: do_info_cpus(): Use QBool
While there update the documentation as well.
Revert "monitor: Command-line flag to enable control mode"
This reverts commit adcb181afe5a951c521411c7a8e9d9b791aa6742.
Conflicts:
monitor.h
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: convert do_getfd() to QError
QMP: add human-readable description to error response
monitor: convert do_change() to QObject, QError
monitor: convert do_closefd() to QError
monitor: convert do_eject() to QError
Also affects do_change(), because the two share eject_device().
monitor: do_cont(): Don't ask for passwords
The do_cont() function will ask the user to enter a password if adevice is encrypted.
This is invalid under QMP, so we raise a QERR_DEVICE_ENCRYPTEDerror.
monitor: Fix double-prompt after "change vnc passwd BLA"
monitor: Introduce 'block_passwd' command
When using encrypted disk images, QEMU will prompt the userfor passwords when started.
This makes sense for the user protocol, but doesn't for QMP.
The solution is to have Monitor command which allows the user...
monitor: fix use of plain integer as NULL pointer, spotted by Sparse
monitor: use qemu_gettimeofday(), not gettimeofday()
Fix mingw32 build.
monitor: rename EVENT_* to QEVENT_* to avoid conflict on mingw32
Partially fixes mingw32 build.
net: move slirp code from net.c to net/slirp.c
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
QMP: Introduce basic asynchronous events
Debug, shutdown, reset, powerdown and stop are all basic events,as they are very simple they can be added in the same commit.
QMP: Disable monitor print functions
We still have handlers which will call monitor print functionsin several places. Usually to report errors.
If they do this when we are in control mode, we will be emittinggarbage to our clients.
To avoid this problem, this commit adds a way to disable those...
QMP: Output support
In the new Monitor output is always performed by only twofunctions: do_info() and monitor_call_handler().
To support QMP output, we modify those functions to check if weare in control mode. If so, we call monitor_protocol_emitter()...
QMP: do_info() checks
This commit adds specific QMP checks to do_info(), so thatit behaves as expected in QMP mode.
QMP: Input support
The JSON stream parser is used to do QMP input. When thereare enough characters to be parsed it calls Monitor'shandle_qmp_command() function to handle the input.
This function's job is to check if the input is correct andcall the appropriate handler. In other words, it does for QMP...
QMP: Allow 'query-' commands
The 'info' command makes sense for the user protocol, but for QMPit doesn't, as its return data is not well defined. That is, itcan return anything.
To fix this Avi proposes having 'query-' commands when in protocolmode. For example, 'info balloon' would become 'query-balloon'....
QMP: Asynchronous events infrastructure
Asynchronous events are generated with a call tomonitor_protocol_event().
This function builds the right data-type and emit the eventright away. The emitted data is always a JSON object and itsformat is as follows:...
monitor: Introduce monitor_find_command()
This commit moves the loop which searches for the commandentry corresponding to a command name to its own function.
It will be used by QMP code as well.
monitor: Rename monitor_handle_command()
As this series will add a new kind of Monitor command, it's betterto rename monitor_handle_command() to what it really is:handle_user_command().
This will avoid confusion.
monitor: Introduce 'info commands'
List QMP available commands. Only valid in control mode, wherehas to be used as 'query-commands.
QMP: Initial support
This commit adds initial QMP support in QEMU. It's importantto notice that most QMP code will be part of the Monitor.
Input will be read by monitor_control_read(). Currently itdoes nothing but next patches will add proper input support....
monitor: do_info_balloon(): Use QError
monitor: Introduce MONITOR_USE_CONTROL flag
This flag will be set when Monitor enters "control mode", inwhich the output will be defined by the QEMU Monitor Protocol.
This also introduces a macro to check if the flag is set.
monitor: Command-line flag to enable control mode
This commit adds a flag called 'control' to the '-monitor'command-line option. This flag enables control mode.
The syntax is:
qemu [...] -monitor control,<device>
Where <device> is a chardev (excluding 'vc', for obvious reasons)....
monitor: Introduce monitor_call_handler()
This commit moves the code which calls Monitor handlers toits own function, as it will be used by QMP code as well.
monitor: QError support
This commit adds QError support in the Monitor.
A QError member is added to the Monitor struct. This new memberstores error information and is also used to check if an errorhas occurred when the called handler returns.
Additionally, a new macro called qemu_error_new() is introduced....
Enable migration without shared storage from the monitor
This patch adds the option to activate non-shared storage migration from themonitor.The migration command is as follows:(qemu) migrate -d tcp:0:4444 # for ordinary live migration(qemu) migrate -d -b tcp:0:4444 # for live migration with complete storage copy...
Configurable block format whitelist
We have code for a quite a few block formats. While I trust that allof these formats are useful at least for some people in somecircumstances, some of them are of a kind that friends don't letfriends use in production....
monitor: Convert do_eject() to QObject
Note that errors are not being converted yet.
monitor: Convert do_getfd() to QObject
monitor: Convert do_closefd() to QObject
monitor: Convert do_memory_save() to QObject
monitor: Convert do_physical_memory_save() to QObject
char: rename CHR_EVENT_RESET to CHR_EVENT_OPENED
The char event RESET is emitted when a char device is opened.Give it a better name.
Patchworks-ID: 35287Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Convert do_quit() do QObject
Patchworks-ID: 35345Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Convert do_stop() to QObject
Patchworks-ID: 35343Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Convert do_system_reset() to QObject
Patchworks-ID: 35347Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Convert do_system_powerdown() to QObject
Patchworks-ID: 35346Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Convert do_cont() to QObject
Appropriate error handling support will be needed to haveencrypted images working under the future machine protocol,but this initial conversion will work with the currentuser protocol.
Patchworks-ID: 35348Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>...
monitor: Convert do_balloon() to QObject
It is important to note that it never fails, as big refactoringof the virtio code would be needed to get the proper error code.
Patchworks-ID: 35349Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Convert do_info_version() to QObject
The returned data is always a QString.
Also introduces monitor_print_qobject(), which can be used asa standard way to print QObjects in the user protocol format.
Patchworks-ID: 35350Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>...
monitor: Convert do_info_balloon() to QObject
On success return a QInt with the balloon's value.
This also introduces monitor_print_balloon() to print theballoon information in the user protocol.
Please, note that errors are not being converted yet.
Patchworks-ID: 35351...
monitor: Convert do_info_cpus() to QObject
Each CPU information is stored in a QDict and the returnedQObject is a QList of all CPUs.
The QDict contains the following information:
- "CPU": cpu index- "current": "yes" or "no" - "pc": current PC- "halted": "yes" or "no"...
monitor: Convert mon_cmd_t initializations to C99 style
Patchworks-ID: 35335Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: union for info handlers
This commit adds a union to mon_cmd_t for info handlers andconverts do_info() and info_cmds[] array to use it.
This improves type safety.
Next commit will convert command handlers.
Patchworks-ID: 35336Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>...
monitor: union for command handlers
This commits adds a new union member to mon_cmd_t for commandhandlers and convert monitor_handle_command() and qemu-monitor.hxto use it.
Patchworks-ID: 35337Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>...
monitor: Add user_print() to mon_cmd_t
This new struct member will store a pointer to a function thatshould be used to output data in the user protocol format.
It will also serve as a flag to say if a given handler has alreadybeen converted to the new QObject style....
monitor: Handle new and old style handlers
This commit changes monitor_handle_command() to support old styleand new style handlers.
New style handlers are protocol independent, they return theirdata to the Monitor, which in turn decides how to print them...
monitor: do_info(): handle new and old info handlers
do_info() is special, its job is to call 'info handlers'.This is similar to what monitor_handle_command() does,therefore do_info() also has to distinguish among new andold style info handlers.
This commit converts do_info() to the new QObject style and...
Reorganize option rom (+linux kernel) loading.
This patch adds infrastructure to maintain memory regions which must berestored on reset. That includes roms (vga bios and option roms on pc),but is also used when loading linux kernels directly. Features:...
Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.
The naming convention is goofy and it causes a massive merge problem. Somethinglike this must be presented on the list first so people can provide input...
Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the timebeing.
Signed-off-by: malc <av1474@comtv.ru>
Fix build with profiler enabled
Broken by 4a1418e07bdcfaa3177739e04707ecaec75d89e1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
ioports: remove unused env parameter and compile only once
The CPU state parameter is not used, remove it and adjust callers. Now wecan compile ioport.c once for all targets.
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...