]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
drive_group: fix limit filter in drive_selection.selector 50370/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Wed, 1 Feb 2023 16:51:18 +0000 (17:51 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 3 Mar 2023 15:11:23 +0000 (16:11 +0100)
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 <gabrioux@ibm.com>
(cherry picked from commit 8b7da77ae0bf3b7c2ab28cd54b166bc1ff43b437)

src/python-common/ceph/deployment/drive_selection/selector.py
src/python-common/ceph/deployment/inventory.py

index 07b0549f3a201f726b44eb7e4998e6c510efd248..d6556dd2c0a557c73d231bf8147093f7dc44a401 100644 (file)
@@ -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(
index 4345597b11d0965158ca47c2b96938c881664816..b7e1cbc23576503c027cd70d0373840b86baba28 100644 (file)
@@ -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),