]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #56222 from adk3798/quincy-regex-host-pattern
authorAdam King <47704447+adk3798@users.noreply.github.com>
Mon, 29 Jul 2024 17:05:15 +0000 (13:05 -0400)
committerGitHub <noreply@github.com>
Mon, 29 Jul 2024 17:05:15 +0000 (13:05 -0400)
quincy: mgr/cephadm: support for regex based host patterns

Reviewed-by: John Mulligan <jmulligan@redhat.com>
1  2 
src/pybind/mgr/cephadm/tests/test_scheduling.py
src/python-common/ceph/deployment/service_spec.py
src/python-common/ceph/tests/test_service_spec.py

index 6049d02a4be650de5300661bf40fa8c4d31bfc58,22e1f0f50f9c7fc1770558717419242f885fbc2f..711445e2784b2fd0e42421bd1534744a8b4a684d
@@@ -190,11 -293,10 +293,11 @@@ class PlacementSpec(object)
              all_hosts = [hs.hostname for hs in hostspecs]
              return [h.hostname for h in self.hosts if h.hostname in all_hosts]
          if self.label:
 -            return [hs.hostname for hs in hostspecs if self.label in hs.labels]
 -        all_hosts = [hs.hostname for hs in hostspecs]
 +            all_hosts = [hs.hostname for hs in hostspecs if self.label in hs.labels]
 +        else:
 +            all_hosts = [hs.hostname for hs in hostspecs]
          if self.host_pattern:
-             return fnmatch.filter(all_hosts, self.host_pattern)
+             return self.host_pattern.filter_hosts(all_hosts)
          return all_hosts
  
      def get_target_count(self, hostspecs: Iterable[HostSpec]) -> int: