Commit Graph

90 Commits

Author SHA1 Message Date
Peter Maydell 085d813407 Fix typos and misspellings
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-22 13:25:07 +01:00
Peter Crosthwaite 4f30649618 qga/main.c: Don't use g_key_file_get/set_int64
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 39097daf15

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-15 08:23:54 -05:00
Laszlo Ersek cbb65fc27f qga: implement qmp_guest_set_vcpus() for Linux with sysfs
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-11 18:58:30 -05:00
Laszlo Ersek d2baff6253 qga: implement qmp_guest_get_vcpus() for Linux with sysfs
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-11 18:58:25 -05:00
Laszlo Ersek 70e133a708 qga: introduce guest-get-vcpus / guest-set-vcpus with stubs
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-11 18:57:49 -05:00
Lei Li a1bca57f75 qga: add guest-set-time command
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-11 18:53:47 -05:00
Lei Li 6912e6a94c qga: add guest-get-time command
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-11 18:53:47 -05:00
Michael Roth 39097daf15 qemu-ga: use key-value store to avoid recycling fd handles after restart
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-11 18:53:47 -05:00
Michael Roth c5dcb6ae23 qemu-ga: make guest-sync-delimited available during fsfreeze
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-11 18:53:46 -05:00
Stefan Hajnoczi 9e7c23db13 qemu-ga: fix confusing GAChannelMethod comparison
In commit 7868e26e59
("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-11 18:53:46 -05:00
Lei Li ed2cbf7444 qga: cast to int for DWORD type
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-03-11 18:53:46 -05:00
Markus Armbruster 24a5304953 qemu-ga: Fix unchecked strdup() by converting to g_strdup()
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-30 11:14:46 +01:00
Markus Armbruster 10a2158f52 qemu-ga: Plug leaks on qmp_guest_network_get_interfaces() error paths
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-28 13:46:54 -06:00
Markus Armbruster 6f6867493c qemu-ga: Plug memory leak in guest_fsfreeze_cleanup()
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-28 13:46:18 -06:00
Stefan Weil e4ada48242 Replace non-portable asprintf by g_strdup_printf
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-19 10:24:43 +00:00
Anthony Liguori 2fd3402d92 Merge remote-tracking branch 'mdroth/qga-pull-1-14-2013-2' into staging
* 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-15 16:50:04 -06:00
Eric Blake 01b87f6d21 qga: add missing commas in json docs
* 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-14 16:15:26 -06:00
Markus Armbruster 7868181f98 qemu-ga: Handle errors uniformely in ga_channel_open()
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-14 12:08:05 -06:00
Markus Armbruster d4f4a3efdf qemu-ga: Plug fd leak on ga_channel_open() error paths
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-14 12:07:59 -06:00
Markus Armbruster 32c16620dd qemu-ga: Plug fd leak on ga_channel_listen_accept() error path
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-14 12:07:54 -06:00
Markus Armbruster 03ac10f166 qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path
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-14 12:07:48 -06:00
Markus Armbruster 5d27f9ce3d qemu-ga: Drop pointless lseek() from ga_open_pidfile()
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-14 12:07:37 -06:00
Markus Armbruster f5b7957878 qemu-ga: Document intentional fall through in channel_event_cb()
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-14 12:00:40 -06:00
Luiz Capitulino 9e92f6d462 qemu-ga: add ga_open_logfile()
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-14 12:00:35 -06:00
Luiz Capitulino 6ffacc5d3d qemu-ga: ga_open_pidfile(): use qemu_open()
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-14 12:00:20 -06:00
Anthony Liguori fedf2de310 Merge remote-tracking branch 'stefanha/trivial-patches' into staging
* 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-11 08:43:18 -06:00
Peter Maydell 1d57db193f qga/channel-posix.c: Explicitly include string.h
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-11 09:33:41 +01:00
Tomoki Sekiyama ec0f694c11 qemu-ga: execute hook to quiesce the guest on fsfreeze-freeze/thaw
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-08 16:38:12 -06:00
Luiz Capitulino 7b3760879b qemu-ga: guest_suspend(): improve error reporting
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-08 16:38:12 -06:00
Luiz Capitulino 6b26e837a4 qemu-ga: bios_supports_mode(): improve error reporting
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-08 16:38:12 -06:00
Luiz Capitulino 878a0ae0ab qemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() + error_set()
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-08 16:38:11 -06:00
Luiz Capitulino 071673b090 qemu-ga: qmp_guest_fstrim(): get rid of sprintf() + error_set()
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-08 16:38:11 -06:00
Luiz Capitulino 617fbbc132 qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set()
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-08 16:38:11 -06:00
Luiz Capitulino 261551d1cc qemu-ga: build_fs_mount_list(): take an Error argument
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-01-08 16:38:11 -06:00
Luiz Capitulino d220a6dfea qemu-ga: qmp_guest_shutdown(): improve error reporting
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-08 16:38:11 -06:00
Luiz Capitulino db3edb6655 qemu-ga: qmp_guest_file_*: improve error reporting
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-08 16:38:11 -06:00
Luiz Capitulino 3ac4b7c51e qemu-ga: qmp_guest_file_close(): fix fclose() error check
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-08 16:38:10 -06:00
Luiz Capitulino a9de6d01df qemu-ga: guest_file_handle_find(): take an Error argument
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>
2013-01-08 16:38:10 -06:00
Paolo Bonzini 1de7afc984 misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:32:39 +01:00
Paolo Bonzini 7b1b5d1913 qapi: move include files to include/qobject/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:31:31 +01:00
Paolo Bonzini 2870dc3456 qemu-ga: move qemu-ga files to qga/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:31:30 +01:00
Eduardo Habkost 4d4922c339 qga/channel-posix.c: Include headers it needs
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-12-06 09:17:05 +01:00
Paolo Bonzini 90119816e3 qemu-ga: ask and print error information from qemu-sockets
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23 13:54:56 +02:00
Paolo Bonzini 7fc4e63ec0 qemu-sockets: add Error ** to all functions
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-23 13:54:55 +02:00
Aurelien Jarno 048d3612a5 Merge branch 'trivial-patches' of git://github.com/stefanha/qemu
* '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-06 18:54:14 +02:00
Amos Kong 4d5b97da35 cleanup useless return sentence
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-05 15:10:21 +02:00
Jim Meyering 1ab516ed9b qemu-ga: prefer pstrcpy: consistently NUL-terminate ifreq.ifr_name
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-10-05 07:58:37 -05:00
Dunrong Huang 54c2e50205 build: Fix linking failure for qemu-ga
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 cdc976b040 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>
2012-07-29 08:41:53 +00:00
Paolo Bonzini cdc976b040 build: include qapi-generated/ files in qga/Makefile.objs
No reason to leave them out, and it will ensure that the dependencies
are picked up.  Later we can perhaps move the files to another
directory to avoid ../ usage.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:15:29 +00:00
Paolo Bonzini eab5fd5989 qemu-ga: add guest-fstrim command
FITRIM is a mounted filesystem feature to discard (or "trim") blocks which
are not in use by the filesystem. This is useful for solid-state drives
(SSDs) and thinly-provisioned storage.  Provide access to the feature
from the host so that filesystems can be trimmed periodically or before
migration.

Here is an example using scsi_debug:

    # modprobe scsi_debug lbpu=1 lbpws=1
    # sg_vpd -p0xb2 /dev/sdb
    Logical block provisioning VPD page (SBC):
      Unmap command supported (LBPU): 1
      Write same (16) with unmap bit supported (LBWS): 1
      Write same (10) with unmap bit supported (LBWS10): 0
    # mke2fs /dev/sdb
    # cat /sys/bus/pseudo/drivers/scsi_debug/map
    1-616,16257-16383
    # mount /dev/sdb /run/media/pbonzini/test
    # dd if=/dev/zero of=/run/media/pbonzini/test/file
    # cat map
    1-616,645-1588,1599-4026,4029-16383
    # rm /run/media/pbonzini/test/file
    # ./qemu-ga /dev/fd/0
    {"execute":"guest-fstrim"}
    {"return": {}}
    # cat map
    1-612

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-06-21 17:59:27 -05:00