Skip to content

qemu-ga: add support for Windows

Michael Roth qemu-devel 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 0 repliesNew
  2. v28 patches 12 repliesSuperseded

Changes in v3 from the cover letter

- Fixed long-standing bug in getopt usage that triggered on win32 (Matsuda)
- Treat ERROR_OPERATION_ABORTED on read from unconnected/empty channel as eof (Matsuda)

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8qemu-ga: Add schema documentation for typesqapi-schema-guest.json+97 -210 replies
2/8qemu-ga: move channel/transport functionality into wrapper classMakefile.objs qemu-ga.c qga/channel-posix.c +2 more+355 -2330 replies
3/8qemu-ga: separate out common commands from posix-specific onesMakefile.objs qga/commands.c qga/guest-agent-commands.c +1 more+76 -590 replies
4/8qemu-ga: rename guest-agent-commands.c -> commands-posix.cMakefile.objs qga/commands-posix.c qga/guest-agent-commands.c+529 -5290 replies
5/8qemu-ga: fixes for win32 build of qemu-gaMakefile Makefile.objs configure +2 more+114 -60 replies
6/8qemu-ga: add initial win32 supportMakefile.objs qemu-ga.c qga/channel-win32.c+345 -10 replies
7/8qemu-ga: add Windows service integrationMakefile.objs qemu-ga.c qga/service-win32.c +1 more+249 -100 replies
8/8qemu-ga: add win32 guest-shutdown commandqga/commands-win32.c+40 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 0/8] qemu-ga: add support for Windows

These patches apply on top of qemu.git master, and can also be obtained from:
git://github.com/mdroth/qemu.git qga-win32-v3

CHANGES SINCE V2:

- Fixed long-standing bug in getopt usage that triggered on win32 (Matsuda)
- Treat ERROR_OPERATION_ABORTED on read from unconnected/empty channel as eof (Matsuda)

CHANGES SINCE V1:

- Dropped guest-set-support-level patch dependency
- Rebased on master and re-tested
- Spelling/grammar fixes in commits/comments

OVERVIEW:

These patches add support for Windows to the QEMU guest agent. With these patches the following guest agent commands are supported on Windows:

guest-ping
guest-info
guest-sync
guest-shutdown

The guest-file* commands can essentially be enabled for Windows as-is, but since mingw does not honor the O_NONBLOCK flag, they'll need to be reworked if we're to retain the current non-blocking behavior.

The rest of the commands are currently stubbed out for Windows (qemu-ga will return an "unsupported" error), but it should be easy to implement these going forward with basic Windows support/infrastructure in place.

The build was tested using Fedora15 with a MinGW cross-build target via:

configure --enable-guest-agent --cross-prefix=i686-pc-mingw32- make qemu-ga.exe

The executable was tested using Windows XP SP3, and partially tested using Windows Server 2008 and Windows 7 (no I/O for the latter 2, having issues with virtio-win drivers). GLib 2.28+ for Windows is required. You can install qemu-ga as a load-on-boot service by running:

./qemu-ga --service install

And start/stop manually via:

net start qemu-ga
net stop qemu-ga

Many thanks to Gal Hammer for contributing the service integration and shutdown code.

 Makefile                   |    2 +-
 Makefile.objs              |    8 +-
 configure                  |    2 +-
 qapi-schema-guest.json     |  118 ++++++++--
 qemu-ga.c                  |  423 ++++++++++++++------------------
 qga/channel-posix.c        |  246 +++++++++++++++++++
 qga/channel-win32.c        |  340 +++++++++++++++++++++++++
 qga/channel.h              |   33 +++
 qga/commands-posix.c       |  528 +++++++++++++++++++++++++++++++++++++++
 qga/commands-win32.c       |  130 ++++++++++
 qga/commands.c             |   73 ++++++
 qga/guest-agent-commands.c |  585 --------------------------------------------
 qga/guest-agent-core.h     |    3 +-
 qga/service-win32.c        |  114 +++++++++
 qga/service-win32.h        |   30 +++
 15 files changed, 1790 insertions(+), 845 deletions(-)