Nir Soffer has uploaded a new change for review.

Change subject: muiltipath: Unbreak configure on ovirt node
......................................................................

muiltipath: Unbreak configure on ovirt node

In commit commit 4d51f0df2d (multipath: Write multipath.conf atomically)
we replaced file copy with rename. This make the operation atomic but it
does not work on ovirt node, because multipath.conf is a bind mount.

On ovirt node we cannot do atomic rename; we must unpersist the
multipath.conf before the rename and persist it after the rename. If we
crash after unpersisting and before persisting multipath.conf will be
missing after a reboot. We can do nothing about this.

Other platforms are not effected since utils.unpersist() and
utils.persit() do nothing on other platforms.

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/97/46397/1

diff --git a/lib/vdsm/tool/configurators/multipath.py 
b/lib/vdsm/tool/configurators/multipath.py
index 65b6521..9aa8afd 100644
--- a/lib/vdsm/tool/configurators/multipath.py
+++ b/lib/vdsm/tool/configurators/multipath.py
@@ -121,12 +121,14 @@
             f.write(_CONF_DATA)
             f.flush()
             os.chmod(f.name, 0o644)
+            # On ovirt node multipath.conf is a bind mount and rename will fail
+            # if we do not unpersist first, making this non-atomic.
+            utils.unpersist(_CONF_FILE)
             os.rename(f.name, _CONF_FILE)
+            utils.persist(_CONF_FILE)
         except:
             os.unlink(f.name)
             raise
-
-    utils.persist(_CONF_FILE)
 
     # Flush all unused multipath device maps
     utils.execCmd([constants.EXT_MULTIPATH, "-F"])


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83822494dd1c98105aac081df0bdf4ec2e39a548
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