MCPcopy Create free account
hub / github.com/ceph/ceph / mount_osd_data

Function mount_osd_data

qa/tasks/ceph_manager.py:148–185  ·  view source on GitHub ↗

Mount a remote OSD :param ctx: Context :param remote: Remote site :param cluster: name of ceph cluster :param osd: Osd name

(ctx, remote, cluster, osd)

Source from the content-addressed store, hash-verified

146
147
148def mount_osd_data(ctx, remote, cluster, osd):
149 """
150 Mount a remote OSD
151
152 :param ctx: Context
153 :param remote: Remote site
154 :param cluster: name of ceph cluster
155 :param osd: Osd name
156 """
157 log.debug('Mounting data for osd.{o} on {r}'.format(o=osd, r=remote))
158 role = "{0}.osd.{1}".format(cluster, osd)
159 alt_role = role if cluster != 'ceph' else "osd.{0}".format(osd)
160 if remote in ctx.disk_config.remote_to_roles_to_dev:
161 if alt_role in ctx.disk_config.remote_to_roles_to_dev[remote]:
162 role = alt_role
163 if role not in ctx.disk_config.remote_to_roles_to_dev[remote]:
164 return
165 dev = ctx.disk_config.remote_to_roles_to_dev[remote][role]
166 mount_options = ctx.disk_config.\
167 remote_to_roles_to_dev_mount_options[remote][role]
168 fstype = ctx.disk_config.remote_to_roles_to_dev_fstype[remote][role]
169 mnt = os.path.join('/var/lib/ceph/osd', '{0}-{1}'.format(cluster, osd))
170
171 log.info('Mounting osd.{o}: dev: {n}, cluster: {c}'
172 'mountpoint: {p}, type: {t}, options: {v}'.format(
173 o=osd, n=remote.name, p=mnt, t=fstype, v=mount_options,
174 c=cluster))
175
176 remote.run(
177 args=[
178 'sudo',
179 'mount',
180 '-t', fstype,
181 '-o', ','.join(mount_options),
182 dev,
183 mnt,
184 ]
185 )
186
187
188def log_exc(func):

Callers 1

revive_osdMethod · 0.85

Calls 5

debugMethod · 0.45
formatMethod · 0.45
joinMethod · 0.45
infoMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected