]> git.proxmox.com Git - pve-ha-manager.git/commit
fix #1073: do not count backup-suspended VMs as running
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Aug 2017 08:15:49 +0000 (10:15 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 23 Aug 2017 08:29:33 +0000 (10:29 +0200)
commitbc2a9d18db0b31bb64f5384b13b811fd3223bb4c
tree0c5abe869035cbd42bededd1022cb34c0f2497bd
parent95ebe188398c0d219e0f1c3e6ba87fb554ecc826
fix #1073: do not count backup-suspended VMs as running

when a stopped VM managed by HA got backuped the HA stack
continuously tried to shut it down as check_running returns only if a
PID for the VM exists.
As the VM was locked the shutdown tries were blocked, but still a lot
of annoying messages and task spawns happened during the backup
period.

As querying the VM status through the vm monitor is not cheap, check
if the VM is locked with the backup lock first, the config is cached
and so this is quite cheap, only then query the VMs status over qmp,
and check if the VM is in the 'prelaunch' state.
This state gets only set if KVM was started with the `-S` option and
has not yet continued guest operation.

Some performance results, I repeated each check 1000 times, first
number is the total time spent just with the check, second time is
the the time per single check:

old check (vm runs):            87.117 ms/total =>  87.117 us/loop
new check (runs, no backup):   107.744 ms/total => 107.744 us/loop
new check (runs, backup):      760.337 ms/total => 760.337 us/loop

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/Resources/PVEVM.pm