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: v19.0.0~1641^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8b7da77ae0bf3b7c2ab28cd54b166bc1ff43b437;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 --- 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 c57b469f8ca7..a3023882108e 100644 --- a/src/python-common/ceph/deployment/inventory.py +++ b/src/python-common/ceph/deployment/inventory.py @@ -62,7 +62,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] @@ -124,7 +124,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),