mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-04 03:52:25 +00:00
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:
parent
cda95d5223
commit
bda0ebff2d
@ -485,8 +485,9 @@ sub prepare_pci_device {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $PCIID_RESERVATION_FILE = "/var/run/pve-reserved-pciids";
|
my $RUNDIR = '/run/qemu-server';
|
||||||
my $PCIID_RESERVATION_LCK = "/var/lock/pve-reserved-pciids.lck";
|
my $PCIID_RESERVATION_FILE = "${RUNDIR}/pci-id-reservations";
|
||||||
|
my $PCIID_RESERVATION_LOCK = "${PCIID_RESERVATION_FILE}.lock";
|
||||||
|
|
||||||
my $parse_pci_reservation_unlocked = sub {
|
my $parse_pci_reservation_unlocked = sub {
|
||||||
my $pciids = {};
|
my $pciids = {};
|
||||||
@ -536,7 +537,7 @@ sub remove_pci_reservation {
|
|||||||
$write_pci_reservation_unlocked->($pciids);
|
$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 $@;
|
die $@ if $@;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -547,7 +548,7 @@ sub reserve_pci_usage {
|
|||||||
|
|
||||||
return if !scalar(@$ids); # do nothing for empty list
|
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 $ctime = time();
|
||||||
my $pciids = $parse_pci_reservation_unlocked->();
|
my $pciids = $parse_pci_reservation_unlocked->();
|
||||||
|
Loading…
Reference in New Issue
Block a user