Skip to content

Commit

Permalink
Merge pull request ceph#33223 from dsavineau/issue_44069
Browse files Browse the repository at this point in the history
ceph-volume: fix is_ceph_device for lvm batch
  • Loading branch information
jan--f authored Feb 13, 2020
2 parents 81bad66 + 60d8063 commit 5b5002d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ceph-volume/ceph_volume/api/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,10 @@ def is_ceph_device(lv):
logger.warning('device is not part of ceph: %s', lv)
return False

return True
if lv.tags['ceph.osd_id'] == 'null':
return False
else:
return True


####################################
Expand Down
18 changes: 18 additions & 0 deletions src/ceph-volume/ceph_volume/tests/api/test_lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,24 @@ def test_single_vg_is_matched(self, volume_groups, monkeypatch):
assert api.get_vg(vg_name='foo') == FooVG


class TestVolume(object):

def test_is_ceph_device(self):
lv_tags = "ceph.type=data,ceph.osd_id=0"
osd = api.Volume(lv_name='osd/volume', lv_tags=lv_tags)
assert api.is_ceph_device(osd)

@pytest.mark.parametrize('dev',[
'/dev/sdb',
api.VolumeGroup(vg_name='foo'),
api.Volume(lv_name='vg/no_osd', lv_tags=''),
api.Volume(lv_name='vg/no_osd', lv_tags='ceph.osd_id=null'),
None,
])
def test_is_not_ceph_device(self, dev):
assert not api.is_ceph_device(dev)


class TestVolumes(object):

def test_volume_get_has_no_volumes(self, volumes):
Expand Down

0 comments on commit 5b5002d

Please sign in to comment.