From 22447576c9cb7cf56b606badfbafd629e780f727 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 9 Jul 2021 11:29:46 +0200 Subject: [PATCH] Fix lockdir not taking the value of backupdir Thanks Claudio Kuenzler --- virt-backup | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/virt-backup b/virt-backup index 0daae51..4007c57 100644 --- a/virt-backup +++ b/virt-backup @@ -48,7 +48,7 @@ $opts{backupdir} = '/var/lib/libvirt/backup'; $opts{dumpcmd} = undef; # Lockdir is where locks will be held when backing up a VM. The default is to put the lock # in the backup dir of the VM, but in some situations, you want to put it elsewhere -$opts{lockdir} = $opts{backupdir}; +$opts{lockdir} = undef; # Size of LVM snapshots (which will be used to backup VM with minimum downtime # if the VM is backed by LVM). If the LVM volume is thinly provisionned (thinp) # this parameter will be ignored @@ -213,6 +213,8 @@ if (! -d $opts{backupdir} ){ exit 1; } +# If lockdir is not defined, take the same value as backupdir +$opts{lockdir} ||= $opts{backupdir}; # Lockdir, if defined, must also exist if (!-d $opts{lockdir}){ print "$opts{lockdir} doesn't exist\n";