Pre-snapshot scripts to run before live snapshot

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) Can I leverage this kind of functionality with the oVirt guest agent? Or is it mandatory to consider a remote connection to the VM (via ssh or what for windows?) and execute the script/command/bat file? What are you curently doing in this respect? Thanks, Gianluca

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) https://github.com/guillon/qemu-plugins/blob/master/scripts/qemu-guest-agent... Y. Can I leverage this kind of functionality with the oVirt guest agent? Or is it mandatory to consider a remote connection to the VM (via ssh or what for windows?) and execute the script/command/bat file? What are you curently doing in this respect? Thanks, Gianluca _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

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)
https://github.com/guillon/qemu-plugins/blob/master/scripts/ qemu-guest-agent/fsfreeze-hook.d/mysql-flush.sh.sample
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. 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

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)
https://github.com/guillon/qemu-plugins/blob/master/scripts/ qemu-guest-agent/fsfreeze-hook.d/mysql-flush.sh.sample
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-qem... 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

On Thu, Mar 8, 2018 at 9:47 AM, Yaniv Kaul <ykaul@redhat.com> wrote:
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/
Yes, I see that there are some VSS events intercepted in event viewer when I run a snapshot. But in my particulr case I have an Oracle database used for Business Intelligence that for performance reasons is not in archive log mode, so it can't interact with VSS layer. Due to its nature I can shutdown this database during the evening and then reopen it before the ETL processing happens during the night. So in that time frame I would like to have a pre-snapshot operation of shutdown db and post-snapshot operation of start db. And then I clone the snapshot and export it in case I have to restore the "blob" as a consistent whole It is for this reason that I'm trying to verify if the freeze-hook is usable also in WIndows environments (based on some threads I find it should be...) Thanks, Gianluca
participants (2)
-
Gianluca Cecchi
-
Yaniv Kaul