summaryrefslogtreecommitdiff
path: root/qga
AgeCommit message (Collapse)AuthorFilesLines
2013-04-02qga: add windows implementation for guest-set-timeLei Li1-1/+28
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-04-02qga: add windows implementation for guest-get-timeLei Li1-2/+25
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-03-22Fix typos and misspellingsPeter Maydell1-1/+1
Fix various typos and misspellings. The bulk of these were found with codespell. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-15qga/main.c: Don't use g_key_file_get/set_int64Peter Crosthwaite1-2/+2
These functions don't exist until glib version 2.26. QEMU is currently only mandating glib 2.12. This patch replaces the functions with g_key_file_get/set_integer. Unbreaks the build on Ubuntu 10.04 and RHEL 5.6. Regression was introduced by 39097daf15c42243742667607d2cad2c9dc4f764 Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Message-id: 1363323879-682-1-git-send-email-peter.crosthwaite@xilinx.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-11qga: implement qmp_guest_set_vcpus() for Linux with sysfsLaszlo Ersek1-6/+32
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-03-11qga: implement qmp_guest_get_vcpus() for Linux with sysfsLaszlo Ersek1-6/+140
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-03-11qga: introduce guest-get-vcpus / guest-set-vcpus with stubsLaszlo Ersek3-0/+96
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-03-11qga: add guest-set-time commandLei Li3-0/+86
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> *added stub for w32 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-03-11qga: add guest-get-time commandLei Li3-0/+35
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> *added stub for w32 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-03-11qemu-ga: use key-value store to avoid recycling fd handles after restartMichael Roth3-6/+204
Hosts hold on to handles provided by guest-file-open for periods that can span beyond the life of the qemu-ga process that issued them. Since these are issued starting from 0 on every restart, we run the risk of issuing duplicate handles after restarts/reboots. As a result, users with a stale copy of these handles may end up reading/writing corrupted data due to their existing handles effectively being re-assigned to an unexpected file or offset. We unfortunately do not issue handles as strings, but as integers, so a solution such as using UUIDs can't be implemented without introducing a new interface. As a workaround, we fix this by implementing a persistent key-value store that will be used to track the value of the last handle that was issued across restarts/reboots to avoid issuing duplicates. The store is automatically written to the same directory we currently set via --statedir to track fsfreeze state, and so should be applicable for stable releases where this flag is supported. A follow-up can use this same store for handling fsfreeze state, but that change is cosmetic and left out for now. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Cc: qemu-stable@nongnu.org * fixed guest_file_handle_add() return value from uint64_t to int64_t
2013-03-11qemu-ga: make guest-sync-delimited available during fsfreezeMichael Roth1-0/+1
We currently maintain a whitelist of commands that are safe during fsfreeze. During fsfreeze, we disable all commands that aren't part of that whitelist. guest-sync-delimited meets the criteria for being whitelisted, and is also required for qemu-ga clients that rely on guest-sync-delimited for re-syncing the channel after a timeout. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Cc: qemu-stable@nongnu.org Reviewed-by: Eric Blake <eblake@redhat.com>
2013-03-11qemu-ga: fix confusing GAChannelMethod comparisonStefan Hajnoczi1-1/+1
In commit 7868e26e5930f49ca942311885776b938dcf3b77 ("qemu-ga: add initial win32 support") support was added for qemu-ga on Windows using virtio-serial. Other channel methods (ISA serial and UNIX domain socket) are not supported on Windows. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-03-11qga: cast to int for DWORD typeLei Li1-1/+1
This patch fixes a compiler warning when cross-build: qga/service-win32.c: In function 'printf_win_error': qga/service-win32.c:32:5: warning: format '%d' expects argument of type 'int', but argument 3 has type 'DWORD' [-Wformat] Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-30qemu-ga: Fix unchecked strdup() by converting to g_strdup()Markus Armbruster1-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>
2013-01-28qemu-ga: Plug leaks on qmp_guest_network_get_interfaces() error pathsMarkus Armbruster1-5/+6
Spotted by Coverity. 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: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-28qemu-ga: Plug memory leak in guest_fsfreeze_cleanup()Markus Armbruster1-4/+5
Neglects to free errors allocated by qmp_guest_fsfreeze_thaw(). Spotted by Coverity. While there, drop the test whether return value is negative (it's never true), and improve logging. 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: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-19Replace non-portable asprintf by g_strdup_printfStefan Weil1-8/+5
g_strdup_printf already handles OOM errors, so some error handling in QEMU code can be removed. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-01-15Merge remote-tracking branch 'mdroth/qga-pull-1-14-2013-2' into stagingAnthony Liguori1-2/+2
* mdroth/qga-pull-1-14-2013-2: qga: add missing commas in json docs Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-14qga: add missing commas in json docsEric Blake1-2/+2
* qga/qapi-schema.json: Use valid JSON. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-14qemu-ga: Handle errors uniformely in ga_channel_open()Markus Armbruster1-4/+7
We detect errors in several places. One reports with g_error(), which calls abort(), the others report with g_critical(). Three of them exit(), three return false. Always report with g_critical(), and return false. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> *minor fix-up of commit msg Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-14qemu-ga: Plug fd leak on ga_channel_open() error pathsMarkus Armbruster1-0/+1
Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-14qemu-ga: Plug fd leak on ga_channel_listen_accept() error pathMarkus Armbruster1-0/+1
Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-14qemu-ga: Plug file descriptor leak on ga_open_pidfile() error pathMarkus Armbruster1-0/+2
Spotted by Coverity. Also document why we keep it open on success. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-14qemu-ga: Drop pointless lseek() from ga_open_pidfile()Markus Armbruster1-1/+1
After open(), the file offset is already zero, and neither lockf() nor ftruncate() change it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-14qemu-ga: Document intentional fall through in channel_event_cb()Markus Armbruster1-0/+1
For clarity, and to hush up Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-14qemu-ga: add ga_open_logfile()Luiz Capitulino1-2/+15
This function sets O_CLOEXEC on the log file fd so that it isn't leaked to executed processes. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Amos Kong <akong@redhat.com> Tested-by: Amos Kong <akong@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-14qemu-ga: ga_open_pidfile(): use qemu_open()Luiz Capitulino1-1/+1
This ensures that O_CLOEXEC is passed to open(), this way the pid file fd is not leaked to executed processes. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Amos Kong <akong@redhat.com> Tested-by: Amos Kong <akong@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-11Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori1-0/+1
* stefanha/trivial-patches: hw/pc.c: Fix converting of ioport_register* to MemoryRegion Replace remaining gmtime, localtime by gmtime_r, localtime_r savevm: Remove MinGW specific code which is no longer needed qga/channel-posix.c: Explicitly include string.h configure: Fix comment (copy+paste bug) readline: avoid memcpy() of overlapping regions Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-11qga/channel-posix.c: Explicitly include string.hPeter Maydell1-0/+1
Explicitly include string.h to avoid warnings under MacOS X/clang about implicit declarations of strerror() and strlen(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-01-08qemu-ga: execute hook to quiesce the guest on fsfreeze-freeze/thawTomoki Sekiyama3-1/+117
To use the online disk snapshot for online-backup, application-level consistency of the snapshot image is required. However, currently the guest agent can provide only filesystem-level consistency, and the snapshot may contain dirty data, for example, incomplete transactions. This patch provides the opportunity to quiesce applications before snapshot is taken. If --fsfreeze-hook option is specified, the hook is executed with "freeze" argument before the filesystem is frozen by fsfreeze-freeze command. As for fsfreeze-thaw command, the hook is executed with "thaw" argument after the filesystem is thawed. This patch depends on patchset to improve error reporting by Luiz Capitulino: http://lists.gnu.org/archive/html/qemu-devel/2012-11/msg03016.html Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> *clarified usage in help output Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: guest_suspend(): improve error reportingLuiz Capitulino1-11/+18
Most errors are QERR_UNDEFINED_ERROR today. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: bios_supports_mode(): improve error reportingLuiz Capitulino1-19/+27
Most errors are QERR_UNDEFINED_ERROR today. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() + error_set()Luiz Capitulino1-21/+8
Convert them to error_setg_errno(). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set()Luiz Capitulino1-7/+3
Convert them to error_setg_errno(). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set()Luiz Capitulino1-7/+3
Convert them to error_setg_errno(). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: build_fs_mount_list(): take an Error argumentLuiz Capitulino1-14/+16
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: qmp_guest_shutdown(): improve error reportingLuiz Capitulino1-10/+38
Most errors are QERR_UNDEFINED_ERROR. Also, adds ga_wait_child() as a future commit will use it too. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: qmp_guest_file_*: improve error reportingLuiz Capitulino1-9/+13
Use error_setg_errno() when possible with an improved error description. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: qmp_guest_file_close(): fix fclose() error checkLuiz Capitulino1-1/+1
fclose() returns EOF on error. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08qemu-ga: guest_file_handle_find(): take an Error argumentLuiz Capitulino1-11/+7
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> *Fixed missing space character in error message Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini3-5/+5
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qapi: move include files to include/qobject/Paolo Bonzini5-10/+10
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qemu-ga: move qemu-ga files to qga/Paolo Bonzini3-1/+1419
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-06qga/channel-posix.c: Include headers it needsEduardo Habkost1-0/+5
Include: - <errno.h> for errno - <unistd.h> & <fcntl.h> for fcntl() - <stdlib.h> for exit() - "osdep.h" for qemu_open() Some of those headers were probably being included by accident because some other headers were including qemu-common.h, but those headers should eventually stop including qemu-common.h. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-10-23qemu-ga: ask and print error information from qemu-socketsPaolo Bonzini1-3/+5
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: add Error ** to all functionsPaolo Bonzini1-1/+1
This lets me adjust the clients to do proper error propagation first, thus avoiding temporary regressions in the quality of the error messages. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-06Merge branch 'trivial-patches' of git://github.com/stefanha/qemuAurelien Jarno2-4/+0
* 'trivial-patches' of git://github.com/stefanha/qemu: versatilepb: Use symbolic indices for ARM PIC qdev: kill bogus comment qemu-barrier: Fix compiler version check for future gcc versions hw: Add missing 'static' attribute for QEMUMachine cleanup useless return sentence qemu-sockets: Fix compiler warning (regression for MinGW) vnc: Fix spelling (hellmen -> hellman) in comment slirp: Fix spelling in comment (enought -> enough, insure -> ensure) tcg/arm: Use tcg_out_mov_reg rather than inline equivalent code cpu: Add missing 'static' attribute to qemu_global_mutex configure: Support empty target list (--target-list=) hw: Fix return value check for bdrv_read, bdrv_write
2012-10-05cleanup useless return sentenceAmos Kong2-4/+0
This patch cleans up return sentences in the end of void functions. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2012-10-05qemu-ga: prefer pstrcpy: consistently NUL-terminate ifreq.ifr_nameJim Meyering1-1/+1
NUL-termination of the .ifr_name field is not required, but is fine (and preferable to using strncpy and leaving the reader to wonder), since the first thing the linux kernel does is to clear the last byte. Besides, using pstrcpy here makes this setting of ifr_name consistent with the other code (e.g., net/tap-linux.c) that does the same thing. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-07-29build: Fix linking failure for qemu-gaDunrong Huang1-2/+2
This patch will fix the following linking failed: LINK qemu-ga gcc: error: qga/../qapi-generated/qga-qapi-types.o: No such file or directory gcc: error: qga/../qapi-generated/qga-qapi-visit.o: No such file or directory gcc: error: qga/../qapi-generated/qga-qmp-marshal.o: No such file or directory make: *** [qemu-ga] Error 1 Commit cdc976b040f2760103ce2fb49f4d504093a7163f changes the dependencies of qemu-ga to depend "../qapi-generated/qga-qapi-types.o", which will be expanded to "qga/../qapi-generated/qga-qapi-types.o" when building qemu-ga. In top-level Makefile, we defined a target "qapi-generated/qga-qapi-types.o" which was not equal to "qga/../qapi-generated/qga-qapi-types" in the Makefile world. So "No such file" error happened when qemu-ga was linking. The easy approach to fix is to change the target name to "qga/../qapi-generated/qga-qapi-types.o", but it is weird. So, in order to solve it more graciously, I move those temporary files(qga-qapi-*.{c,h}) qemu-ga depends on to qemu-ga/qapi-generated, this makes dependencies more clearer. Signed-off-by: Dunrong Huang <riegamaths@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>