On backup run a command before and after snapshot to lock mysql db inside VM

I think you did not understand my suggestion.
...
Qga was created to do precisely what I am suggesting to ensure systems can be backed up cleanly like you desire.

THANK YOU! I'll try to do that!

P.S. Sorry for missing the pint fist time!
 
Unlucky me, I can't see qma working while standard PVE backup.

I have "agent: 1" line in VM's .conf file, and I see VM started with qga support (note the bold chars):

/usr/bin/kvm -id 403 -chardev socket,id=qmp,path=/var/run/qemu-server/403.qmp,server,nowait -mon chardev=qmp,mode=control -vnc unix:/var/run/qemu-server/403.vnc,x509,password -pidfile /var/run/qemu-server/403.pid -daemonize -smbios type=1,uuid=358cbdd4-9579-4b82-9439-fc178ed03950 -name mysql-proxy -smp sockets=1,cores=1 -nodefaults -boot menu=on -vga cirrus -cpu kvm64,+lahf_lm,+x2apic,+sep -k en-us -m 512 -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2 -chardev socket,path=/var/run/qemu-server/403.qga,server,nowait,id=qga0 -device virtio-serial,id=qga0,bus=pci.0,addr=0x8 -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -iscsi initiator-name=iqn.1993-08.org.debian:01:5f58918b684f -drive if=none,id=drive-ide2,media=cdrom,aio=native -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200 -drive file=/var/lib/vz/images/403/vm-403-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,aio=native,cache=none -device virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=100 -netdev type=tap,id=net0,ifname=tap403i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown -device e1000,mac=56:DF:99:D5:7C:A5,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300

and I also can do something like:

root@proxmox:~# socat unix-connect:/var/run/qemu-server/403.qga stdin
{"execute": "guest-info"}
{"return": {"version": "2.1.0", "supported_commands": [{"enabled": true, "name": "guest-set-vcpus", "success-response": true}, {"enabled": true, "name": "guest-get-vcpus", "success-response": true}, {"enabled": true, "name": "guest-network-get-interfaces", "success-response": true}, {"enabled": true, "name": "guest-suspend-hybrid", "success-response": false}, {"enabled": true, "name": "guest-suspend-ram", "success-response": false}, {"enabled": true, "name": "guest-suspend-disk", "success-response": false}, {"enabled": true, "name": "guest-fstrim", "success-response": true}, {"enabled": true, "name": "guest-fsfreeze-thaw", "success-response": true}, {"enabled": true, "name": "guest-fsfreeze-freeze", "success-response": true}, {"enabled": true, "name": "guest-fsfreeze-status", "success-response": true}, {"enabled": true, "name": "guest-file-flush", "success-response": true}, {"enabled": true, "name": "guest-file-seek", "success-response": true}, {"enabled": true, "name": "guest-file-write", "success-response": true}, {"enabled": true, "name": "guest-file-read", "success-response": true}, {"enabled": true, "name": "guest-file-close", "success-response": true}, {"enabled": true, "name": "guest-file-open", "success-response": true}, {"enabled": true, "name": "guest-shutdown", "success-response": false}, {"enabled": true, "name": "guest-info", "success-response": true}, {"enabled": true, "name": "guest-set-time", "success-response": true}, {"enabled": true, "name": "guest-get-time", "success-response": true}, {"enabled": true, "name": "guest-ping", "success-response": true}, {"enabled": true, "name": "guest-sync", "success-response": true}, {"enabled": true, "name": "guest-sync-delimited", "success-response": true}]}}
...etc...

so it appears everything is ok. And I also see in the VM logs:

Jul 9 15:36:49 virt1 qemu-ga: info: guest-fsfreeze called
Jul 9 15:36:49 virt1 qemu-ga: info: executing fsfreeze hook with arg 'freeze'
Jul 9 15:37:00 virt1 qemu-ga: info: executing fsfreeze hook with arg 'thaw'

so the communication is fine.

But as PVE start its backup process no qga invocation is seen: neither in PVE vzdump logs, nor in VM logs.

What should I do now? We use PVE 3.3-1, but I don't think upgrading to 3.4 will solve this thing.
 
Upgrade, functionality you desire was added in 3.4 according to the roadmap:
http://pve.proxmox.com/wiki/Roadmap#Proxmox_VE_3.4

Unlucky me again, we stuck with 3.3 due to kind of instability we faced in 3.4. Once we already upgraded a test server from 3.3 to 3.4 but we were unsatisfied with the result. We decided to wait for 3.5 and test again.

But I suspect this is due to kernel and binary PVE utils (zfs support etc.) - I really wonder if it is possible to update only scripts? What package may this be to upgrade, by any chance?
 
But as PVE start its backup process no qga invocation is seen: neither in PVE vzdump logs, nor in VM logs.

May be I was not clear enough!
qga will only freeze the fs when you make a snapshot not a backup and also not if you make a backup in snapshot-mode.
This is not implemented.
 
May be I was not clear enough!
qga will only freeze the fs when you make a snapshot not a backup and also not if you make a backup in snapshot-mode.
This is not implemented.

Oh, sad to know that. So,

I can use qga (say, for flush mysql as per link I was given above) but it 1) will work since 3.4 and 2) will work only on qm snapshot, not on backup.

That is, all I can do is quietly ignore nice featurs of qga and try to create such a shell script:

ssh user@mysqlserver freeze_mysql
vzdump .... --script 'remote_unfreeze_mysql.pl'


where remote_unfreeze_mysql.pl will execure ssh user@mysqlserver unfreeze_mysql on event name 'pre-restart'. In this example freeze_mysql and unfreeze_mysql are some scripts that can stabilize mysql (as a quick example, simple stop it in freeze... and start it in unfreeze...), these scripts are on mysql server VM. remote_unfreeze_mysql.pl is local (on PVE) script that issue 'unfreeze...' over ssh.

A bit messy to explain, sorry, but what would you tell, it this will work?
 
qga will only freeze the fs when you make a snapshot not a backup and also not if you make a backup in snapshot-mode.
This is not implemented.
That's strange. I'm using proxmox 3.4 and tested qga with an ubuntu 14.04 vm. When starting a backup in snapshot-mode, guest-fsfreeze is invoked according to syslog of guest vm:
qemu-ga: info: guest-fsfreeze called
qemu-ga: info: executing fsfreeze hook with arg 'freeze'
qemu-ga: info: executing fsfreeze hook with arg 'thaw'

Wolfgang, doesn't this contradict your statement?
 
I checked the code and I released that I implement this last year :)
shame on me.
alexc forget what i tell you before the backup and qga!
 
Oh, thanks! ))

My problem is, we stuck with 3.3 (test for 3.4 given some unstable results so we decided to wait for 3.4+). I can't "just upgrade" server so I have to play with 3.3. So, may I somehow upgrade scripts (not the kernel) of PVE so this functions will be available to my scripts?

The topic of fs and software freezing/flushing is land unknown for many users while it is pretty convenient way to do really amazing thing. Hope I'll be able to create such a miracle now (of course with your help)!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!