diff mbox

[RFC,04/10] qemu-ga: Add Windows VSS provider to quiesce applications on fsfreeze

Message ID 20130219003549.GD1566@vm
State New
Headers show

Commit Message

Michael Roth Feb. 19, 2013, 12:35 a.m. UTC
On Thu, Feb 14, 2013 at 03:10:42PM +0900, Tomoki Sekiyama wrote:
> Implements a basic stub of software VSS provider. Currently, this modules
> only provides a relay function of events between qemu-guest-agent and
> Windows VSS when VSS finished filesystem freeze and when qemu snapshot
> is done.
> 
> In the future, this module could be extended to support the other VSS
> functions, such as query for snapshot volumes and recovery.
> 
> Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@hitachi.com>

Looks like this was only tested for in-tree builds. I ran into issues
build out of tree and haven't quite gotten them all worked out. I've
posted what I've gotten so far below, but with those changes applied I'm
still running into this one on FC18:

[mdroth@vm5 qemu-build]$ rm -rf * && ~/w/qemu3.git/configure
--enable-guest-agent --cross-prefix=i686-w64-mingw32-
--with-vss-sdk=/home/mdroth/w/vsssdk && make qemu-ga.exe
...
[mdroth@vm5 qemu-build]$ make V=1 qemu-ga.exe
make  BUILD_DIR=/home/mdroth/qemu-build -C
/home/mdroth/w/qemu3.git/qga/./vss-win32-provider V="1" all
make[1]: Entering directory
`/home/mdroth/dev/kvm/qemu3.git/qga/vss-win32-provider'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory
`/home/mdroth/dev/kvm/qemu3.git/qga/vss-win32-provider'
i686-w64-mingw32-gcc -m32 -D__USE_MINGW_ANSI_STDIO=1
-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes
-Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes
-fno-strict-aliasing  -fstack-protector-all -Wendif-labels
-Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security
-Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration
-Wold-style-definition -Wtype-limits
-I/usr/i686-w64-mingw32/sys-root/mingw/include
-I/usr/i686-w64-mingw32/sys-root/mingw/include/p11-kit-1
-I/home/mdroth/w/vsssdk
-I/usr/i686-w64-mingw32/sys-root/mingw/include/pixman-1   -I. -I.
-mms-bitfields -I/usr/i686-w64-mingw32/sys-root/mingw/include/glib-2.0
-I/usr/i686-w64-mingw32/sys-root/mingw/lib/glib-2.0/include
-DHAS_VSS_SDK -I qga/qapi-generated -O2 -D_FORTIFY_SOURCE=2 -g
-Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase -Wl,--warn-common -m32 -g
-o qemu-ga.exe qapi-types.o qapi-visit.o qga/channel-win32.o
qga/commands-win32.o qga/commands.o qga/guest-agent-command-state.o
qga/main.o qga/qapi-generated/qga-qapi-types.o
qga/qapi-generated/qga-qapi-visit.o qga/qapi-generated/qga-qmp-marshal.o
qga/service-win32.o qga/vss-win32-requester.o libqemuutil.a
libqemustub.a qga/vss-win32-provider/qga-provider.dll version.o -lole32
-loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup
-L/usr/i686-w64-mingw32/sys-root/mingw/lib -lgthread-2.0 -lglib-2.0
-lintl   -lws2_32 -lwinmm -lpowrprof 
i686-w64-mingw32-gcc: error: qga/vss-win32-requester.o: No such file or
directory
i686-w64-mingw32-gcc: error: qga/vss-win32-provider/qga-provider.dll: No
such file or directory
make: *** [qemu-ga.exe] Error 1
[mdroth@vm5 qemu-build]$
  LINK  qemu-ga.exe
  i686-w64-mingw32-gcc: error: qga/vss-win32-requester.o: No such file
  or directory
  i686-w64-mingw32-gcc: error: qga/vss-win32-provider/qga-provider.dll:
  No such file or directory
  make: *** [qemu-ga.exe] Error 1
[mdroth@vm5 qemu-build]$

provider.cpp/install.cpp/qga-provider.dll are actually generated ok,
they're just getting put into $(SRC_PATH)/qga/vss-win32-provider instead
of the build directory due to the recursive Makefile invocation in
qga/Makefile.obj, while gcc is expecting them in $(BUILD_DIR). I think this
rule should get moved up to the top-level Makefile where the rest of the
qemu-ga magic lives. Leaving the Makefile there for stuff like building the
.tlb file is fine though.

The one I'm not understanding is vss-win32-requestor.cpp...it's not
getting built even though everything else in $(qga-obj-y) is. Some
strange with the matching against the %.o: %.cpp recipe I'm guessing.

Here's what I have so far:

@@ -15,6 +15,6 @@ $(obj)/vss-win32-requester.o: QEMU_CXXFLAGS += -Wno-unknown-pragmas
 
 $(QGALIB_EXTDIR)/qga-provider.tlb: $(QGALIB_EXTDIR)/qga-provider.dll
 $(QGALIB_EXTDIR)/qga-provider.dll: $(qga-lib-src) $(obj)/vss-win32.h
-   $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C qga/$(QGALIB_EXTDIR) V="$(V)" all,)
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(SRC_PATH)/qga/$(QGALIB_EXTDIR) V="$(V)" all,)
 
 endif
diff mbox

Patch

diff --git a/qga/vss-win32-provider.h b/qga/vss-win32-provider.h
index e312977..9173484 100644
--- a/qga/vss-win32-provider.h
+++ b/qga/vss-win32-provider.h
@@ -14,6 +14,7 @@ 
 #define VSS_WIN32_PROVIDER_H
 
 #include <windows.h>
+#include <objbase.h>
 
 STDAPI VSSCheckOSVersion(void);
 
diff --git a/qga/vss-win32-provider/Makefile b/qga/vss-win32-provider/Makefile
index 1f213f2..6a6bf8f 100644
--- a/qga/vss-win32-provider/Makefile
+++ b/qga/vss-win32-provider/Makefile
@@ -1,5 +1,5 @@ 
--include ../../config-host.mak
--include ../../rules.mak
+-include $(BUILD_DIR)/config-host.mak
+-include $(SRC_PATH)/rules.mak
 
 # To build .tlb from .idl, WindowsSDK and C++ must be installed
 MIDL=midl
@@ -20,6 +20,7 @@  $(qga-prv-tlb): $(qga-prv-idl)
 
 $(qga-prv-obj-y): QEMU_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls -fstack-protector-all, $(QEMU_CFLAGS))
 $(qga-prv-obj-y): QEMU_CXXFLAGS += -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor
+$(qga-prv-obj-y): QEMU_INCLUDES += -I$(BUILD_DIR)
 
 $(qga-prv-dll): LDFLAGS = -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup -lole32 -loleaut32 -lshlwapi -luuid -static
 $(qga-prv-dll): $(qga-prv-obj-y) $(qga-prv-def) $(qga-prv-tlb)
diff --git a/qga/vss-win32.h b/qga/vss-win32.h
index b8a2be0..d77a598 100644
--- a/qga/vss-win32.h
+++ b/qga/vss-win32.h
@@ -14,7 +14,7 @@ 
 #define VSS_WIN32_H
 
 #define __MIDL_user_allocate_free_DEFINED__
-#include "../config-host.h"
+#include "config-host.h"
 #include <windows.h>
 #include <ole2.h>
 #include <objbase.h>