def test_with_device(tmpdir, sector_size): filename = str(tmpdir.join("file")) prepare_backing_file(filename) with loopback.Device(filename, sector_size=sector_size) as device: assert device.is_attached() check_device(device) block_size, _ = multipath.getDeviceBlockSizes(device.path) expected = sector_size if sector_size else sc.BLOCK_SIZE_512 assert block_size == expected assert not device.is_attached() check_backing_file(filename)
def test_with_device(tmpdir, sector_size): filename = str(tmpdir.join("file")) prepare_backing_file(filename) with loopback.Device(filename, sector_size=sector_size) as device: assert device.is_attached() check_device(device) block_size, _ = multipath.getDeviceBlockSizes(device.path) expected = sector_size if sector_size else sc.BLOCK_SIZE_512 assert block_size == expected assert not device.is_attached() check_backing_file(filename)
def _getpvblksize(pv): dev = devicemapper.getDmId(os.path.basename(pv)) return multipath.getDeviceBlockSizes(dev)
def _getpvblksize(pv): dev = devicemapper.getDmId(os.path.basename(pv)) return multipath.getDeviceBlockSizes(dev)