示例#1
0
 def is_member(self):
     if self._is_ceph_disk_member is None:
         if 'ceph' in self.partlabel:
             self._is_ceph_disk_member = True
             return True
         elif self.parttype in ceph_disk_guids.keys():
             return True
         return False
     return self._is_ceph_disk_member
示例#2
0
    This speeds up calls to Device and Disk
    '''
    monkeypatch.setattr("ceph_volume.util.device.disk.get_devices", lambda: {})
    monkeypatch.setattr("ceph_volume.util.disk.udevadm_property",
                        lambda *a, **kw: {})


@pytest.fixture(params=[
    '', 'ceph data', 'ceph journal', 'ceph block', 'ceph block.wal',
    'ceph block.db', 'ceph lockbox'
])
def ceph_partlabel(request):
    return request.param


@pytest.fixture(params=list(ceph_disk_guids.keys()))
def ceph_parttype(request):
    return request.param


@pytest.fixture
def lsblk_ceph_disk_member(monkeypatch, request, ceph_partlabel,
                           ceph_parttype):
    monkeypatch.setattr(
        "ceph_volume.util.device.disk.lsblk", lambda path: {
            'TYPE': 'disk',
            'PARTLABEL': ceph_partlabel
        })
    # setting blkid here too in order to be able to fall back to PARTTYPE based
    # membership
    monkeypatch.setattr(
示例#3
0
 def is_member(device):
     return 'ceph' in device.get('PARTLABEL', '') or \
         device.get('PARTTYPE', '') in ceph_disk_guids.keys()