summaryrefslogtreecommitdiff
path: root/hmp.c
AgeCommit message (Collapse)AuthorFilesLines
2013-02-11error: Strip trailing '\n' from error string arguments (again)Markus Armbruster1-1/+1
Commit 6daf194d and be62a2eb got rid of a bunch, but they keep coming back. Tracked down with this Coccinelle semantic patch: @r@ expression err, eno, cls, fmt; position p; @@ ( error_report(fmt, ...)@p | error_set(err, cls, fmt, ...)@p | error_set_errno(err, eno, cls, fmt, ...)@p | error_setg(err, fmt, ...)@p | error_setg_errno(err, eno, fmt, ...)@p ) @script:python@ fmt << r.fmt; p << r.p; @@ if "\\n" in str(fmt): print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt) Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1360354939-10994-4-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-06hmp: make memchar-read escape ASCII control chars except \n and \tMarkus Armbruster1-1/+14
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-06qemu-char: Saner naming of memchar stuff & doc fixesMarkus Armbruster1-4/+4
New device, has never been released, so we can still improve things without worrying about compatibility. Naming is a mess. The code calls the device driver CirMemCharDriver, the public API calls it "memory", "memchardev", or "memchar", and the special commands are named like "memchar-FOO". "memory" is a particularly unfortunate choice, because there's another character device driver called MemoryDriver. Moreover, the device's distinctive property is that it's a ring buffer, not that's in memory. Therefore: * Rename CirMemCharDriver to RingBufCharDriver, and call the thing a "ringbuf" in the API. * Rename QMP and HMP commands from memchar-FOO to ringbuf-FOO. * Rename device parameter from maxcapacity to size (simple words are good for you). * Clearly mark the parameter as optional in documentation. * Fix error reporting so that chardev-add reports to current monitor, not stderr. * Replace cirmem in C identifiers by ringbuf. * Rework documentation. Document the impact of our crappy UTF-8 handling on reading. * QMP examples that even work. I could split this up into multiple commits, but they'd change the same documentation lines multiple times. Not worth it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-06qmp: Clean up design of memchar-readMarkus Armbruster1-7/+4
The data returned has a well-defined size, which makes the size returned along with it redundant at best. Drop it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-06qmp: Fix design bug and read beyond buffer in memchar-writeMarkus Armbruster1-3/+1
Command memchar-write takes data and size parameter. Begs the question what happens when data doesn't match size. With format base64, qmp_memchar_write() copies the full data argument, regardless of size argument. With format utf8, qmp_memchar_write() copies size bytes from data, happily reading beyond data. Copies crap from the heap or even crashes. Drop the size parameter, and always copy the full data argument. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-01Fix error message in migrate_set_capability HMP commandOrit Wasserman1-1/+1
Signed-off-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2013-01-28Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori1-1/+1
# By Paolo Bonzini (14) and others # Via Kevin Wolf * kwolf/for-anthony: (24 commits) ide: Add fall through annotations block: Create proper size file for disk mirror ahci: Add migration support ahci: Change data types in preparation for migration ahci: Remove unused AHCIDevice fields hbitmap: add assertion on hbitmap_iter_init mirror: do nothing on zero-sized disk block/vdi: Check for bad signature block/vdi: Improved return values from vdi_open block/vdi: Improve debug output for signature block: Use error code EMEDIUMTYPE for wrong format in some block drivers block: Add special error code for wrong format mirror: support arbitrarily-sized iterations mirror: support more than one in-flight AIO operation mirror: add buf-size argument to drive-mirror mirror: switch mirror_iteration to AIO mirror: allow customizing the granularity block: allow customizing the granularity of the dirty bitmap block: return count of dirty sectors, not chunks mirror: perform COW if the cluster size is bigger than the granularity ...
2013-01-25mirror: add buf-size argument to drive-mirrorPaolo Bonzini1-1/+1
This makes sense when the next commit starts using the extra buffer space to perform many I/O operations asynchronously. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-01-25mirror: allow customizing the granularityPaolo Bonzini1-1/+1
The desired granularity may be very different depending on the kind of operation (e.g. continuous replication vs. collapse-to-raw) and whether the VM is expected to perform lots of I/O while mirroring is in progress. Allow the user to customize it, while providing a sane default so that in general there will be no extra allocated space in the target compared to the source. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-01-25QAPI: Introduce memchar-read QMP commandLei Li1-0/+21
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-01-25QAPI: Introduce memchar-write QMP commandLei Li1-0/+13
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-01-25balloon: drop old stats code & APILuiz Capitulino1-23/+1
Next commit will re-enable balloon stats with a different interface, but this old code conflicts with it. Let's drop it. It's important to note that the QMP and HMP interfaces are also dropped by this commit. That shouldn't be a problem though, because: 1. All QMP fields are optional 2. This feature has always been disabled Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-01-17HMP: add QDict to info callback handlerWenchao Xia1-18/+18
This patch change all info call back function to take additional QDict * parameter, which allow those command take parameter. Now it is set to NULL at default case. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-01-16chardev: add hmp hotplug commandsGerd Hoffmann1-0/+23
Add chardev-add and chardev-remove commands to the human monitor. chardev-add accepts the same syntax as -chardev, chardev-remove expects a chardev id. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-12-19softmmu: move remaining include files to include/ subdirectoriesPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-3/+3
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19monitor: move include files to include/monitor/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19ui: move files to ui/ and include/ui/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19net: reorganize headersPaolo Bonzini1-1/+1
Move public headers to include/net, and leave private headers in net/. Put the virtio headers in include/net/tap.h, removing the multiple copies that existed. Leave include/net/tap.h as the interface for NICs, and net/tap_int.h as the interface for OS-specific parts of the tap backend. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19janitor: do not include qemu-char everywherePaolo Bonzini1-0/+1
Touching char/char.h basically causes the whole of QEMU to be rebuilt. Avoid this, it is usually unnecessary. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12hmp: add NBD server commandsPaolo Bonzini1-0/+76
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-29Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori1-0/+39
* kwolf/for-anthony: (32 commits) osdep: Less restrictive F_SEFL in qemu_dup_flags() qemu-iotests: add testcases for mirroring on-source-error/on-target-error qmp: add pull_event function mirror: add support for on-source-error/on-target-error iostatus: forward block_job_iostatus_reset to block job qemu-iotests: add mirroring test case mirror: implement completion qmp: add drive-mirror command mirror: introduce mirror job block: introduce BLOCK_JOB_READY event block: add block-job-complete block: rename block_job_complete to block_job_completed block: export dirty bitmap information in query-block block: introduce new dirty bitmap functionality block: add bdrv_open_backing_file block: add bdrv_query_stats block: add bdrv_query_info qemu-config: Add new -add-fd command line option monitor: Prevent removing fd from set during init monitor: Enable adding an inherited fd to an fd set ... Conflicts: vl.c Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-10-24hmp: fix info cpus for sparc targetsAurelien Jarno1-6/+5
On sparc targets, info cpus returns this kind of output: | info cpus | * CPU #0: pc=0x0000000000424d18pc=0x0000000000424d18npc=0x0000000000424d1c thread_id=19460 pc is printed twice, there is no space between pc, pc and npc. With this patch, pc is not printed anymore when has_npc is set. In addition the space is printed before pc/nip/npc/PC instead of after the colon so that multiple prints are possible. This result on the following kind of input on sparc targets: | info cpus | * CPU #0: pc=0x0000000000424d18 npc=0x0000000000424d1c thread_id=19460 Cc: Luiz Capitulino <lcapitulino@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-10-24mirror: add support for on-source-error/on-target-errorPaolo Bonzini1-1/+2
Error management is important for mirroring; otherwise, an error on the target (even something as "innocent" as ENOSPC) requires to start again with a full copy. Similar to on_read_error/on_write_error, two separate knobs are provided for on_source_error (reads) and on_target_error (writes). The default is 'report' for both. The 'ignore' policy will leave the sector dirty, so that it will be retried later. Thus, it will not cause corruption. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-10-24qmp: add drive-mirror commandPaolo Bonzini1-0/+28
This adds the monitor commands that start the mirroring job. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-10-24block: add block-job-completePaolo Bonzini1-0/+10
While streaming can be dropped as soon as it progressed through the whole image, mirroring needs to be completed manually for two reasons: 1) so that management knows exactly when the VM switches to the target; 2) because for other use cases such as replication, we may leave the operation running for the whole life of the virtual machine. Add a new block job command that manually completes background operations. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-10-17migration: Add dirty_pages_rate to query migrate outputJuan Quintela1-0/+4
It indicates how many pages were dirtied during the last second. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-10-17migration: print expected downtime in info migrateJuan Quintela1-0/+4
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-10-17migration: print total downtime for final phase of migrationJuan Quintela1-0/+4
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-10-04Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori1-2/+24
* kwolf/for-anthony: (30 commits) qemu-iotests: add tests for streaming error handling qemu-iotests: map underscore to dash in QMP argument names blkdebug: process all set_state rules in the old state stream: add on-error argument block: introduce block job error iostatus: reorganize io error code iostatus: change is_read to a bool iostatus: move BlockdevOnError declaration to QAPI iostatus: rename BlockErrorAction, BlockQMPEventAction qemu-iotests: add test for pausing a streaming operation qmp: add block-job-pause and block-job-resume block: add support for job pause/resume qmp: add 'busy' member to BlockJobInfo block: add block_job_query block: move job APIs to separate files block: fix documentation of block_job_cancel_sync qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE qemu-iotests: add initial tests for live block commit QAPI: add command for live block commit, 'block-commit' block: helper function, to find the base image of a chain ...
2012-09-28stream: add on-error argumentPaolo Bonzini1-1/+2
This patch adds support for error management to streaming. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-09-28qmp: add block-job-pause and block-job-resumePaolo Bonzini1-1/+22
Add QMP commands matching the functionality. Paused jobs cannot be canceled without first resuming them. This ensures that I/O errors are never missed by management. However, an optional force argument can be specified to allow that. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-09-27qmp: qmp_send_key(): accept key codes in hexLuiz Capitulino1-14/+29
Before the qapi conversion, the sendkey command could be used to send key codes in hex directly to the guest. In HMP, this would be like: (qemu) sendkey 0xdc However, the qapi conversion broke this, as it only supports sending QKeyCode values to the guest. That's a regression. This commit fixes the problem by adding hex value support down the QMP interface, qmp_send_key(). In more detail, this commit: 1. Adds the KeyValue union. This can represent an hex value or a QKeyCode value 2. *Changes* the QMP send-key command to take an KeyValue argument instead of a QKeyCode one 3. Adapt hmp_send_key() to the QMP interface changes Item 2 is an incompatible change, but as we're in development phase (and this command has been merged a few weeks ago) this shouldn't be a problem. Finally, it's not possible to split this commit without breaking the build. Reported-by: Avi Kivity <avi@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2012-09-27hmp: dump-guest-memory: hardcode protocol argument to "file:"Luiz Capitulino1-2/+6
Today, it's necessary to specify the protocol you want to use when dumping the guest memory, for example: (qemu) dump-guest-memory file:/tmp/guest-memory This has a few issues: 1. It's cumbersome to type 2. We loose file path autocompletion 3. Being able to specify fd:X in HMP makes little sense for humans Because of these reasons, hardcode the 'protocol' argument to 'file:' in HMP. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2012-09-10Merge branch 'spice.v59' of git://anongit.freedesktop.org/spice/qemuAurelien Jarno1-0/+2
* 'spice.v59' of git://anongit.freedesktop.org/spice/qemu: Remove #ifdef QXL_COMMAND_FLAG_COMPAT_16BPP qxl: Add set_client_capabilities() interface to QXLInterface spice: make number of surfaces runtime-configurable. configure: print spice-protocol and spice-server versions qxl: add QXL_IO_MONITORS_CONFIG_ASYNC qxl: disallow unknown revisions qxl/update_area_io: guest_bug on invalid parameters spice: increase the verbosity of spice section in "qemu --help" spice: adding seamless-migration option to the command line spice: add 'migrated' flag to spice info spice migration: add QEVENT_SPICE_MIGRATE_COMPLETED spice: notify on vm state change only via spice_server_vm_start/stop spice: notify spice server on vm start/stop spice: abort on invalid streaming cmdline params
2012-09-05qapi: convert screendumpLuiz Capitulino1-0/+9
Next commits will update devices to propagate errors. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-09-05qapi: convert sendkeyAmos Kong1-0/+55
Convert 'sendkey' to use QAPI. QAPI passes key's index of mapping table to qmp_send_key(), not keycode. So we use help functions to convert key/code to index of key_defs, and 'index' will be converted to 'keycode' inside qmp_send_key(). For qmp, QAPI would check invalid key and raise error. For hmp, invalid key is checked in hmp_send_key(). 'send-key' of QMP doesn't support key in hexadecimal format. Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-09-05spice: add 'migrated' flag to spice infoYonit Halperin1-0/+2
The flag is 'true' when spice migration has completed on the src side. It is needed for a case where libvirt dies before migration completes and it misses the event QEVENT_SPICE_MIGRATE_COMPLETED. When libvirt is restored and queries the migration status, it also needs to query spice and check if its migration has completed. Signed-off-by: Yonit Halperin <yhalperi@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-08-21migration: move total_time from ram stats to migration infoJuan Quintela1-2/+2
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-08-13Merge remote-tracking branch 'qmp/queue/qmp' into stagingAnthony Liguori1-46/+23
* qmp/queue/qmp: (48 commits) target-ppc: add implementation of query-cpu-definitions (v2) target-i386: add implementation of query-cpu-definitions (v2) qapi: add query-cpu-definitions command (v2) compiler: add macro for GCC weak symbols qapi: add query-machines command qapi: mark QOM commands stable qmp: introduce device-list-properties command qmp: add SUSPEND_DISK event qmp: qmp-events.txt: add missing doc for the SUSPEND event qmp: qmp-events.txt: put events in alphabetical order qmp: emit the WAKEUP event when the guest is put to run qmp: don't emit the RESET event on wakeup from S3 scripts: qapi-commands.py: qmp-commands.h: include qdict.h docs: writing-qmp-commands.txt: update error section error, qerror: drop QDict member qerror: drop qerror_table and qerror_format() error, qerror: pass desc string to error calls error: drop error_get_qobject()/error_set_qobject() qemu-ga: switch to the new error format on the wire qmp: switch to the new error format on the wire ...
2012-08-13hmp: hmp_change(): use error_get_class()Luiz Capitulino1-1/+2
The error_is_type() function is going to be dropped. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2012-08-13hmp_change(): don't access DeviceEncrypted's dataLuiz Capitulino1-27/+2
It's not needed. As the device name is already known, we can replace the duplicated password prompting code by monitor_read_block_device_key(). This overly simplifies hmp_change(). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2012-08-13hmp: hmp_cont(): don't rely on QERR_DEVICE_ENCRYPTEDLuiz Capitulino1-18/+19
This commit changes hmp_cont() to loop through all block devices and proactively set an encryption key for any encrypted device missing a key. This change is needed because QERR_DEVICE_ENCRYPTED is going to be dropped by a future commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2012-08-08Add XBZRLE statisticsOrit Wasserman1-0/+13
Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add migration accounting for normal and duplicate pagesOrit Wasserman1-0/+6
Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add migrate_set_cache_size commandOrit Wasserman1-0/+19
Change XBZRLE cache size in bytes (the size should be a power of 2, it will be rounded down to the nearest power of 2). If XBZRLE cache size is too small there will be many cache miss. New query-migrate-cache-size QMP command and 'info migrate_cache_size' HMP command to query cache value. Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add migrate-set-capabilitiesOrit Wasserman1-0/+32
The management can enable/disable a capability for the next migration by using migrate-set-capabilities QMP command. The user can use migrate_set_capability HMP command. Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08Add migration capabilitiesOrit Wasserman1-0/+33
The management can query the current migration capabilities using query-migrate-capabilities QMP command. The user can use 'info migrate_capabilities' HMP command. Currently only XBZRLE capability is available. Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-03hmp: show the backing file depthBenoƮt Canet1-0/+2
Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-07-13qapi: Convert getfd and closefdCorey Bryant1-0/+18
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>