summaryrefslogtreecommitdiffstats
path: root/qga/commands.c
Commit message (Collapse)AuthorAgeFilesLines
* qga: guest-exec simple stdin/stdout/stderr redirectionYuri Pudgorodskiy2015-10-191-8/+181
| | | | | | | | | | | | | | | | | | | | | | | Implemented with base64-encoded strings in qga json protocol. Glib portable GIOChannel is used for data I/O. Optinal stdin parameter of guest-exec command is now used as stdin content for spawned subprocess. If capture-output bool flag is specified, guest-exec redirects out/err file descriptiors internally to pipes and collects subprocess output. Guest-exe-status is modified to return this collected data to requestor in base64 encoding. Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> * switch from 'struct GuestIOExecData' to 'GuestIOExecData' * s/TRUE/true/g, s/FALSE/false/g for gboolean return values * s/inp_data/input_data/ Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: handle possible SIGPIPE in guest-file-writeDenis V. Lunev2015-10-191-1/+17
| | | | | | | | | | | | | qemu-ga should not exit on guest-file-write to pipe without read end but proper error code should be returned. The behavior of the spawned process should be default thus SIGPIPE processing should be reset to default after fork() but before exec(). Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: guest exec functionalityYuri Pudgorodskiy2015-10-191-0/+199
| | | | | | | | | | | | | | | | | | | | | Guest-exec rewritten in platform-independent style with glib spawn. Child process is spawn asynchronously and exit status can later be picked up by guest-exec-status command. stdin/stdout/stderr of the child now is redirected to /dev/null Later we will add ability to specify stdin in guest-exec command and to get collected stdout/stderr with guest-exec-status. Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Michael Roth <mdroth@linux.vnet.ibm.com> * use g_new0 in place of g_malloc for GuestExec struct * commit msg spelling fixes * s/inp-data/input-data * document capture-input mode as false by default * use GetProcessId() for pids on w32 instead of casting HANDLE Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: Use g_new() & friends where that makes obvious senseMarkus Armbruster2015-10-191-3/+3
| | | | | | | | | | | | | | g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Same Coccinelle semantic patch as in commit b45c03f. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: Consistently name Error ** objects errp, and not errMarkus Armbruster2014-05-091-2/+2
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qemu-ga: Extend 'guest-info' command to expose flag 'success-response'Mark Wu2013-10-101-0/+1
| | | | | | | | | | | | | Now we have several qemu-ga commands not returning response on success. It has been documented in qga/qapi-schema.json already. This patch exposes the 'success-response' flag by extending 'guest-info' command. With this change, the clients can handle the command response more flexibly. Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> *fixed up commit subject Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Add interface to traverse the qmp command list by QmpCommandMark Wu2013-10-101-23/+15
| | | | | | | | | | | | | | | | In the original code, qmp_get_command_list is used to construct a list of all commands' name. To get the information of all qga commands, it traverses the name list and search the command info with its name. So it can cause O(n^2) in the number of commands. This patch adds an interface to traverse the qmp command list by QmpCommand to replace qmp_get_command_list. It can decrease the complexity from O(n^2) to O(n). Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> *fix up commit subject Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Fix unchecked strdup() by converting to g_strdup()Markus Armbruster2013-01-301-1/+1
| | | | | | | | | I figure it's freed somewhere deep down in QAPI, with g_free(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qapi: move include files to include/qobject/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-ga: align versioning with QEMU_VERSIONMichael Roth2012-05-151-1/+1
| | | | | | | | | | Previously qemu-ga version was defined seperately. Since it is aligned with QEMU releases, use QEMU_VERSION instead. This also implies the version bump for 1.1[-rcN] release of qemu-ga. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: add guest-sync-delimitedMichael Roth2012-03-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | guest-sync leaves it as an exercise to the user as to how to reliably obtain the response to guest-sync if the client had previously read in a partial response (due qemu-ga previously being restarted mid-"sentence" due to reboot, forced restart, etc). qemu-ga handles this situation on its end by having a client precede their guest-sync request with a 0xFF byte (invalid UTF-8), which qemu-ga/QEMU JSON parsers will treat as a flush event. Thus we can reliably flush the qemu-ga parser state in preparation for receiving the guest-sync request. guest-sync-delimited provides the same functionality for a client: when a guest-sync-delimited is issued, qemu-ga will precede it's response with a 0xFF byte that the client can use as an indicator to flush its buffer/parser state in preparation for reliably receiving the guest-sync-delimited response. It is also useful as an optimization for clients, since, after issuing a guest-sync-delimited, clients can safely discard all stale data read from the channel until the 0xFF is found. More information available on the wiki: http://wiki.qemu.org/Features/QAPI/GuestAgent#QEMU_Guest_Agent_Protocol Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: separate out common commands from posix-specific onesMichael Roth2012-02-231-0/+73
Many of the current RPC implementations are very much POSIX-specific and require complete re-writes for Windows. There are however a small set of core guest agent commands that are common to both, and other commands such as guest-file-* which *may* be portable. So we introduce commands.c for the latter, and will rename guest-agent-commands.c to commands-posix.c in a future commit. Windows implementations will go in commands-win32.c, eventually.
OpenPOWER on IntegriCloud