Skip to content

Commit 3dcc10f

Browse files
authored
Merge branch 'ceph:main' into main
2 parents add274c + 353eaff commit 3dcc10f

File tree

7 files changed

+69
-24
lines changed

7 files changed

+69
-24
lines changed

doc/dev/macos.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Since we've switched to C++ 17, and the default clang shipped with Xcode 9 does
77

88
and install all the necessary bits::
99

10-
brew install snappy ccache cmake pkg-config
10+
brew install snappy ccache cmake pkg-config bash gnu-getopt
1111
pip install cython
1212

1313
install FUSE if you want to build the FUSE support::

doc/mgr/smb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ source_type
585585
Optional. One of ``resource`` (the default) or ``empty``
586586
ref
587587
String. Required for ``source_type: resource``. Must refer to the ID of a
588-
``ceph.smb.join.auth`` resource
588+
``ceph.smb.usersgroups`` resource
589589

590590
.. _tls-source-fields:
591591

src/ceph-volume/ceph_volume/tests/util/test_disk.py

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ def test_no_devices_are_found(self, tmpdir, patched_get_block_devs_sysfs):
256256
def test_sda_block_is_found(self, patched_get_block_devs_sysfs, fake_filesystem):
257257
sda_path = '/dev/sda'
258258
patched_get_block_devs_sysfs.return_value = [[sda_path, sda_path, 'disk', sda_path]]
259-
result = disk.get_devices()
259+
with patch("ceph_volume.util.disk.UdevData") as MockUdevData:
260+
mock_instance = MagicMock()
261+
mock_instance.is_lvm = False
262+
MockUdevData.return_value = mock_instance
263+
result = disk.get_devices()
260264
assert len(result.keys()) == 1
261265
assert result[sda_path]['human_readable_size'] == '0.00 B'
262266
assert result[sda_path]['model'] == ''
@@ -266,7 +270,11 @@ def test_sda_size(self, patched_get_block_devs_sysfs, fake_filesystem):
266270
sda_path = '/dev/sda'
267271
patched_get_block_devs_sysfs.return_value = [[sda_path, sda_path, 'disk', sda_path]]
268272
fake_filesystem.create_file('/sys/block/sda/size', contents = '1024')
269-
result = disk.get_devices()
273+
with patch("ceph_volume.util.disk.UdevData") as MockUdevData:
274+
mock_instance = MagicMock()
275+
mock_instance.is_lvm = False
276+
MockUdevData.return_value = mock_instance
277+
result = disk.get_devices()
270278
assert list(result.keys()) == [sda_path]
271279
assert result[sda_path]['human_readable_size'] == '512.00 KB'
272280

@@ -275,30 +283,46 @@ def test_sda_sectorsize_fallsback(self, patched_get_block_devs_sysfs, fake_files
275283
sda_path = '/dev/sda'
276284
patched_get_block_devs_sysfs.return_value = [[sda_path, sda_path, 'disk', sda_path]]
277285
fake_filesystem.create_file('/sys/block/sda/queue/hw_sector_size', contents = '1024')
278-
result = disk.get_devices()
286+
with patch("ceph_volume.util.disk.UdevData") as MockUdevData:
287+
mock_instance = MagicMock()
288+
mock_instance.is_lvm = False
289+
MockUdevData.return_value = mock_instance
290+
result = disk.get_devices()
279291
assert list(result.keys()) == [sda_path]
280292
assert result[sda_path]['sectorsize'] == '1024'
281293

282294
def test_sda_sectorsize_from_logical_block(self, patched_get_block_devs_sysfs, fake_filesystem):
283295
sda_path = '/dev/sda'
284296
patched_get_block_devs_sysfs.return_value = [[sda_path, sda_path, 'disk', sda_path]]
285297
fake_filesystem.create_file('/sys/block/sda/queue/logical_block_size', contents = '99')
286-
result = disk.get_devices()
298+
with patch("ceph_volume.util.disk.UdevData") as MockUdevData:
299+
mock_instance = MagicMock()
300+
mock_instance.is_lvm = False
301+
MockUdevData.return_value = mock_instance
302+
result = disk.get_devices()
287303
assert result[sda_path]['sectorsize'] == '99'
288304

289305
def test_sda_sectorsize_does_not_fallback(self, patched_get_block_devs_sysfs, fake_filesystem):
290306
sda_path = '/dev/sda'
291307
patched_get_block_devs_sysfs.return_value = [[sda_path, sda_path, 'disk', sda_path]]
292308
fake_filesystem.create_file('/sys/block/sda/queue/logical_block_size', contents = '99')
293309
fake_filesystem.create_file('/sys/block/sda/queue/hw_sector_size', contents = '1024')
294-
result = disk.get_devices()
310+
with patch("ceph_volume.util.disk.UdevData") as MockUdevData:
311+
mock_instance = MagicMock()
312+
mock_instance.is_lvm = False
313+
MockUdevData.return_value = mock_instance
314+
result = disk.get_devices()
295315
assert result[sda_path]['sectorsize'] == '99'
296316

297317
def test_is_rotational(self, patched_get_block_devs_sysfs, fake_filesystem):
298318
sda_path = '/dev/sda'
299319
patched_get_block_devs_sysfs.return_value = [[sda_path, sda_path, 'disk', sda_path]]
300320
fake_filesystem.create_file('/sys/block/sda/queue/rotational', contents = '1')
301-
result = disk.get_devices()
321+
with patch("ceph_volume.util.disk.UdevData") as MockUdevData:
322+
mock_instance = MagicMock()
323+
mock_instance.is_lvm = False
324+
MockUdevData.return_value = mock_instance
325+
result = disk.get_devices()
302326
assert result[sda_path]['rotational'] == '1'
303327

304328
def test_is_ceph_rbd(self, patched_get_block_devs_sysfs, fake_filesystem):
@@ -313,7 +337,11 @@ def test_actuator_device(self, patched_get_block_devs_sysfs, fake_filesystem):
313337
patched_get_block_devs_sysfs.return_value = [[sda_path, sda_path, 'disk', sda_path]]
314338
for actuator in range(0, fake_actuator_nb):
315339
fake_filesystem.create_dir(f'/sys/block/sda/queue/independent_access_ranges/{actuator}')
316-
result = disk.get_devices()
340+
with patch("ceph_volume.util.disk.UdevData") as MockUdevData:
341+
mock_instance = MagicMock()
342+
mock_instance.is_lvm = False
343+
MockUdevData.return_value = mock_instance
344+
result = disk.get_devices()
317345
assert result[sda_path]['actuators'] == fake_actuator_nb
318346

319347

@@ -668,6 +696,7 @@ def setUp(self) -> None:
668696
self.fs.create_file(self.fake_device, st_mode=(stat.S_IFBLK | 0o600))
669697
self.fs.create_file('/run/udev/data/b999:0', create_missing_dirs=True, contents=udev_data_bare_device)
670698
self.fs.create_file('/run/udev/data/b998:1', create_missing_dirs=True, contents=udev_data_lv_device)
699+
self.fs.create_file('/run/udev/data/b997:2', create_missing_dirs=True, contents="")
671700

672701
def test_device_not_found(self) -> None:
673702
self.fs.remove(self.fake_device)
@@ -682,6 +711,13 @@ def test_no_data(self) -> None:
682711
with pytest.raises(RuntimeError):
683712
disk.UdevData(self.fake_device)
684713

714+
@patch('ceph_volume.util.disk.os.stat', MagicMock())
715+
@patch('ceph_volume.util.disk.os.minor', Mock(return_value=2))
716+
@patch('ceph_volume.util.disk.os.major', Mock(return_value=997))
717+
def test_empty_data(self) -> None:
718+
# no exception should be raised when a /run/udev/data/* file is empty
719+
_ = disk.UdevData(self.fake_device)
720+
685721
@patch('ceph_volume.util.disk.os.stat', MagicMock())
686722
@patch('ceph_volume.util.disk.os.minor', Mock(return_value=0))
687723
@patch('ceph_volume.util.disk.os.major', Mock(return_value=999))

src/ceph-volume/ceph_volume/util/disk.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import time
66
import json
77
from ceph_volume import process, allow_loop_devices
8-
from ceph_volume.api import lvm
98
from ceph_volume.util.system import get_file_contents
109
from typing import Dict, List, Any, Union, Optional
1110

@@ -802,9 +801,12 @@ def get_devices(_sys_block_path='/sys/block', device=''):
802801
continue
803802

804803
# If the mapper device is a logical volume it gets excluded
805-
if is_mapper_device(diskname):
806-
if lvm.get_device_lvs(diskname):
804+
try:
805+
if UdevData(diskname).is_lvm:
807806
continue
807+
except RuntimeError:
808+
logger.debug("get_devices(): device {} couldn't be found.".format(diskname))
809+
continue
808810

809811
# all facts that have no defaults
810812
# (<name>, <path relative to _sys_block_path>)
@@ -1372,7 +1374,7 @@ def __init__(self, path: str) -> None:
13721374

13731375
with open(self.udev_data_path, 'r') as f:
13741376
content: str = f.read().strip()
1375-
self.raw_data: List[str] = content.split('\n')
1377+
self.raw_data: List[str] = content.split('\n') if content else []
13761378

13771379
for line in self.raw_data:
13781380
data_type, data = line.split(':', 1)

src/osd/OSDMap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ bool OSDMap::subtree_type_is_down(
374374
{
375375
if (id >= 0) {
376376
bool is_down_ret = is_down(id);
377-
if (!is_out(id)) {
377+
if (!is_out(id) && !(osd_state[id] & CEPH_OSD_NEW)) {
378378
if (is_down_ret) {
379379
down_in_osds->insert(id);
380380
} else {

src/rgw/driver/rados/rgw_dedup.cc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ namespace rgw::dedup {
344344
return ret;
345345
}
346346

347-
ret = ioctx.application_enable("rgw_dedup", false);
347+
ret = ioctx.application_enable("rgw", false);
348348
if (ret == 0) {
349349
ldpp_dout(dpp, 10) << __func__ << "::pool " << dedup_pool.name
350350
<< " was associated with dedup app" << dendl;
@@ -1499,23 +1499,24 @@ namespace rgw::dedup {
14991499
const rgw_bucket_dir_entry &entry,
15001500
worker_stats_t *p_worker_stats /*IN-OUT*/)
15011501
{
1502-
// ceph store full blocks so need to round up and multiply by block_size
1503-
uint64_t ondisk_byte_size = calc_on_disk_byte_size(entry.meta.size);
1504-
// count all objects including too small and non default storage_class objs
1505-
p_worker_stats->ingress_obj++;
1506-
p_worker_stats->ingress_obj_bytes += ondisk_byte_size;
1507-
15081502
parsed_etag_t parsed_etag;
15091503
if (unlikely(!parse_etag_string(entry.meta.etag, &parsed_etag))) {
15101504
p_worker_stats->ingress_corrupted_etag++;
1511-
ldpp_dout(dpp, 1) << __func__ << "::ERROR: corrupted etag" << dendl;
1505+
ldpp_dout(dpp, 1) << __func__ << "::ERROR: corrupted etag:" << entry.meta.etag
1506+
<< "::" << p_bucket->get_name() << "/" << entry.key.name << dendl;
15121507
return -EINVAL;
15131508
}
15141509

15151510
if (unlikely((cct->_conf->subsys.should_gather<ceph_subsys_rgw_dedup, 20>()))) {
15161511
show_ingress_bucket_idx_obj(dpp, parsed_etag, p_bucket->get_name(), entry.key.name);
15171512
}
15181513

1514+
// ceph store full blocks so need to round up and multiply by block_size
1515+
uint64_t ondisk_byte_size = calc_on_disk_byte_size(entry.meta.size);
1516+
// count all objects including too small and non default storage_class objs
1517+
p_worker_stats->ingress_obj++;
1518+
p_worker_stats->ingress_obj_bytes += ondisk_byte_size;
1519+
15191520
// We limit dedup to objects from the same storage_class
15201521
// TBD:
15211522
// Should we use a skip-list of storage_classes we should skip (like glacier) ?

src/rgw/driver/rados/rgw_dedup_utils.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,14 @@ namespace rgw::dedup {
310310
this->non_default_storage_class_objs_bytes);
311311
}
312312
else {
313-
ceph_assert(this->default_storage_class_objs == this->ingress_obj);
314-
ceph_assert(this->default_storage_class_objs_bytes == this->ingress_obj_bytes);
313+
if (this->default_storage_class_objs != this->ingress_obj) {
314+
f->dump_unsigned("default storage class objs",
315+
this->default_storage_class_objs);
316+
}
317+
if (this->default_storage_class_objs_bytes != this->ingress_obj_bytes) {
318+
f->dump_unsigned("default storage class objs bytes",
319+
this->default_storage_class_objs_bytes);
320+
}
315321
}
316322
}
317323

0 commit comments

Comments
 (0)