-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix manila share mount use device name issue
- Loading branch information
1 parent
cfea8c4
commit 1a5f081
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
images/manila/patches/0001-fix-manila-to-use-device-uuid-instead-of-name-for-mo.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|