VM Backup and locks

cosycon

New Member
Oct 28, 2010
8
0
1
Hi, this is a known situation. If a VM is being backed-up (or being migrated or suffered from a power outtage), a lock is placed. If a backup has failed, the lock stays and can be 'removed' by executing 'qm unlock <vmid>'.
Now i have 2 questions:
1: Is there a way to determine if a VM is currently locked?
2: Is it safe to use a script that alway starts with a 'qm unlock <vmid>' command before starting the actual backup?

Of course, afterwards a check must be done to see if the backup has succeeded. I just want to increase the possibility of executing valid backups.

Thanks in advance.
 
1: Is there a way to determine if a VM is currently locked?

# egrep '^lock: backup$' /etc/qemu-server/<vmid>.conf;

2: Is it safe to use a script that alway starts with a 'qm unlock <vmid>' command before starting the actual backup?

no (another backup may be running). But is is safe to remove the lock at host startup.