I have a VM that has a snippet configured with pre-start and post-stop actions. The VM is currently stopped. When my backup job runs (which includes all VMs & containers), the pre-start action in the snippet is executed. Is this intentional? How do I distinguish between pre-start due to backup vs actually starting the VM/container?
Some background on this particular job - I ran Proxmox Backup Server in a VM, then decided to try it in LXC. The snippet imports the backup pool on pre-start, then exports it on post-stop (allowing for hot-swap of backup drives). The snippet fails while backing up the deprecated, stopped VM in this case because the pool cannot be exported/imported since the new PBS container is running with a bind mount to it.
Code:
INFO: Starting Backup of VM 104 (qemu)
INFO: Backup started at 2021-04-06 22:13:45
INFO: status = stopped
INFO: backup mode: stop
INFO: ionice priority: 7
INFO: VM Name: pbs1-vm
INFO: include disk 'scsi0' 'vm-prod:vm-104-disk-0' 8G
INFO: creating vzdump archive '/var/lib/vz/dump/vzdump-qemu-104-2021_04_06-22_13_45.vma.zst'
INFO: starting kvm to execute backup task
ZPOOL MOUNT HOOK: 104 pre-start
104 is starting, mounting zpool 'backup'.
cannot export 'backup': pool is busy
cannot import 'backup': a pool with that name already exists
use the form 'zpool import <pool | id> <newpool>' to give it a new name
zpool import failed with error: 256
ERROR: Backup of VM 104 failed - hookscript error for 104 on pre-start: command '/var/lib/vz/snippets/backup-hook.pl 104 pre-start' failed: exit code 1
INFO: Failed at 2021-04-06 22:13:47
Some background on this particular job - I ran Proxmox Backup Server in a VM, then decided to try it in LXC. The snippet imports the backup pool on pre-start, then exports it on post-stop (allowing for hot-swap of backup drives). The snippet fails while backing up the deprecated, stopped VM in this case because the pool cannot be exported/imported since the new PBS container is running with a bind mount to it.