fence_scsi: move key file to /var/run/cluster
PATCH 1/2 fence_scsi: move key file to /var/run/cluster
Since the contents of /var/run/cluster/ directory are cleared on each reboot, move the fence_scsi.key file to that directory. This is useful for watchdog checks as a means to avoid watchdog reboots when a node has not yet unfenced or unfencing fails.
--- fence/agents/scsi/fence_scsi.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fence/agents/scsi/fence_scsi.pl +2 -2
@@ -342,7 +342,7 @@ sub key_read () my $self = (caller(0))[3]; my $key; - open (\*FILE, "</var/lib/cluster/fence_scsi.key") or die "$!\n"; + open (\*FILE, "</var/run/cluster/fence_scsi.key") or die "$!\n"; chomp ($key = <FILE>); close (FILE);
@@ -353,7 +353,7 @@ sub key_write ($) { my $self = (caller(0))[3]; - open (\*FILE, ">/var/lib/cluster/fence_scsi.key") or die "$!\n"; + open (\*FILE, ">/var/run/cluster/fence_scsi.key") or die "$!\n"; print FILE "$_[0]\n"; close (FILE);
Signature · 1 line
1.7.3.4
PATCH 1/2 fence_scsi: move key file to /var/run/cluster
Only one comment here, before attempting to read or write to /var/run/cluster, your script needs to make sure that the directory exists (same for the other patch).
/var/run/cluster is created only via cman init at the moment and if fence_scsi is used outside that context, it will fail on distribution where /var/run is on tmpfs and cluster/ does not exists.
some distributions are deploying methods to populate /var/run/some_dir_name at boot time, but they are not consistent enough to be trusted to behave all the same way yet.
Fabio
Quoted 32 lines · Ryan O'Hara
Since the contents of
/var/run/cluster/directory are cleared on each reboot, move the fence_scsi.key file to that directory. This is useful for watchdog checks as a means to avoid watchdog reboots when a node has not yet unfenced or unfencing fails.Signed-off-by Ryan O'Hara <[email protected]>--- fence/agents/scsi/fence_scsi.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)fence/agents/scsi/fence_scsi.pl +2
-2@@ -342,7 +342,7 @@ sub key_read () my $self = (caller(0))[3]; my $key; - open (\*FILE, "</var/lib/cluster/fence_scsi.key") or die "$!\n"; + open (\*FILE, "</var/run/cluster/fence_scsi.key") or die "$!\n"; chomp ($key = <FILE>); close (FILE);@@ -353,7 +353,7 @@ sub key_write ($) { my $self = (caller(0))[3]; - open (\*FILE, ">/var/lib/cluster/fence_scsi.key") or die "$!\n"; + open (\*FILE, ">/var/run/cluster/fence_scsi.key") or die "$!\n"; print FILE "$_[0]\n"; close (FILE);