[node-patches] Change in ovirt-node[master]: mount_config: fix non-default directory persistence

asegurap at redhat.com asegurap at redhat.com
Fri Jun 20 20:35:42 UTC 2014


Antoni Segura Puimedon has uploaded a new change for review.

Change subject: mount_config: fix non-default directory persistence
......................................................................

mount_config: fix non-default directory persistence

Currently mount_config fails to restore directories that are not
present in the original image of the root filesystem. E.g.

    mkdir -p /var/lib/vdsm/foobar/moo
    echo "123" > /var/lib/vdsm/foobar/moo/cow.txt
    persist /var/lib/vdsm/foobar

Then, after reboot, ovirt_start_early will call mount_config which
will result in
    mkdir -p /var/lib/vdsm
    touch foobar
    mount -n --bind /config/var/lib/vdsm/foobar /var/lib/vdsm/foobar

This will fail because one can't bind mount a directory on a file.

This patch fixes this issue.

Change-Id: Ifa2b854980ee28cce5d55e0faf30442e6c01a4b8
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M scripts/ovirt-functions.in
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/10/29010/1

diff --git a/scripts/ovirt-functions.in b/scripts/ovirt-functions.in
index 611acc3..acdd43a 100644
--- a/scripts/ovirt-functions.in
+++ b/scripts/ovirt-functions.in
@@ -385,8 +385,12 @@
                 # skip if already bind-mounted
                 true
             else
-                mkdir -p "$(dirname "$f")"
-                touch "$f"
+                if [ -d "/config/$f" ]; then
+                    mkdir -p "$f"
+                else
+                    mkdir -p "$(dirname "$f")"
+                    touch "$f"
+                fi
                 mount -n --bind "/config/$f" "$f"
             fi
         done


-- 
To view, visit http://gerrit.ovirt.org/29010
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa2b854980ee28cce5d55e0faf30442e6c01a4b8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>



More information about the node-patches mailing list