Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ATMOSPHERE-165] fix manila share mount use device name issue #2182

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From 6c401bff32e4dc82e26d31081285df528921aff0 Mon Sep 17 00:00:00 2001
From: Yaguang Tang <[email protected]>
Date: Thu, 5 Dec 2024 23:43:11 +0800
Subject: [PATCH] fix manila to use device uuid instead of name for mounting

Closes-bug: #2091102

Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
---
manila/share/drivers/generic.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/manila/share/drivers/generic.py b/manila/share/drivers/generic.py
index d7f08a058..140d8dc7c 100644
--- a/manila/share/drivers/generic.py
+++ b/manila/share/drivers/generic.py
@@ -286,7 +286,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
return True
return False

- def _add_mount_permanently(self, share_id, server_details):
+ def _add_mount_permanently(self, share_id, device_path, server_details):
"""Add mount permanently for mounted filesystems."""
try:
self._ssh_exec(
@@ -294,6 +294,16 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
['grep', share_id, const.MOUNT_FILE_TEMP,
'|', 'sudo', 'tee', '-a', const.MOUNT_FILE],
)
+ output, __ = self._ssh_exec(
+ server_details,
+ ['lsblk', '-o', 'uuid', '-n', device_path])
+ if output:
+ device_uuid = f"UUID={output.strip()}"
+ self._ssh_exec(
+ server_details,
+ ['sudo', 'sed', '-i', "s@{}@{}@".format(device_path,
+ device_uuid), const.MOUNT_FILE]
+ )
except exception.ProcessExecutionError as e:
LOG.error("Failed to add 'Share-%(share_id)s' mount "
"permanently on server '%(instance_id)s'.",
@@ -363,7 +373,7 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
'&&', 'sudo', 'mount', device_path, mount_path,
)
self._ssh_exec(server_details, mount_cmd)
- self._add_mount_permanently(share.id, server_details)
+ self._add_mount_permanently(share.id, device_path, server_details)
else:
LOG.warning("Mount point '%(path)s' already exists on "
"server '%(server)s'.", log_data)
--
2.39.5 (Apple Git-154)

Loading