On 10/29/2014 01:07 PM, Thomas Stein wrote:> About the --quiesce option. Do i need to do something inside the vm? The most > commonly would probably be a sql server running inside the vm. Do i need to > tell the sql server something about the --quiesce option i use? I read this > article here which suggests such a procedure. Okay, it's vmware, but... Is > that right?For --quiesce to work, you have to have qemu-guest-agent installed and running in your guest, and also inform libvirt via the domain XML to establish a channel to the guest agent. Furthermore, if you want your sql database to be at a stable point, you can install freeze hooks in your guest that get invoked prior to freezing the file system and just after thawing it (that is, qemu-guest-agent already has documented hooks that let you do any additional prep work beyond just freezing the file system). A quick google search found this: http://callecalle.uach.cl/ovirt-engine/docs/manual/en_US/html/Technical_Guide/QEMU_Guest_Agent_Overview.html Sadly, it didn't spell out the name of where you install hook scripts into the guest. But this commit is pretty telling: https://github.com/qemu/qemu/blob/master/scripts/qemu-guest-agent/fsfreeze-hook -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
On Wednesday 29 October 2014 13:29:25 Eric Blake wrote:> On 10/29/2014 01:07 PM, Thomas Stein wrote: > > About the --quiesce option. Do i need to do something inside the vm? The > > most commonly would probably be a sql server running inside the vm. Do i > > need to tell the sql server something about the --quiesce option i use? I > > read this article here which suggests such a procedure. Okay, it's > > vmware, but... Is that right? > > For --quiesce to work, you have to have qemu-guest-agent installed and > running in your guest, and also inform libvirt via the domain XML to > establish a channel to the guest agent. Furthermore, if you want your > sql database to be at a stable point, you can install freeze hooks in > your guest that get invoked prior to freezing the file system and just > after thawing it (that is, qemu-guest-agent already has documented hooks > that let you do any additional prep work beyond just freezing the file > system). > > A quick google search found this: > http://callecalle.uach.cl/ovirt-engine/docs/manual/en_US/html/Technical_Guid > e/QEMU_Guest_Agent_Overview.html > > Sadly, it didn't spell out the name of where you install hook scripts > into the guest. But this commit is pretty telling: > https://github.com/qemu/qemu/blob/master/scripts/qemu-guest-agent/fsfreeze-h > ookThank you very much Eric. The hole thing now raises a few more questions. But maybe i will ask them later. :-) cheers t.
> > A quick google search found this: > > http://callecalle.uach.cl/ovirt-engine/docs/manual/en_US/html/Technical_Gu > > id e/QEMU_Guest_Agent_Overview.html > > > > Sadly, it didn't spell out the name of where you install hook scripts > > into the guest. But this commit is pretty telling: > > https://github.com/qemu/qemu/blob/master/scripts/qemu-guest-agent/fsfreeze > > -h ookAfter a little bit of fiddling i've got this running. Here is what's neccessary in case someone wanna try this too. qemu-guest.-agent has to run with the option: "-F /etc/qemu/fsfreeze-hook". This file contains as pointed out by Eric: https://github.com/qemu/qemu/blob/master/scripts/qemu-guest-agent/fsfreeze-hook Then you need to have a directory called /etc/qemu/fsfreeze-hook.d. Inside this directory this mysql-flush script: https://github.com/qemu/qemu/blob/master/scripts/qemu-guest-agent/fsfreeze-hook.d/mysql-flush.sh.sample I had to adjust this script a little for mariadb 10.0.14. But after that everything works as expected. Here the output: Sun 2 Nov 13:46:14 CET 2014: execute /etc/qemu/fsfreeze-hook.d/mysql-flush freeze + MYSQL='mysql -uroot -ppassword' + FIFO=/tmp/mysql-flush.fifo + case "$1" in + mkfifo /tmp/mysql-flush.fifo + flush_and_wait + printf 'FLUSH TABLES WITH READ LOCK \G\n' + mysql -uroot -ppassword + read ++ echo 'SHOW STATUS LIKE "Key_blocks_not_flushed"' ++ mysql -uroot -ppassword ++ tail -1 ++ cut -f 2 + '[' 0 -gt 0 ']' ++ mktemp /tmp/mysql-flush.XXXXXX + INNODB_STATUS=/tmp/mysql-flush.eTdvA4 + '[' 0 -ne 0 ']' + trap 'rm -f /tmp/mysql-flush.eTdvA4' SIGINT + : + printf 'SHOW ENGINE INNODB STATUS \G' + mysql -uroot -ppassword ++ grep 'Log sequence number' /tmp/mysql-flush.eTdvA4 tr -s ' ' ++ cut '-d ' -f4 + LOG_CURRENT=12242169543 ++ grep 'Log flushed up to' /tmp/mysql-flush.eTdvA4 tr -s ' ' ++ cut '-d ' -f7 + LOG_FLUSHED=12242169543 + '[' 12242169543 = 12242169543 ']' + break + rm -f /tmp/mysql-flush.eTdvA4 Sun 2 Nov 13:46:14 CET 2014: /etc/qemu/fsfreeze-hook.d/mysql-flush finished with status=0 Sun 2 Nov 13:46:14 CET 2014: execute /etc/qemu/fsfreeze-hook.d/mysql-flush thaw + MYSQL='mysql -uroot -ppassword' + FIFO=/tmp/mysql-flush.fifo + case "$1" in + '[' '!' -p /tmp/mysql-flush.fifo ']' + echo + rm -f /tmp/mysql-flush.fifo + printf 'UNLOCK TABLES \G\n' Sun 2 Nov 13:46:14 CET 2014: /etc/qemu/fsfreeze-hook.d/mysql-flush finished with status=0 Just to be sure i activated the general.log for mysql: 141102 13:46:14 6 Connect root@localhost as anonymous on 6 Query select @@version_comment limit 1 6 Query FLUSH TABLES WITH READ LOCK 7 Connect root@localhost as anonymous on 7 Query select @@version_comment limit 1 7 Query SHOW STATUS LIKE "Key_blocks_not_flushed" 7 Quit 8 Connect root@localhost as anonymous on 8 Query select @@version_comment limit 1 8 Query SHOW ENGINE INNODB STATUS 8 Quit 6 Query UNLOCK TABLES 6 Quit Nice! cheers t.