From: Guillaume Abrioux Date: Wed, 1 Feb 2023 16:51:18 +0000 (+0100) Subject: drive_group: fix limit filter in drive_selection.selector X-Git-Tag: v16.2.13~87^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=107e033160b0b268a194928c17caff82fa24d6fb;p=ceph.git drive_group: fix limit filter in drive_selection.selector When multiple osd service specs with 'limit' filter are applied, the current logic makes the second service speec try to pick devices that are already used by the first service spec. Fixes: https://tracker.ceph.com/issues/58626 Signed-off-by: Guillaume Abrioux (cherry picked from commit 8b7da77ae0bf3b7c2ab28cd54b166bc1ff43b437) --- diff --git a/src/python-common/ceph/deployment/drive_selection/selector.py b/src/python-common/ceph/deployment/drive_selection/selector.py index 07b0549f3a20..d6556dd2c0a5 100644 --- a/src/python-common/ceph/deployment/drive_selection/selector.py +++ b/src/python-common/ceph/deployment/drive_selection/selector.py @@ -128,6 +128,17 @@ class DriveSelection(object): ) continue + if not disk.available and disk.ceph_device and disk.lvs: + other_osdspec_affinity = '' + for lv in disk.lvs: + if lv['osdspec_affinity'] != self.spec.service_id: + other_osdspec_affinity = lv['osdspec_affinity'] + break + if other_osdspec_affinity: + logger.debug("{} is already used in spec {}, " + "skipping it.".format(disk.path, other_osdspec_affinity)) + continue + if not self._has_mandatory_idents(disk): logger.debug( "Ignoring disk {}. Missing mandatory idents".format( diff --git a/src/python-common/ceph/deployment/inventory.py b/src/python-common/ceph/deployment/inventory.py index 4345597b11d0..b7e1cbc23576 100644 --- a/src/python-common/ceph/deployment/inventory.py +++ b/src/python-common/ceph/deployment/inventory.py @@ -61,7 +61,7 @@ class Device(object): sys_api=None, # type: Optional[Dict[str, Any]] available=None, # type: Optional[bool] rejected_reasons=None, # type: Optional[List[str]] - lvs=None, # type: Optional[List[str]] + lvs=None, # type: Optional[List[Dict[str, str]]] device_id=None, # type: Optional[str] lsm_data=None, # type: Optional[Dict[str, Dict[str, str]]] created=None, # type: Optional[datetime.datetime] @@ -120,7 +120,7 @@ class Device(object): return 'hdd' if self.sys_api["rotational"] == "1" else 'ssd' def __repr__(self) -> str: - device_desc: Dict[str, Union[str, List[str]]] = { + device_desc: Dict[str, Union[str, List[str], List[Dict[str, str]]]] = { 'path': self.path if self.path is not None else 'unknown', 'lvs': self.lvs if self.lvs else 'None', 'available': str(self.available),