On Thu, Mar 8, 2018 at 12:47 AM, Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
On Tue, Mar 6, 2018 at 7:54 PM, Yaniv Kaul <ykaul@redhat.com> wrote:


On Mar 6, 2018 7:02 PM, "Gianluca Cecchi" <gianluca.cecchi@gmail.com> wrote:
Hello,
this thread last year (started by me... ;-) was very useful in different aspects involved

http://lists.ovirt.org/pipermail/users/2017-March/080322.html

We did cover memory save or not and fsfreeze automatically done by guest agent if installed inside the VM.
What about pre-snapshot scripts/operations to run inside guest, to have application consistency?
Eg if I have a database inside the VM and I have scripted my backup job involving live-snapshot (eg with the backup.py utility of the thread)  




Hello Yaniv,
thanks for the information and the example file link.
So I have understood that the freeze-hook script is run with the "freeze" option before snapshot and again but with the "thaw" option after the snapshot.
So I can manage what to do, parsing the argument given
So far so good.
I have tested with a Fedora 27 guest and all is ok there.

Now I would like to do something similar for a Windows 2008 R2 x64 VM.

Windows is somewhat different. In fact, it's a bit better than Linux (ARGH! but it's true) with its support for VSS - an API for applications to register to events such as backup.
You should have the QEMU guest agent VSS provider installed (Note: need to see where's the latest bits - I found[1]).

Then, if your application supports VSS, you are all good (I believe).
Y.

[1] https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-qemu-ga/qemu-ga-win-7.4.5-1/

I see that the qemu-guest-agent has been installed under C:\Programs\qemu-ga and that the "QEMU Guest Agent" service is run as
"C:\Program Files\qemu-ga\qemu-ga.exe" -d

In fact I see I have a registry key in

HKLM\SYSTEM\CurrentControlSet\services\QEMU-GA

with the same value above for ImagePath ;
"C:\Program Files\qemu-ga\qemu-ga.exe" -d

What should I do to enable a freeze-hook script on Windows now?

BTW: searching around while trying to understand more, I found that:

on hypervisor running the VM I have

# vdsClient -s 0 getVmStats vm_guid

that works and gives me information that confirms agent seems to communicate and I get also
appsList = [.... , 'QEMU guest agent', ...]

Also, the dump of the dynamic xml for the guest contains

# virsh -r dumpxml VM_NAME

    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channels/420e5014-9b26-a4c0-9d79-ed9b123304de.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>

I tried to get its settings from qemu guest agent using socat and unix domain sockets but I don't receive answer

# socat unix-connect:/var/lib/libvirt/qemu/channels/420e5014-9b26-a4c0-9d79-ed9b123304de.org.qemu.guest_agent.0 readline

and then in the interactive prompt

{"execute":"guest-info"}

to get and verify information about fsfreeze, something like 
...., {"enabled": true, "name": "guest-fsfreeze-freeze"}, ... ...., {"enabled": true, "name": "guest-fsfreeze-thaw"}, ...
 
But I didn't get any line....
Is this communication from OS disabled by design out of oVirt mgmt?

Thanks again for any info to configure freeze-hook in Windows guest.

Gianluca