[PATCH pve-cluster] tree-wide: change /var/run to /run and /var/lock to /run/lock

Jing Luo jing at jing.rocks
Sat Mar 22 16:17:13 CET 2025


"/var/run" and "/var/lock" are deprecated.

This is to comply with Debian Policy 9.1.4 "/run and /run/lock".
(https://www.debian.org/doc/debian-policy/ch-opersys.html#run-and-run-lock)

Signed-off-by: Jing Luo <jing at jing.rocks>
---
 src/PVE/API2/ClusterConfig.pm | 4 ++--
 src/PVE/CLI/pvecm.pm          | 2 +-
 src/PVE/RRD.pm                | 4 ++--
 src/pmxcfs/cfs-utils.h        | 2 +-
 src/pmxcfs/status.c           | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/PVE/API2/ClusterConfig.pm b/src/PVE/API2/ClusterConfig.pm
index e7efe37..327e34d 100644
--- a/src/PVE/API2/ClusterConfig.pm
+++ b/src/PVE/API2/ClusterConfig.pm
@@ -20,7 +20,7 @@ use base qw(PVE::RESTHandler);
 
 my $clusterconf = "/etc/pve/corosync.conf";
 my $authfile = "/etc/corosync/authkey";
-my $local_cluster_lock = "/var/lock/pvecm.lock";
+my $local_cluster_lock = "/run/lock/pvecm.lock";
 
 my $nodeid_desc = {
     type => 'integer',
@@ -677,7 +677,7 @@ __PACKAGE__->register_method ({
 	my ($param) = @_;
 
 	my $result = {};
-	my $socket_path = "/var/run/corosync-qdevice/corosync-qdevice.sock";
+	my $socket_path = "/run/corosync-qdevice/corosync-qdevice.sock";
 	return $result if !-S $socket_path;
 
 	my $qdevice_socket = IO::Socket::UNIX->new(
diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
index cc8b3d3..09e6a3f 100755
--- a/src/PVE/CLI/pvecm.pm
+++ b/src/PVE/CLI/pvecm.pm
@@ -377,7 +377,7 @@ __PACKAGE__->register_method ({
 		delete $param->{use_ssh};
 		$param->{password} = $password;
 
-		my $local_cluster_lock = "/var/lock/pvecm.lock";
+		my $local_cluster_lock = "/run/lock/pvecm.lock";
 		PVE::Tools::lock_file($local_cluster_lock, 10, \&PVE::Cluster::Setup::join, $param);
 
 		if (my $err = $@) {
diff --git a/src/PVE/RRD.pm b/src/PVE/RRD.pm
index 5d4abc9..d98d219 100644
--- a/src/PVE/RRD.pm
+++ b/src/PVE/RRD.pm
@@ -33,7 +33,7 @@ sub create_rrd_data {
 	"-r" => $reso,
 	);
 
-    my $socket = "/var/run/rrdcached.sock";
+    my $socket = "/run/rrdcached.sock";
     push @args, "--daemon" => "unix:$socket" if -S $socket;
 
     my ($start, $step, $names, $data) = RRDs::fetch($rrd, $cf, @args);
@@ -101,7 +101,7 @@ sub create_rrd_graph {
 	"--lower-limit" => 0,
 	);
 
-    my $socket = "/var/run/rrdcached.sock";
+    my $socket = "/run/rrdcached.sock";
     push @args, "--daemon" => "unix:$socket" if -S $socket;
 
     my @coldef = ('#00ddff', '#ff0000');
diff --git a/src/pmxcfs/cfs-utils.h b/src/pmxcfs/cfs-utils.h
index eb86379..6cf5013 100644
--- a/src/pmxcfs/cfs-utils.h
+++ b/src/pmxcfs/cfs-utils.h
@@ -30,7 +30,7 @@
 #include <fcntl.h>
 
 #define HOST_CLUSTER_CONF_FN "/etc/corosync/corosync.conf"
-#define CFS_PID_FN "/var/run/pve-cluster.pid"
+#define CFS_PID_FN "/run/pve-cluster.pid"
 #define VARLIBDIR "/var/lib/pve-cluster"
 #define RUNDIR "/run/pve-cluster"
 
diff --git a/src/pmxcfs/status.c b/src/pmxcfs/status.c
index ff5fcc4..b9c202a 100644
--- a/src/pmxcfs/status.c
+++ b/src/pmxcfs/status.c
@@ -1244,7 +1244,7 @@ update_rrd_data(
 	g_return_if_fail(len > 0);
 	g_return_if_fail(len < 4096);
 
-	static const char *rrdcsock = "unix:/var/run/rrdcached.sock";
+	static const char *rrdcsock = "unix:/run/rrdcached.sock";
 
 	int use_daemon = 1;
         if (rrdc_connect(rrdcsock) != 0)
-- 
2.49.0





More information about the pve-devel mailing list