[node-patches] Change in ovirt-node[master]: mount_config: Add support for symbolic links
asegurap at redhat.com
asegurap at redhat.com
Fri Jun 20 22:12:28 UTC 2014
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: mount_config: Add support for symbolic links
......................................................................
mount_config: Add support for symbolic links
Up until now, symbolic links used to be treated like regular files
(just as directories were before the preceding patch of the branch).
This meant that trying to restore a persisted symlink would try to
bind mount whatever the symbolic link was pointing at originally.
However, some application might rely on a symbolic link being a
symbolic link and not whatever that symbolic link was pointing at.
With this patch, if we persisted a symbolic link as:
/config/files:
/absolute/path/to/the/symbolic/link
/config/absolute/path/to/the/symbolic/link linking to:
/absolute/path/to/target/of/symbolic/link
we'll get
/absolute/path/to/the/symbolic/link linking to:
/absolute/path/to/target/of/symbolic/link
Once the persist is fixed for symbolic links, it will behave like
file persistence does now, you should call persist after changes
to the link.
Change-Id: I8e009e3039b2df80d57e60460d6cc888a91f7577
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M scripts/ovirt-functions.in
1 file changed, 11 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/11/29011/1
diff --git a/scripts/ovirt-functions.in b/scripts/ovirt-functions.in
index acdd43a..b4c7560 100644
--- a/scripts/ovirt-functions.in
+++ b/scripts/ovirt-functions.in
@@ -385,13 +385,19 @@
# skip if already bind-mounted
true
else
- if [ -d "/config/$f" ]; then
- mkdir -p "$f"
+ if [ -h "/config/$f" ]; then
+ # Instead of mount binding, just redo the link, as symlinks
+ # can't be bind mounted.
+ ln -s "$(readlink "/config/$f")" "$f"
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
- mount -n --bind "/config/$f" "$f"
fi
done
--
To view, visit http://gerrit.ovirt.org/29011
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e009e3039b2df80d57e60460d6cc888a91f7577
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