pci reservation: move lock/reservation file into /run/qemu-server

lck needs to die, the days of any 8.3 file naming schemes are long
gone (in the server space that is ;)

/var/run is /run so use the shorter, and while /var/lock is a OK
place for the locks we try to keep lock and lock-object together
nowadays. The qemu-server sub-directory avoids overly cluttering the
already crowded top-level /run dir

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-10-15 17:02:21 +02:00
parent cda95d5223
commit bda0ebff2d

View File

@ -485,8 +485,9 @@ sub prepare_pci_device {
}
}
my $PCIID_RESERVATION_FILE = "/var/run/pve-reserved-pciids";
my $PCIID_RESERVATION_LCK = "/var/lock/pve-reserved-pciids.lck";
my $RUNDIR = '/run/qemu-server';
my $PCIID_RESERVATION_FILE = "${RUNDIR}/pci-id-reservations";
my $PCIID_RESERVATION_LOCK = "${PCIID_RESERVATION_FILE}.lock";
my $parse_pci_reservation_unlocked = sub {
my $pciids = {};
@ -536,7 +537,7 @@ sub remove_pci_reservation {
$write_pci_reservation_unlocked->($pciids);
};
PVE::Tools::lock_file($PCIID_RESERVATION_LCK, 10, $code);
PVE::Tools::lock_file($PCIID_RESERVATION_LOCK, 10, $code);
die $@ if $@;
return;
@ -547,7 +548,7 @@ sub reserve_pci_usage {
return if !scalar(@$ids); # do nothing for empty list
PVE::Tools::lock_file($PCIID_RESERVATION_LCK, 10, sub {
PVE::Tools::lock_file($PCIID_RESERVATION_LOCK, 10, sub {
my $ctime = time();
my $pciids = $parse_pci_reservation_unlocked->();