Blob Blame History Raw
From 39eb1ed82067d6c720bff3be5af08acedd85ef04 Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Wed, 12 Aug 2015 15:08:30 +0200
Subject: [PATCH] fence_mpath: Fix unfencing problems when /var/run/cluster is
 removed and monitor these files

This patch solves same problem as 2f1be046c0c880ec14caff2193b4daa18bcecab7 and 5b3c2b26e5dfa4784d44ac875c7780495bacdde8
for fence_scsi.
---
 fence/agents/mpath/fence_mpath.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fence/agents/mpath/fence_mpath.py b/fence/agents/mpath/fence_mpath.py
index 6992dc7..2d1e218 100644
--- a/fence/agents/mpath/fence_mpath.py
+++ b/fence/agents/mpath/fence_mpath.py
@@ -26,6 +26,10 @@ def get_status(conn, options):
 		else:
 			logging.debug("No registration for key "\
 				+ options["--key"] + " on device " + dev + "\n")
+
+	if options["--action"] == "monitor":
+		dev_read(options)
+
 	return status
 
 
@@ -133,8 +137,8 @@ def get_registration_keys(options, dev):
 def dev_write(options, dev):
 	file_path = options["--store-path"] + "/mpath.devices"
 
-	if not os.path.isdir(os.path.dirname(options["--store-path"])):
-		os.makedirs(os.path.dirname(options["--store-path"]))
+	if not os.path.isdir(options["--store-path"]):
+		os.makedirs(options["--store-path"])
 
 	try:
 		store_fh = open(file_path, "a+")
@@ -203,7 +207,7 @@ def main():
 	atexit.register(atexit_handler)
 
 	device_opt = ["no_login", "no_password", "devices", "key", "sudo", \
-	        "fabric_fencing", "on_target", "store_path", "mpathpersist_path"]
+	        "fabric_fencing", "on_target", "store_path", "mpathpersist_path", "force_on"]
 
 	define_new_opts()
 
-- 
1.9.3