9e2fa418 | 29-May-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: avoid blocking on atime update when reading /etc/mtab
Currently we re-read/re-process /etc/mtab to get an updated list of mounts when guest-fsfreeze-thaw is called. This can cause an atime
qemu-ga: avoid blocking on atime update when reading /etc/mtab
Currently we re-read/re-process /etc/mtab to get an updated list of mounts when guest-fsfreeze-thaw is called. This can cause an atime update on /etc/mtab, which will block if we're in a frozen state.
Instead, use /proc's version of mtab, which may not be up-to-date with options passed via -o remount, but is compatible for our use cases since we only care about the filesystem type.
Reported-by: Matsuda, Daiki <matsudadik@intellilink.co.jp> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
eecae147 | 27-May-2012 |
Andreas Färber <andreas.faerber@web.de> |
qemu-ga: Fix use of environ on Darwin
Use _NSGetEnviron() helper to access the environment.
Signed-off-by: Andreas Färber <andreas.faerber@web.de> Cc: Charlie Somerville <charlie@charliesomerville.
qemu-ga: Fix use of environ on Darwin
Use _NSGetEnviron() helper to access the environment.
Signed-off-by: Andreas Färber <andreas.faerber@web.de> Cc: Charlie Somerville <charlie@charliesomerville.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
2c02cbf6 | 23-May-2012 |
Luiz Capitulino <lcapitulino@redhat.com> |
qemu-ga: Fix missing environ declaration
Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global variable, but is relying on environ to be declared somewhere else.
This worked for m
qemu-ga: Fix missing environ declaration
Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global variable, but is relying on environ to be declared somewhere else.
This worked for me because on F16 environ is declared in <unistd.h>, but that doesn't happen in OpenBSD for example, causing a build failure.
This commit fixes the build error by declaring environ if it hasn't being declared yet.
Also fixes a build warning due to a missing <sys/wait.h> include.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
8efacc43 | 14-May-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: align versioning with QEMU_VERSION
Previously qemu-ga version was defined seperately. Since it is aligned with QEMU releases, use QEMU_VERSION instead. This also implies the version bump fo
qemu-ga: align versioning with QEMU_VERSION
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>
show more ...
|
3674838c | 14-May-2012 |
Luiz Capitulino <lcapitulino@redhat.com> |
qemu-ga: guest-shutdown: use only async-signal-safe functions
POSIX mandates[1] that a child process of a multi-thread program uses only async-signal-safe functions before exec(). We consider qemu-g
qemu-ga: guest-shutdown: use only async-signal-safe functions
POSIX mandates[1] that a child process of a multi-thread program uses only async-signal-safe functions before exec(). We consider qemu-ga to be multi-thread, because it uses glib.
However, qmp_guest_shutdown() uses functions that are not async-signal-safe. Fix it the following way:
- fclose() -> reopen_fd_to_null() - execl() -> execle() - exit() -> _exit() - drop slog() usage (which is not safe)
[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
d5dd3498 | 11-May-2012 |
Luiz Capitulino <lcapitulino@redhat.com> |
qemu-ga: guest-shutdown: become synchronous
Last commit dropped qemu-ga's SIGCHLD handler, used to automatically reap terminated children processes. This introduced a bug to qmp_guest_shutdown(): it
qemu-ga: guest-shutdown: become synchronous
Last commit dropped qemu-ga's SIGCHLD handler, used to automatically reap terminated children processes. This introduced a bug to qmp_guest_shutdown(): it will generate zombies.
This problem probably doesn't matter in the success case, as the VM will shutdown anyway, but let's do the right thing and reap the created process. This ultimately means that guest-shutdown is now a synchronous command.
An interesting side effect is that guest-shutdown is now able to report an error to the client if shutting down fails.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
dc8764f0 | 11-May-2012 |
Luiz Capitulino <lcapitulino@redhat.com> |
qemu-ga: guest-suspend: make the API synchronous
Currently, qemu-ga has a SIGCHLD handler that automatically reaps terminated children processes. The idea is to avoid having qemu-ga commands blocked
qemu-ga: guest-suspend: make the API synchronous
Currently, qemu-ga has a SIGCHLD handler that automatically reaps terminated children processes. The idea is to avoid having qemu-ga commands blocked waiting for children to terminate.
That approach has two problems:
1. qemu-ga is unable to detect errors in the child, meaning that qemu-ga returns success even if the child fails to perform its task
2. if a command does depend on the child exit status, the command has to play tricks to bypass the automatic reaper
Case 2 impacts the guest-suspend-* API, because it has to execute an external program to check for suspend support. Today, to bypass the automatic reaper, suspend code has to double fork and pass exit status information through a pipe. Besides being complex, this is prone to race condition bugs. Indeed, the current code does have such bugs.
Making the guest-suspend-* API synchronous (ie. by dropping the SIGCHLD handler and calling waitpid() from commands) is a much simpler approach, which fixes current race conditions bugs and enables commands to detect errors in the child.
This commit does just that. There's a side effect though, guest-shutdown will generate zombies if shutting down fails. This will be fixed by the next commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
04b4e75f | 10-May-2012 |
Luiz Capitulino <lcapitulino@redhat.com> |
qemu-ga: make reopen_fd_to_null() public
The next commit wants to use it.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael
qemu-ga: make reopen_fd_to_null() public
The next commit wants to use it.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
a31f0531 | 09-May-2012 |
Jim Meyering <jim@meyering.net> |
fix some common typos
These were identified using: http://github.com/lyda/misspell-check and run like this to create a bourne shell script using GNU sed's -i option:
git ls-files|grep -vF .bin | mi
fix some common typos
These were identified using: http://github.com/lyda/misspell-check and run like this to create a bourne shell script using GNU sed's -i option:
git ls-files|grep -vF .bin | misspellings -f - |grep -v '^ERROR:' |perl \ -pe 's/^(.*?)\[(\d+)\]: (\w+) -> "(.*?)"$/sed -i '\''${2}s!$3!$4!'\'' $1/'
Manually eliding the FP, "rela->real" and resolving "addres" to address (not "adders") we get this:
sed -i '450s!thru!through!' Changelog sed -i '260s!neccessary!necessary!' coroutine-sigaltstack.c sed -i '54s!miniscule!minuscule!' disas.c sed -i '1094s!thru!through!' hw/usb/hcd-ehci.c sed -i '1095s!thru!through!' hw/usb/hcd-ehci.c sed -i '21s!unecessary!unnecessary!' qapi-schema-guest.json sed -i '307s!explictly!explicitly!' qemu-ga.c sed -i '490s!preceeding!preceding!' qga/commands-posix.c sed -i '792s!addres!address!' qga/commands-posix.c sed -i '6s!beeing!being!' tests/tcg/test-mmap.c
Also, manually fix "arithmentic", spotted by Peter Maydell:
sed -i 's!arithmentic!arithmetic!' coroutine-sigaltstack.c
Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
show more ...
|
75e4e847 | 01-May-2012 |
Anthony Liguori <aliguori@us.ibm.com> |
Merge remote-tracking branch 'mdroth/qga-pull-4-27-12' into staging
* mdroth/qga-pull-4-27-12: qemu-ga: persist tracking of fsfreeze state via filesystem qemu-ga: add a whitelist for fsfreeze-sa
Merge remote-tracking branch 'mdroth/qga-pull-4-27-12' into staging
* mdroth/qga-pull-4-27-12: qemu-ga: persist tracking of fsfreeze state via filesystem qemu-ga: add a whitelist for fsfreeze-safe commands qemu-ga: improve recovery options for fsfreeze
show more ...
|
e61ab1da | 30-Apr-2012 |
Andreas Färber <andreas.faerber@web.de> |
qemu-ga: Implement alternative to O_ASYNC
ga_channel_open() was using open flag O_ASYNC for SIGIO-driven I/O. This breaks on illumos, so fall back to POSIX I_SETSIG ioctl (SIGPOLL).
Signed-off-by:
qemu-ga: Implement alternative to O_ASYNC
ga_channel_open() was using open flag O_ASYNC for SIGIO-driven I/O. This breaks on illumos, so fall back to POSIX I_SETSIG ioctl (SIGPOLL).
Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk> Signed-off-by: Andreas Färber <andreas.faerber@web.de> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
show more ...
|
f22d85e9 | 17-Apr-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: add a whitelist for fsfreeze-safe commands
Currently we rely on fsfreeze/thaw commands disabling/enabling logging then having other commands check whether logging is disabled to avoid execu
qemu-ga: add a whitelist for fsfreeze-safe commands
Currently we rely on fsfreeze/thaw commands disabling/enabling logging then having other commands check whether logging is disabled to avoid executing if they aren't safe for running while a filesystem is frozen.
Instead, have an explicit whitelist of fsfreeze-safe commands, and consolidate logging and command enablement/disablement into a pair of helper functions: ga_set_frozen()/ga_unset_frozen()
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
9e8aded4 | 16-Apr-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: improve recovery options for fsfreeze
guest-fsfreeze-thaw relies on state information obtained from guest-fsfreeze-freeze to determine what filesystems to unfreeze. This is unreliable due t
qemu-ga: improve recovery options for fsfreeze
guest-fsfreeze-thaw relies on state information obtained from guest-fsfreeze-freeze to determine what filesystems to unfreeze. This is unreliable due to the fact that that state does not account for FIFREEZE being issued by other processes, or previous instances of qemu-ga. This means in certain situations we cannot thaw filesystems even with a responsive qemu-ga instance at our disposal.
This patch allows guest-fsfreeze-thaw to be issued unconditionally. It also adds some additional logic to allow us to thaw filesystems regardless of how many times the filesystem's "frozen" refcount has been incremented by any guest processes.
Also, guest-fsfreeze-freeze now operates atomically: on success all freezable filesystems are frozen, and on error all filesystems are thawed. The ambiguous "GUEST_FSFREEZE_STATUS_ERROR" state is no longer entered.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|
d35d4cb5 | 13-Apr-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: generate missing stubs for fsfreeze
When linux-specific commands (including guest-fsfreeze-*) were consolidated under defined(__linux__), we forgot to account for the case where defined(__l
qemu-ga: generate missing stubs for fsfreeze
When linux-specific commands (including guest-fsfreeze-*) were consolidated under defined(__linux__), we forgot to account for the case where defined(__linux__) && !defined(FIFREEZE). As a result stubs are no longer being generated on linux hosts that don't have FIFREEZE support. Fix this.
Tested-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
e72c3f2e | 25-Mar-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: fix bsd build, and re-org linux-specific implementations |
b71706d1 | 15-Mar-2012 |
Jeff Cody <jcody@redhat.com> |
qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()
In the function ga_channel_write(), the handle ov.hEvent is created by the call to CreateEvent(). However, the handle is not close
qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()
In the function ga_channel_write(), the handle ov.hEvent is created by the call to CreateEvent(). However, the handle is not closed prior to the function return.
This patch closes the handle before the return of the function.
Kudos to Paolo Bonzini for spotting this bug.
Signed-off-by: Jeff Cody <jcody@redhat.com> Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
show more ...
|
3cf0bed8 | 07-Feb-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: add guest-sync-delimited
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: add guest-sync-delimited
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>
show more ...
|
3424fc9f | 29-Feb-2012 |
Michal Privoznik <mprivozn@redhat.com> |
qemu-ga: add guest-network-get-interfaces command
This command returns an array of:
[ifname, hwaddr, [ipaddr, ipaddr_family, prefix] ]
for each interface in the system. Currently, only IPv4 and I
qemu-ga: add guest-network-get-interfaces command
This command returns an array of:
[ifname, hwaddr, [ipaddr, ipaddr_family, prefix] ]
for each interface in the system. Currently, only IPv4 and IPv6 are supported.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
show more ...
|
f54603b6 | 12-Mar-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: add win32 guest-suspend-ram command
S3 sleep implementation for windows. |
aa59637e | 29-Jan-2012 |
Gal Hammer <ghammer@redhat.com> |
qemu-ga: add win32 guest-suspend-disk command.
Implement guest-suspend-disk RPC for Windows. Functionally this should be equivalent to the posix implementation.
Signed-off-by: Gal Hammer <ghammer@r
qemu-ga: add win32 guest-suspend-disk command.
Implement guest-suspend-disk RPC for Windows. Functionally this should be equivalent to the posix implementation.
Signed-off-by: Gal Hammer <ghammer@redhat.com>
show more ...
|
95f4f404 | 28-Feb-2012 |
Luiz Capitulino <lcapitulino@redhat.com> |
qemu-ga: add guest-suspend-hybrid
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> |
fbf42210 | 28-Feb-2012 |
Luiz Capitulino <lcapitulino@redhat.com> |
qemu-ga: add guest-suspend-ram
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> |
11d0f125 | 28-Feb-2012 |
Luiz Capitulino <lcapitulino@redhat.com> |
qemu-ga: add guest-suspend-disk
As the command name implies, this command suspends the guest to disk.
The suspend operation is implemented by two functions: bios_supports_mode() and guest_suspend()
qemu-ga: add guest-suspend-disk
As the command name implies, this command suspends the guest to disk.
The suspend operation is implemented by two functions: bios_supports_mode() and guest_suspend(). Both functions are generic enough to be used by other suspend modes (introduced by next commits).
Both functions will try to use the scripts provided by the pm-utils package if it's available. If it's not available, a manual method, which consists of directly writing to '/sys/power/state', will be used.
To reap terminated children, a new signal handler is installed in the parent to catch SIGCHLD signals and a non-blocking call to waitpid() is done to collect their exit statuses. The statuses, however, are discarded.
The approach used to query the guest for suspend support deserves some explanation. It's implemented by bios_supports_mode() and shown below:
qemu-ga | create pipe | fork() ----------------- | | | | | fork() | -------------------------- | | | | | | | | exec('pm-is-supported') | | | wait() | write exit status to pipe | exit | read pipe
This might look complex, but the resulting code is quite simple. The purpose of that approach is to allow qemu-ga to reap its children (semi-)automatically from its SIGCHLD handler.
Implementing this the obvious way, that's, doing the exec() call from the first child process, would force us to introduce a more complex way to reap qemu-ga's children. Like registering PIDs to be reaped and having a way to wait for them when returning their exit status to qemu-ga is necessary. The approach explained above avoids that complexity.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
546b60d0 | 22-Jan-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: add win32 guest-shutdown command
Implement guest-shutdown RPC for Windows. Functionally this should be equivalent to the posix implementation.
Original patch by Gal Hammer <ghammer@redhat.
qemu-ga: add win32 guest-shutdown command
Implement guest-shutdown RPC for Windows. Functionally this should be equivalent to the posix implementation.
Original patch by Gal Hammer <ghammer@redhat.com>
show more ...
|
bc62fa03 | 21-Jan-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qemu-ga: add Windows service integration
This allows qemu-ga to function as a Windows service:
- to install the service (will auto-start on boot): qemu-ga --service install - to start the se
qemu-ga: add Windows service integration
This allows qemu-ga to function as a Windows service:
- to install the service (will auto-start on boot): qemu-ga --service install - to start the service: net start qemu-ga - to stop the service: net stop qemu-ga - to uninstall service: qemu-ga --service uninstall
Original patch by Gal Hammer <ghammer@redhat.com>
show more ...
|