Skip to content

Commit

Permalink
Fix XFS volumes from data source
Browse files Browse the repository at this point in the history
As mentioned in a CSI issue [1], XFS does not allow to mount two volumes
that have the same UUID on the same machine.

This is problematic when using a cloned volume or a restored snapshot -
the original volume and the new volume cannot be mounted on the same
compute node.

This patch fixes this issue by mounting XFS volumes with the "nouuid"
option, since regenerating the UUID requires mounting the volume on the
controller, and now the latest e2e tests [1] pass.

[1]: container-storage-interface/spec#482
[2]: kubernetes/kubernetes#102538
  • Loading branch information
Akrog committed Jan 25, 2022
1 parent b836012 commit 8753dca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ember_csi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ def __str__(self):

class NodeBase(IdentityBase):
STAGED_NAME = 'stage'
MOUNT_FS_FLAGS = {'xfs': ['nouuid']}

def __init__(self, server, persistence_config=None, ember_config=None,
node_id=None, storage_nw_ip=None, **kwargs):
Expand Down Expand Up @@ -901,9 +902,12 @@ def _mount(self, fs_type, mount_flags, private_bind, target):
# Mount must only be called if it's already not mounted
# We don't use the util-linux Python library to reduce dependencies
command = ['mount', '-t', fs_type]
flags = self.MOUNT_FS_FLAGS.get(fs_type, [])
if mount_flags:
flags.extend(mount_flags)
if flags:
command.append('-o')
command.append(','.join(mount_flags))
command.append(','.join(flags))
command.append(private_bind)
command.append(target)
self.sudo(*command)
Expand Down

0 comments on commit 8753dca

Please sign in to comment.