]> git.proxmox.com Git - qemu-server.git/commitdiff
pci reservation: move lock/reservation file into /run/qemu-server
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 Oct 2021 15:02:21 +0000 (17:02 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 Oct 2021 16:17:34 +0000 (18:17 +0200)
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>
PVE/QemuServer/PCI.pm

index 31363688e0a0d267823e6a47aadd1fc7edeabde6..ebb50ec3dd3438b2d88bc66995cb8df30313ed90 100644 (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->();