Nir Soffer has uploaded a new change for review.

Change subject: multipath: Use more meaningful names
......................................................................

multipath: Use more meaningful names

Since we are in the context of the multipath module, the MPATH or
MPATH_CONF prefix is not helping. This patch hopefully make the code
nicer to work with.

Change-Id: I4361dcf28a2a3b5ccba1eb0bf747b81758de5862
Signed-off-by: Nir Soffer <[email protected]>
---
M lib/vdsm/tool/configurators/multipath.py
1 file changed, 16 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/61/44861/1

diff --git a/lib/vdsm/tool/configurators/multipath.py 
b/lib/vdsm/tool/configurators/multipath.py
index 5ad0840..f63b90d 100644
--- a/lib/vdsm/tool/configurators/multipath.py
+++ b/lib/vdsm/tool/configurators/multipath.py
@@ -32,11 +32,11 @@
 from ... import constants
 
 
-_MPATH_CONF = "/etc/multipath.conf"
+_CONF_FILE = "/etc/multipath.conf"
 
-_MPATH_CONF_TAG = "# VDSM REVISION 1.2"
+_CURRENT_TAG = "# VDSM REVISION 1.2"
 
-_MPATH_CONF_DATA = """\
+_CONF_DATA = """\
 %(current_tag)s
 
 defaults {
@@ -86,7 +86,7 @@
 #      no_path_retry           fail
 # }
 
-""" % {"current_tag": _MPATH_CONF_TAG}
+""" % {"current_tag": _CURRENT_TAG}
 
 # conf file configured by vdsm should contain a tag
 # in form of "RHEV REVISION X.Y"
@@ -99,8 +99,8 @@
 # Having the PRIVATE_TAG in the conf file means
 # vdsm-tool should never change the conf file
 # even when using the --force flag
+_PRIVATE_TAG = "# VDSM PRIVATE"
 _OLD_PRIVATE_TAG = "# RHEV PRIVATE"
-_MPATH_CONF_PRIVATE_TAG = "# VDSM PRIVATE"
 
 # If multipathd is up, it will be reloaded after configuration,
 # or started before vdsm starts, so service should not be stopped
@@ -114,21 +114,21 @@
     supported state. The original configuration, if any, is saved
     """
 
-    if os.path.exists(_MPATH_CONF):
-        backup = _MPATH_CONF + '.' + time.strftime("%Y%m%d%H%M")
-        shutil.copyfile(_MPATH_CONF, backup)
+    if os.path.exists(_CONF_FILE):
+        backup = _CONF_FILE + '.' + time.strftime("%Y%m%d%H%M")
+        shutil.copyfile(_CONF_FILE, backup)
         utils.persist(backup)
 
     with tempfile.NamedTemporaryFile() as f:
-        f.write(_MPATH_CONF_DATA)
+        f.write(_CONF_DATA)
         f.flush()
         cmd = [constants.EXT_CP, f.name,
-               _MPATH_CONF]
+               _CONF_FILE]
         rc, out, err = utils.execCmd(cmd)
 
         if rc != 0:
             raise RuntimeError("Failed to perform Multipath config.")
-    utils.persist(_MPATH_CONF)
+    utils.persist(_CONF_FILE)
 
     # Flush all unused multipath device maps
     utils.execCmd([constants.EXT_MULTIPATH, "-F"])
@@ -150,26 +150,26 @@
     should be preserved at all cost.
     """
 
-    if os.path.exists(_MPATH_CONF):
+    if os.path.exists(_CONF_FILE):
         first = second = ''
-        with open(_MPATH_CONF) as f:
+        with open(_CONF_FILE) as f:
             mpathconf = [x.strip("\n") for x in f.readlines()]
         try:
             first = mpathconf[0]
             second = mpathconf[1]
         except IndexError:
             pass
-        if _MPATH_CONF_PRIVATE_TAG in second or _OLD_PRIVATE_TAG in second:
+        if _PRIVATE_TAG in second or _OLD_PRIVATE_TAG in second:
             sys.stdout.write("Manual override for multipath.conf detected"
                              " - preserving current configuration\n")
-            if _MPATH_CONF_TAG not in first:
+            if _CURRENT_TAG not in first:
                 sys.stdout.write("This manual override for multipath.conf "
                                  "was based on downrevved template. "
                                  "You are strongly advised to "
                                  "contact your support representatives\n")
             return YES
 
-        if _MPATH_CONF_TAG in first:
+        if _CURRENT_TAG in first:
             sys.stdout.write("Current revision of multipath.conf detected,"
                              " preserving\n")
             return YES


-- 
To view, visit https://gerrit.ovirt.org/44861
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4361dcf28a2a3b5ccba1eb0bf747b81758de5862
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to