From fd30aff672a1908a37163472f9c6478eca4e98e2 Mon Sep 17 00:00:00 2001 From: jianglong01 Date: Fri, 12 Mar 2021 11:03:10 +0800 Subject: [PATCH] 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 --- src/python-common/ceph/deployment/drive_selection/matchers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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()) -- 2.39.5