5
0
mirror of git://git.proxmox.com/git/pve-guest-common.git synced 2024-12-27 03:21:36 +03:00
pve-guest-common/PVE/GuestHelpers.pm

27 lines
454 B
Perl

package PVE::GuestHelpers;
use strict;
use warnings;
use PVE::Tools;
# We use a separate lock to block migration while a replication job
# is running.
our $lockdir = '/var/lock/pve-manager';
sub guest_migration_lock {
my ($vmid, $timeout, $func, @param) = @_;
my $lockid = "pve-migrate-$vmid";
mkdir $lockdir;
my $res = PVE::Tools::lock_file("$lockdir/$lockid", $timeout, $func, @param);
die $@ if $@;
return $res;
}
1;