summaryrefslogtreecommitdiff
path: root/qmp.c
AgeCommit message (Collapse)AuthorFilesLines
2014-05-09qmp: Don't use error_is_set() to suppress additional errorsMarkus Armbruster1-21/+11
Using error_is_set(errp) that way can sweep programming errors under the carpet when we get called incorrectly with an error set. encrypted_bdrv_it() does it, because there's no way to make bdrv_iterate() break its loop. Actually safe, because qmp_cont() clears the error before the loop. Clean it up anyway: replace bdrv_iterate() by bdrv_next(), break the loop on error. Replace both occurrences, for consistency. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-05-09qmp: Consistently name Error ** objects errp, and not errMarkus Armbruster1-8/+8
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-05-07qmp: report path ambiguity errorMichael Tokarev1-1/+5
Without this, ambiguous path is reported to the user as "not found", which is confusing at least. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-05-05machine: Remove QEMUMachine indirection from MachineClassMarcel Apfelbaum1-2/+2
No need to go through qemu_machine field. Use MachineClass fields directly. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-04-25qmp: object-add: Validate class before creating objectEduardo Habkost1-7/+14
Currently it is very easy to crash QEMU by issuing an object-add command using an abstract class or a class that doesn't support TYPE_USER_CREATABLE as parameter. Example: with the following QMP command: (QEMU) object-add qom-type=cpu id=foo QEMU aborts at: ERROR:qom/object.c:335:object_initialize_with_type: assertion failed: (type->abstract == false) This patch moves the check for TYPE_USER_CREATABLE before object_new(), and adds a check to prevent the code from trying to instantiate abstract classes. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com> Tested-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-04-25qerror.h: Remove QERR defines that are only used onceCole Robinson1-1/+1
Just hardcode them in the callers Cc: Luiz Capitulino <lcapitulino@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-03-12hw/boards: Convert current_machine to MachineStateMarcel Apfelbaum1-2/+5
In order to allow attaching machine options to a machine instance, current_machine is converted into MachineState. As a first step of deprecating QEMUMachine, some of the functions were modified to return MachineClass. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-02object: Report type in error when not user creatable.Hani Benhabiles1-2/+2
Signed-off-by: Hani Benhabiles <hani@linux.com> Reviewed-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-01-28add optional 2nd stage initialization to -object/object-add commandsIgor Mammedov1-0/+12
Introduces USER_CREATABLE interface that must be implemented by objects which are designed to created with -object CLI option or object-add QMP command. Interface provides an ability to do an optional second stage initialization of the object created with -object/object-add commands. By providing complete() callback, which is called after the object properties were set. It allows to: * prevents misusing of -object/object-add by filtering out objects that are not designed for it. * generalize second stage backend initialization instead of adding custom APIs to perform it * early error detection of backend initialization at -object/ object-add time rather than through a proxy DEVICE object that tries to use backend. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-01-28object_add: consolidate error handlingIgor Mammedov1-4/+6
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-01-06monitor: add object-add (QMP) and object_add (HMP) commandPaolo Bonzini1-0/+62
Add two commands that are the monitor counterparts of -object. The commands have the same Visitor-based implementation, but use different kinds of visitors so that the HMP command has a DWIM string-based syntax, while the QMP variant accepts a stricter JSON-based properties dictionary. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-01-06monitor: add object-del (QMP) and object_del (HMP) commandPaolo Bonzini1-0/+14
These two commands invoke the "unparent" method of Object. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-12-16qmp_change_blockdev() remove unused has_formatMarc-André Lureau1-1/+1
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-05-01QMP: Add cpu-add commandIgor Mammedov1-0/+10
Adds "cpu-add id=xxx" QMP command. cpu-add's "id" argument is a CPU number in a range [0..max-cpus) Example QMP command: -> { "execute": "cpu-add", "arguments": { "id": 2 } } <- { "return": {} } Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-04-30add a new runstate: RUN_STATE_GUEST_PANICKEDHu Tao1-2/+1
The guest will be in this state when it is panicked. Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-id: 0255f263ffdc2a3716f73e89098b96fd79a235b3.1366945969.git.hutao@cn.fujitsu.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-15sysemu: avoid proliferation of include/ subdirectoriesPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@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-19softmmu: move include files to include/sysemu/Paolo Bonzini1-4/+4
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qom: move include files to include/qom/Paolo Bonzini1-1/+1
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-18build: replace weak symbols with a static libraryPaolo Bonzini1-9/+0
Weak symbols were a nice idea, but they turned out not to be a good one. Toolchain support is just too sparse, in particular llvm-gcc is totally broken. This patch uses a surprisingly low-tech approach: a static library. Symbols in a static library are always overridden by symbols in an object file. Furthermore, if you place each function in a separate source file, object files for unused functions will not be taken in. This means that each function can use all the dependencies that it needs (especially QAPI stuff such as error_setg). Thus, all stubs are placed in separate object files and put together in a static library. The library then is linked to all programs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-02compiler: support Darwin weak referencesPaolo Bonzini1-0/+2
Weakrefs only tell you if the symbol was defined elsewhere, so you need a further check at runtime to pick the default definition when needed. This could be automated by the compiler, but it does not do it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-10-31Merge remote-tracking branch 'origin/master' into threadpoolPaolo Bonzini1-6/+11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30compiler: use weak aliases to provide default definitionsPaolo Bonzini1-1/+2
This is simpler and more portable. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-29Merge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstableAurelien Jarno1-6/+11
* 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable: migration: go to paused state after finishing incoming migration with -S qmp: handle stop/cont in INMIGRATE state hmp: fix info cpus for sparc targets
2012-10-24qmp: handle stop/cont in INMIGRATE statePaolo Bonzini1-6/+11
Right now, stop followed by an incoming migration will let the virtual machine start. cont before an incoming migration instead will fail. This is bad because the actual behavior is not predictable; it is racy with respect to the start of the incoming migration. That's because incoming migration is blocking, and thus will delay the processing of stop/cont until the end of the migration. In addition, there's nothing that really prevents the user from typing the block device's passwords before incoming migration is done, so returning the DeviceEncrypted error is also helpful in the QMP case. Both things can be fixed by just toggling the autostart variable when stop/cont are called in INMIGRATE state. Note that libvirt is currently working around the race by looping if the MigrationExpected answer is returned. After this patch, the command will return right away without ever raising an error. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-10-23vnc: reorganize code for reverse modePaolo Bonzini1-4/+2
Avoid the dance between csock and vs->lsock. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-09-26qapi: convert add_clientLuiz Capitulino1-0/+43
Also fixes a few issues while there: 1. The fd returned by monitor_get_fd() leaks in most error conditions 2. monitor_get_fd() return value is not checked. Best case we get an error that is not correctly reported, worse case one of the functions using the fd (with value of -1) will explode 3. A few error conditions aren't reported 4. We now "use up" @fdname always. Before, it was left alone for invalid @protocol Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2012-08-15win32: provide separate macros for weak decls and definitionsAnthony Liguori1-1/+7
mingw32 seems to want the declaration to also carry the weak attribute. Strangely, gcc on Linux absolutely does not want the declaration to be marked as weak. This may not be the right fix, but it seems to do the trick. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-08-13qapi: add query-cpu-definitions command (v2)Anthony Liguori1-0/+6
This command attempts to map to the behavior of -cpu ?. Unfortunately, the output of this command differs wildly across targets. To accommodate this, we use a weak symbol to implement a default version of the command that fails with a QERR_NOT_SUPPORTED error code. Targets can then override and implement this command if it makes sense for them. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-08-13qmp: introduce device-list-properties commandAnthony Liguori1-0/+50
This can be used in conjunction with qom-list-types to determine the supported set of devices and their parameters. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-05-08runstate: introduce suspended stateLuiz Capitulino1-0/+2
QEMU enters in this state when the guest suspends to ram (S3). This is important so that HMP users and QMP clients can know that the guest is suspended. QMP also has an event for this, but events are not reliable and are limited (ie. a client can connect to QEMU after the event has been emitted). Having a different state for S3 brings a new issue, though. Every device that doesn't run when the VM is stopped but wants to run when the VM is suspended has to check for RUN_STATE_SUSPENDED explicitly. This is the case for the keyboard and mouse devices, for example. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-24suspend: add system_wakeup monitor commandGerd Hoffmann1-0/+5
This patch adds the system_wakeup monitor command which will simply wake up suspended guests. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-07qom: add QObject-based property get/set wrappersPaolo Bonzini1-15/+3
Move the creation of QmpInputVisitor and QmpOutputVisitor from qmp.c to qom/object.c, since it's the only practical way to access object properties. Keep this isolated such that it's easy to remove. At some point, we need to remove all usage of QObject in the tree and replace it with GVariant. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-03qom: move properties from qdev to objectAnthony Liguori1-17/+17
This is mostly code movement although not entirely. This makes properties part of the Object base class which means that we can now start using Object in a meaningful way outside of qdev. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-03qom: add new command to search for typesAnthony Liguori1-0/+27
This adds a command that allows searching for types that implement a property. This allows you to do things like search for all available PCIDevices. In the future, we'll also have a standard interface for things with a BlockDriverState property that a PCIDevice could implement. This will enable search queries like, "any type that implements the BlockDevice interface" which would allow management tools to present available block devices without having to hard code device names. Since an object can implement multiple interfaces, one device could act both as a BlockDevice and a NetworkDevice. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-18qapi: Convert changeLuiz Capitulino1-0/+44
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-01-18qerror: Extend QERR_DEVICE_ENCRYPTEDLuiz Capitulino1-1/+2
Include the name of the encrypted file. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-01-18qapi: Introduce change-vnc-passwordLuiz Capitulino1-0/+7
New QMP command to change the VNC password. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-01-18qapi: Convert expire_passwordLuiz Capitulino1-0/+40
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-01-18qapi: Convert set_passwordLuiz Capitulino1-0/+54
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-01-13prepare for future GPLv2+ relicensingPaolo Bonzini1-0/+2
All files under GPLv2 will get GPLv2+ changes starting tomorrow. event_notifier.c and exec-obsolete.h were only ever touched by Red Hat employees and can be relicensed now. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15qom: qom_{get, set} monitor commands (v2)Anthony Liguori1-0/+65
This allows clients to read and write device model properties through QMP. QAPI doesn't support Visitor types yet and these commands are special in that they don't work with fixed types. I've added a documentation stub to qapi-schema.json so we can keep consistency there. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15qmp: add qom-list commandAnthony Liguori1-0/+28
This can be used to list properties in the device model. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-06qapi: Convert contLuiz Capitulino1-0/+37
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-27qapi: Convert query-spiceLuiz Capitulino1-0/+12
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-27qapi: Convert query-vncLuiz Capitulino1-0/+10
There are three important remarks in relation to the non-qapi command: 1. This commit also fixes the behavior of the 'query-vnc' and 'info vnc' commands to return an error when qemu is built without VNC support (ie. --disable-vnc). The non-qapi command would return the OK response in QMP and no response in HMP 2. The qapi version explicitly marks the fields 'host', 'family', 'service' and 'auth' as optional. Their are not documented as optional in the non-qapi command doc, but they would not be returned if vnc support is disabled. The qapi version maintains the same semantics, but documents those fields correctly 3. The 'clients' field, which is a list, is marked as optional but is always returned. If there are no clients connected an empty list is returned. This is not the Right Way to this in the qapi but it's how the non-qapi command used to work Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-27qapi: Convert the cpu commandLuiz Capitulino1-0/+5
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-04qapi: Convert system_powerdownLuiz Capitulino1-0/+5
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-04qapi: Convert system_resetLuiz Capitulino1-0/+4
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>