Bug 1575973 - fence_scsi duplicates entries in /var/run/cluster/fence_scsi.dev on attribute change
Summary: fence_scsi duplicates entries in /var/run/cluster/fence_scsi.dev on attribute...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: fence-agents
Version: 7.5
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Oyvind Albrigtsen
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-08 12:46 UTC by Ondrej Faměra
Modified: 2018-10-30 07:50 UTC (History)
3 users (show)

Fixed In Version: fence-agents-4.0.11-89.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 07:49:52 UTC
Target Upstream Version:


Attachments (Terms of Use)
proposed patch to fix the issue (387 bytes, patch)
2018-05-08 12:46 UTC, Ondrej Faměra
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Github ClusterLabs fence-agents pull 203 0 None None None 2018-05-09 09:27:54 UTC
Red Hat Knowledge Base (Solution) 3435851 0 None None None 2018-05-08 13:16:09 UTC
Red Hat Product Errata RHBA-2018:3031 0 None None None 2018-10-30 07:50:13 UTC

Description Ondrej Faměra 2018-05-08 12:46:39 UTC
Created attachment 1433197 [details]
proposed patch to fix the issue

== Description of problem:
When fence_scsi stonith device configuration is updated the content of '/var/run/cluster/fence_scsi.dev'
gets partially duplicated and grows over time.

== Version-Release number of selected component (if applicable):
fence-agents-scsi-4.0.11-86.el7.x86_64

== How reproducible:
always

== Steps to Reproduce:
1. Create fence_scsi stonith device in pacemaker cluster with at least 2 devices in 'device' attribute
  # pcs stonith create scsi fence_scsi devices="/dev/sdb,/dev/sdc"
2. Update the 'scsi' stonith device by adding a new disk to list
  # pcs stonith update scsi devices="/dev/sdb,/dev/sdc,/dev/sdd"

== Actual results:
Content of the file '/var/run/cluster/fence_scsi.dev'
# cat /var/run/cluster/fence_scsi.dev
/dev/sdb
/dev/sdc
/dev/sdc
/dev/sdd

== Expected results:
Content of the file '/var/run/cluster/fence_scsi.dev'
# cat /var/run/cluster/fence_scsi.dev
/dev/sdb
/dev/sdc
/dev/sdd

== Additional info:
Running more updates results in more duplicate entries inside the file.

For example in above situation adding another disk would result in following content:
# pcs stonith update scsi devices="/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde"
# cat /var/run/cluster/fence_scsi.dev
/dev/sdb
/dev/sdc
/dev/sdc
/dev/sdd
/dev/sdc
/dev/sdd
/dev/sde

It seems that the function responsible for matching the device name doesn't match properly.
Applying following change to /usr/sbin/fence_scsi seems to resolve the problem and make the
devices to match properly.

--- /usr/sbin/fence_scsi	2018-02-07 16:53:44.000000000 +0100
+++ /usr/sbin/fence_scsi	2018-05-08 14:36:57.168000000 +0200
@@ -240,7 +240,7 @@
 	except IOError:
 		fail_usage("Failed: Cannot open file \""+ file_path + "\"")
 	out = f.read()
-	if not re.search(r"^" + dev + "\s+", out):
+	if not re.search(r"^" + dev + "\s+", out, flags=re.MULTILINE):
 		f.write(dev + "\n")
 	f.close()

Comment 7 errata-xmlrpc 2018-10-30 07:49:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3031


Note You need to log in before you can comment on or make changes to this bug.