Skip to content

Commit fe2ecfa

Browse files
committed
fix(storage): session should own the storage after mounting
storage_mount() did not check/update storage_owner Signed-off-by: Cedric Hombourger <[email protected]>
1 parent 8bea658 commit fe2ecfa

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

mtda/main.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -779,20 +779,20 @@ def storage_mount(self, part=None, **kwargs):
779779

780780
session = kwargs.get("session", None)
781781
self.session_ping(session)
782-
if self.storage.is_storage_mounted is True:
783-
self.mtda.debug(4, "storage_mount(): already mounted")
784-
result = True
785-
elif self.storage is None:
786-
self.mtda.debug(4, "storage_mount(): no shared storage device")
787-
return False
788-
else:
782+
783+
if self.storage is None:
784+
raise RuntimeError('no shared storage device')
785+
elif self.storage.is_storage_mounted is True:
786+
raise RuntimeError("already mounted")
787+
elif self.storage_locked(session) is True:
788+
raise RuntimeError('shared storage in use')
789+
elif self.storage.to_host() is True:
789790
result = self.storage.mount(part)
790791
self._storage_mounted = (result is True)
791-
792-
if self.storage is not None:
792+
self._storage_owner = session
793793
self.storage_locked()
794794

795-
self.mtda.debug(3, f"main.storage_mount(): {str(result)}")
795+
self.mtda.debug(3, f"main.storage_mount(): {result}")
796796
return result
797797

798798
@Pyro4.expose

0 commit comments

Comments
 (0)