Skip to content

Commit

Permalink
Merge pull request ceph#34436 from jschmid1/dg_affinity
Browse files Browse the repository at this point in the history
ceph-volume: add ceph.osdspec_affinity tag
  • Loading branch information
jan--f authored May 4, 2020
2 parents 3af27bf + 815f8e6 commit 39a5fc1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ceph-volume/ceph_volume/api/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ def report(self):
'type': type_,
'osd_fsid': self.tags['ceph.osd_fsid'],
'cluster_fsid': self.tags['ceph.cluster_fsid'],
'osdspec_affinity': self.tags.get('ceph.osdspec_affinity', ''),
}
type_uuid = '{}_uuid'.format(type_)
report[type_uuid] = self.tags['ceph.{}'.format(type_uuid)]
Expand Down
1 change: 1 addition & 0 deletions src/ceph-volume/ceph_volume/devices/lvm/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def prepare(self):
'ceph.cluster_fsid': cluster_fsid,
'ceph.cluster_name': conf.cluster,
'ceph.crush_device_class': crush_device_class,
'ceph.osdspec_affinity': prepare_utils.get_osdspec_affinity()
}
if self.args.filestore:
#TODO: allow auto creation of journal on passed device, only works
Expand Down
10 changes: 10 additions & 0 deletions src/ceph-volume/ceph_volume/util/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ def get_monmap(osd_id):
])


def get_osdspec_affinity():
return os.environ.get('CEPH_VOLUME_OSDSPEC_AFFINITY', '')


def osd_mkfs_bluestore(osd_id, fsid, keyring=None, wal=False, db=False):
"""
Create the files for the OSD to function. A normal call will look like:
Expand Down Expand Up @@ -449,6 +453,9 @@ def osd_mkfs_bluestore(osd_id, fsid, keyring=None, wal=False, db=False):
)
system.chown(db)

if get_osdspec_affinity():
base_command.extend(['--osdspec-affinity', get_osdspec_affinity()])

command = base_command + supplementary_command

_, _, returncode = process.call(command, stdin=keyring, show_command=True)
Expand Down Expand Up @@ -485,6 +492,9 @@ def osd_mkfs_filestore(osd_id, fsid, keyring):
'--monmap', monmap,
]

if get_osdspec_affinity():
command.extend(['--osdspec-affinity', get_osdspec_affinity()])

if __release__ != 'luminous':
# goes through stdin
command.extend(['--keyfile', '-'])
Expand Down

0 comments on commit 39a5fc1

Please sign in to comment.