Skip to content

Commit

Permalink
Merge pull request #29702 from jan--f/wip-41308-nautilus
Browse files Browse the repository at this point in the history
nautilus: ceph-volume: [filestore,bluestore] single type strategies fail after tracking devices as sets

Reviewed-by: Alfredo Deza <adeza@redhat.com>
  • Loading branch information
Alfredo Deza committed Aug 16, 2019
2 parents cbe62a4 + a86e07f commit b07494e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/ceph-volume/ceph_volume/devices/lvm/batch.py
Expand Up @@ -254,7 +254,7 @@ def __init__(self, argv):
self.args = parser.parse_args(argv)
self.parser = parser
for dev_list in ['', 'db_', 'wal_', 'journal_']:
setattr(self, '{}usable'.format(dev_list), set())
setattr(self, '{}usable'.format(dev_list), [])

def get_devices(self):
# remove devices with partitions
Expand Down Expand Up @@ -361,17 +361,17 @@ def _filter_devices(self):
dev_list_prop = '{}devices'.format(dev_list)
if hasattr(self.args, dev_list_prop):
usable_dev_list_prop = '{}usable'.format(dev_list)
usable = set([d for d in getattr(self.args, dev_list_prop) if
d.available])
usable = [d for d in getattr(self.args, dev_list_prop) if
d.available]
setattr(self, usable_dev_list_prop, usable)
self.filtered_devices.update({d: used_reason for d in
getattr(self.args, dev_list_prop)
if d.used_by_ceph})

def _ensure_disjoint_device_lists(self):
# check that all device lists are disjoint with each other
if not(self.usable.isdisjoint(self.db_usable) and
self.usable.isdisjoint(self.wal_usable) and
self.usable.isdisjoint(self.journal_usable) and
self.db_usable.isdisjoint(self.wal_usable)):
if not(set(self.usable).isdisjoint(set(self.db_usable)) and
set(self.usable).isdisjoint(set(self.wal_usable)) and
set(self.usable).isdisjoint(set(self.journal_usable)) and
set(self.db_usable).isdisjoint(set(self.wal_usable))):
raise Exception('Device lists are not disjoint')
Expand Up @@ -223,12 +223,3 @@ def test_ssd_device_fails_multiple_osds(self, stub_vgs, fakedevice, factory, con
filestore.MixedType.with_auto_devices(args, devices)
msg = "Not enough space in fast devices (14.97 GB) to create 2 x 14.77 GB journal LV"
assert msg in str(error.value)

def test_filter_all_data_devs(self, fakedevice, factory):
# in this scenario the user passed a already used device to be used for
# data and an unused device to be used as db device.
db_dev = fakedevice(used_by_ceph=False, is_lvm_member=False, rotational=False, sys_api=dict(size=6073740000))
data_dev = fakedevice(used_by_ceph=True, is_lvm_member=False, rotational=True, sys_api=dict(size=6073740000))
args = factory(filtered_devices=[data_dev], osds_per_device=1,
journal_size=None, osd_ids=[])
filestore.MixedType(args, [], [db_dev])
3 changes: 2 additions & 1 deletion src/ceph-volume/ceph_volume/tests/devices/lvm/test_batch.py
Expand Up @@ -63,8 +63,9 @@ def test_disjoint_device_lists(self, factory):
b.args.devices = [device1, device2]
b.args.db_devices = [device2]
b._filter_devices()
with pytest.raises(Exception):
with pytest.raises(Exception) as disjoint_ex:
b._ensure_disjoint_device_lists()
assert 'Device lists are not disjoint' in str(disjoint_ex.value)


class TestFilterDevices(object):
Expand Down

0 comments on commit b07494e

Please sign in to comment.