]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: When device size contains the decimal, it can not match size exactly.
authorjianglong01 <jianglong01@qianxin.com>
Fri, 12 Mar 2021 03:03:10 +0000 (11:03 +0800)
committerSage Weil <sage@newdream.net>
Fri, 7 May 2021 12:41:41 +0000 (07:41 -0500)
for example, osd.yaml:
service_type: osd
service_name: test
placement:
  host_pattern: '*'
spec:
  data_devices:
    size: 3.6TB

Signed-off-by: jianglong01 <jianglong01@qianxin.com>
(cherry picked from commit fd30aff672a1908a37163472f9c6478eca4e98e2)

src/python-common/ceph/deployment/drive_selection/matchers.py

index 70bd4c38b1156bf8dea764baff8f404a35031f79..18775c424f1a4f2abeeb1fd43b55955ec569669c 100644 (file)
@@ -286,7 +286,7 @@ class SizeMatcher(Matcher):
         :return: A Tuple with normalized output (10, 'GB')
         :rtype: tuple
         """
-        return re.findall(r"\d+", data)[0], cls._parse_suffix(data)
+        return re.findall(r"\d+\.?\d*", data)[0], cls._parse_suffix(data)
 
     def _parse_filter(self) -> None:
         """ Identifies which type of 'size' filter is applied
@@ -322,7 +322,7 @@ class SizeMatcher(Matcher):
         if high:
             self.high = self._get_k_v(high.group())
 
-        exact = re.match(r"^\d+[A-Z]{1,2}$", self.value)
+        exact = re.match(r"^\d+\.?\d*[A-Z]{1,2}$", self.value)
         if exact:
             self.exact = self._get_k_v(exact.group())