def move_mount(
+ dev,
path,
cluster,
osd_id,
'{cluster}-{osd_id}'.format(cluster=cluster, osd_id=osd_id),
)
maybe_mkdir(osd_data)
+
+ # we really want to mount --move, but that is not supported when
+ # the parent mount is shared, as it is by default on RH, Fedora,
+ # and probably others. Also, --bind doesn't properly manipulate
+ # /etc/mtab, which *still* isn't a symlink to /proc/mounts despite
+ # this being 2013. Instead, mount the original device at the final
+ # location.
subprocess.check_call(
args=[
'/bin/mount',
- '--move',
'--',
- path,
+ dev,
osd_data,
],
)
+ subprocess.check_call(
+ args=[
+ '/bin/umount',
+ '-l', # lazy, in case someone else is peeking at the
+ # wrong moment
+ '--',
+ path,
+ ],
+ )
def start_daemon(
raise Error('another %s osd.%s already mounted in position (old/different cluster instance?); unmounting ours.' % (cluster, osd_id))
else:
move_mount(
+ dev=dev,
path=path,
cluster=cluster,
osd_id=osd_id,