Age | Commit message (Collapse) | Author |
|
Commit f039a563f200beee80cc10fd70b21ea396979dab introduces
a regression as monitor_protocol_event() will return in
the first user Monitor it finds in the QLIST_FOREACH()
loop.
The right thing to do is to only delivery an asynchronous
event if the 'mon' is a QMP Monitor.
The aforementioned commit was an early version, if it was
applied to stable (it should) this one has to be applied
there too.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 23fabed13645fdf66473e458f318baa63be56b22)
|
|
When using a control/QMP monitor in tandem with a regular monitor, asynchronous
messages 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
user monitor was specified on the command line first (or it has ,default), the
message will be directed to the user monitor (not the QMP monitor).
Additionally, only one QMP session is currently able to receive async messages.
To avoid this confusion, scan through the list of monitors and emit the message
on each QMP monitor.
Signed-off-by: Adam Litke <agl@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit f039a563f200beee80cc10fd70b21ea396979dab)
|
|
The monitor_protocol_event() function will free the
event's data, this is wrong as 'data' management is up
to the caller.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 3d72f9a2be640f368229d579e80ce4ef2a823e49)
|
|
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>
(cherry picked from commit 810f49b56a5d0cd6848856af51d3093ae9adc7b1)
|
|
This makes do_balloon() accept megabyte values from the user
Monitor while accepting byte values for QMP.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 056001ab30b1e596b992e70f9cb2adacef9c0ad0)
|
|
This is a target long value in megabytes which should be
converted to bytes.
It will be used by handlers which accept a megabyte value
when in "user mode".
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 7cfe34fe4e3b518485c15aa9a78b4cf9cbd11a4d)
|
|
This is for debug purposes only.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 19863875a2e18fc868a7b830f16fa76d32518bd1)
|
|
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 support
some protocol changes in a compatible way.
So, with this commit we will return:
{ "return": {} }
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit e38fb11b5099db8de8d60d536d4a01610ee4c08b)
|
|
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 89f5461fc9a3c437e632f6895dc605e8f03b925e)
|
|
This allows to suspend command interpretation and execution
synchronously, e.g. during migration.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit c62313bbdc48f72e93fa8196f2fff96ba35e4e9d)
|
|
The monitor_vprintf() function now touches the 'mon' pointer
before calling monitor_puts(), this causes block migration
to segfault as its functions call monitor_printf() with a
NULL 'mon'.
To fix the problem this commit moves the 'mon' NULL check
from monitor_puts() to monitor_vprintf().
This can potentially hide bugs, but for some reason this has
been the behavior for a long time.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2daa11912699d9412fb4404d646031a74b166aa5)
|
|
The monitor_read_command() function is readline specific
and should only be used when readline is available.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 183e6e525764d5c4978e37b42dc2cde0b0ffcfec)
|
|
do_balloon() should check for ballooning availability as
do_info_balloon() does.
Noted by Daniel P. Berrange <berrange@redhat.com>.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit cfdf2c40577ed99bb19cdc05d0537e2808d77a78)
|
|
Monitor's eject command uses 'filename' for the device name
argument, but 'device' is a better name.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 78d714e08f15171adf48e32ba86709f9c64f37cf)
|
|
Return a QDict with server information. Connected clients are returned
as a QList of QDicts.
The new functions (vnc_qdict_remote_addr(), vnc_qdict_local_addr() and
put_addr_qdict()) are used to insert 'host' and 'service' information
in the returned QDict.
This patch is big, but I don't see how to split it.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit d96fd29cca420d1ff3d34cde233cf41a3818c550)
|
|
Each device is represented by a QDict. The returned QObject is a QList
of all devices.
This commit should not change user output.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 588b38320134edee4a569f60ed88c9848961d6ee)
|
|
Each device statistic information is stored in a QDict and
the returned QObject is a QList of all devices.
This commit should not change user output.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 218a536a7a7c6d3679d5eca0103f32fd11fbfaf0)
|
|
Each block device information is stored in a QDict and the
returned QObject is a QList of all devices.
This commit should not change user output.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit d15e546567d75fca36d852c39e30adaab02121a7)
|
|
Return a QDict, which may contain up to more two QDicts, depending
on the type of migration we're performing.
IMPORTANT: as a QInt stores a int64_t integer, RAM values are going
to be stored as int64_t and not as uint64_t as they are today. If
this is a problem QInt will have to be changed.
This commit should not change user output.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit c86a668390d16d6b3249acd50bfa61ad825c7a80)
|
|
Each mouse is represented by a QDict, the returned QObject is a QList of
all mice.
This commit should not change user output.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit e78c48ec4e192ef1b1a210bdf5a8d253d7826c25)
|
|
snprintf() is used because the UUID_FMT is too complex for
qobject_from_jsonf().
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 9603ceba2edd1dc7e3823da76d84706d3d1c3d78)
|
|
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 14f0720df929181eed5424b3f436d84ce05541c3)
|
|
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit e05486cba662ccceef6be4b3ce38961876aa8f6e)
|
|
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2af5ba712b3e03cf644320f7386bf1dfd2c2b6a8)
|
|
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit c0e8520ed5efef2891e2e930a1bb21c1b040410f)
|
|
All 'info' commands should use QDict, this commit also kills
monitor_print_qobject() as do_info_version() doesn't use it
anymore (and no handler will).
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 45e914cfe03f9fcf946bdc124f752d8f288eff05)
|
|
While there update the documentation as well.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 55483ad657dcb62cde09bce3b38a5fc28d08f999)
|
|
Should return a QDict and should not print the user protocol bits
(eg. "c|cont").
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 1a728677d4e2f0434caf352c0e88100652fd6711)
|
|
Monitor commands should always return values in bytes and info
commands should always return a QDict.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 7f1796713ed2f338bd9abc094aacf10f67aed1e5)
|
|
This reverts commit adcb181afe5a951c521411c7a8e9d9b791aa6742.
Conflicts:
monitor.h
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 4e307fc883b39c89ffc093c79eb9c9735724d227)
|
|
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 77e595e7c613c495714d04ce63fb9bce263c29ae)
|
|
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 7cdfcfe18f0a9e8603e4a14770a84eb5649521c5)
|
|
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 063c1a0918d5a08f7ba89300d022b3421174fbf7)
|
|
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit ec3b82afaa0c4c06689d6a6381d351eefc4ee171)
|
|
Also affects do_change(), because the two share eject_device().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2c2a6bb860c09a80f519cd6297f1c0585a1436ec)
|
|
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2895e075c6dba0e66c72af781b1eed2bff0c3777)
|
|
The do_cont() function will ask the user to enter a password if a
device is encrypted.
This is invalid under QMP, so we raise a QERR_DEVICE_ENCRYPTED
error.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 94171e119cb6f7bab2578896643b0daff1d9b184)
|
|
When using encrypted disk images, QEMU will prompt the user
for 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
or a Client to set passwords in advance, so that we avoid
the prompt completely.
This is what block_passwd does, for example:
(QEMU) block_passwd ide0-hd0 foobar
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit a3a55a2edb7c0fd72bc62a8a4c719a1e1983e6ac)
|
|
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
|
|
Fix mingw32 build.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
|
|
Partially fixes mingw32 build.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
|
|
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
We still have handlers which will call monitor print functions
in several places. Usually to report errors.
If they do this when we are in control mode, we will be emitting
garbage to our clients.
To avoid this problem, this commit adds a way to disable those
functions. If any of them is called when in control mode, we will
emit a generic error.
Although this is far from the perfect solution, it guarantees
that only JSON is sent to Clients.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
Debug, shutdown, reset, powerdown and stop are all basic events,
as they are very simple they can be added in the same commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
Asynchronous events are generated with a call to
monitor_protocol_event().
This function builds the right data-type and emit the event
right away. The emitted data is always a JSON object and its
format is as follows:
{ "event": json-string,
"timestamp": { "seconds": json-number, "microseconds": json-number },
"data": json-value }
This design is based on ideas by Amit Shah <amit.shah@redhat.com>.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
The 'info' command makes sense for the user protocol, but for QMP
it doesn't, as its return data is not well defined. That is, it
can return anything.
To fix this Avi proposes having 'query-' commands when in protocol
mode. For example, 'info balloon' would become 'query-balloon'.
The right way of supporting this would probably be to move all
info handlers to qemu-monitor.hx, add a flags field to mon_cmd_t
to identify them and then modify do_info() to do its search based
on that flag.
Unfortunately, this would require a big change in the Monitor.
To make things simpler for now, this commit takes a different
approach: a check for commands starting with "query-" is added to
toplevel QMP code, if it's true we setup things so that do_info()
is called with the appropriate arguments.
This is a hack, but is a temporary one and guarantees that query-
commands will work from the first day.
Also note that 'info' is not allowed in protocol mode.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
The JSON stream parser is used to do QMP input. When there
are enough characters to be parsed it calls Monitor's
handle_qmp_command() function to handle the input.
This function's job is to check if the input is correct and
call the appropriate handler. In other words, it does for QMP
what handle_user_command() does for the user protocol.
This means that handle_qmp_command() also has to parse the
(ugly) "args_type" format to able to get the arguments names
and types expected by the handler.
The format to input commands in QMP is as follows:
{ "execute": json-string,
"id": json-value, "arguments": json-object }
Please, note that this commit also adds "id" support.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
This commit adds specific QMP checks to do_info(), so that
it behaves as expected in QMP mode.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
In the new Monitor output is always performed by only two
functions: do_info() and monitor_call_handler().
To support QMP output, we modify those functions to check if we
are in control mode. If so, we call monitor_protocol_emitter()
to emit QMP output, otherwise we do regular output.
QMP has two types of responses to issued commands: success and
error. The outputed data is always a JSON object.
Success responses have the following format:
{ "return": json-value, "id": json-value }
Error responses have the following format:
{ "error": { "class": json-string,
"desc": json-string,
"data": json-value } "id": json-value }
Please, note that the "id" key is part of the input code, and
thus is not added in this commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
This commit adds initial QMP support in QEMU. It's important
to notice that most QMP code will be part of the Monitor.
Input will be read by monitor_control_read(). Currently it
does nothing but next patches will add proper input support.
The function monitor_json_emitter(), as its name implies, is
used by the Monitor to emit JSON output. In this commit it's
used by monitor_control_event() to print our greeting message.
Finally, control mode support is also added to monitor_init(),
allowing QMP to be really enabled.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|