mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-26 01:37:04 +00:00
Re-introduce code that identifies already-mounted rootfs
This commit is contained in:
@@ -41,18 +41,19 @@ class MountManager(object):
|
||||
def mount(self, device, directory, mode='r', timeout=5):
|
||||
|
||||
mountargs = [ str(mode) ]
|
||||
current = self.is_mounted(device, directory)
|
||||
if current:
|
||||
currentItems = [x for x in self.mounts.iteritems() if x[1]['dev'] == device]
|
||||
if currentItems:
|
||||
currentDirectory, current = currentItems[0]
|
||||
if current['mode'] == mode:
|
||||
# Already mounted as requested.
|
||||
self.logger.debug("%s already mounted @ %s with mode %s. Doing nothing." % (device, directory, mode))
|
||||
return True
|
||||
elif device == current['dir']:
|
||||
elif directory != currentDirectory:
|
||||
# Already mounted, at a different location (e.g. '/'), but not in the requested mode.
|
||||
self.logger.debug("%s mounted @ %s (%s) with mode %s. It will be remounted %s.",
|
||||
device, directory, current['dir'], current['mode'], mode)
|
||||
device, directory, currentDirectory, current['mode'], mode)
|
||||
mountargs.append('remount')
|
||||
directory = current['dir']
|
||||
directory = currentDirectory
|
||||
else:
|
||||
# Already mounted, but not in the requested mode.
|
||||
self.logger.debug("%s mounted @ %s with mode %s. It will be remounted %s." % (device, directory, current['mode'], mode))
|
||||
|
||||
Reference in New Issue
Block a user