From: jianglong01 Date: Fri, 12 Mar 2021 03:03:10 +0000 (+0800) Subject: mgr/cephadm: When device size contains the decimal, it can not match size exactly. X-Git-Tag: v16.2.5~51^2~3^2~16 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a516dbee983d4f516f07fbd01db8f75baaf1e6eb;p=ceph.git mgr/cephadm: When device size contains the decimal, it can not match size exactly. for example, osd.yaml: service_type: osd service_name: test placement: host_pattern: '*' spec: data_devices: size: 3.6TB Signed-off-by: jianglong01 (cherry picked from commit fd30aff672a1908a37163472f9c6478eca4e98e2) --- diff --git a/src/python-common/ceph/deployment/drive_selection/matchers.py b/src/python-common/ceph/deployment/drive_selection/matchers.py index 70bd4c38b1156..18775c424f1a4 100644 --- a/src/python-common/ceph/deployment/drive_selection/matchers.py +++ b/src/python-common/ceph/deployment/drive_selection/matchers.py @@ -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())