[V1] nics/system_info: fix bug of re pattern expression

Message ID 20220422093834.5188-1-junx.dong@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] nics/system_info: fix bug of re pattern expression |

Commit Message

Jun Dong April 22, 2022, 9:38 a.m. UTC
  There are some different forms of location information of memory in 
different platform, such as: "Locator: DIMM_A1", "Locator: DIMM 0",
"P1-DIMMA1","Locator: CPU1_DIMM_A2". The original re pattern expression
cann't match in some platform, this patch fixed it.

Signed-off-by: Jun Dong <junx.dong@intel.com>
---
 nics/system_info.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tu, Lijuan April 26, 2022, 3:15 a.m. UTC | #1
On Fri, 22 Apr 2022 17:38:34 +0800, Jun Dong <junx.dong@intel.com> wrote:
> There are some different forms of location information of memory in 
> different platform, such as: "Locator: DIMM_A1", "Locator: DIMM 0",
> "P1-DIMMA1","Locator: CPU1_DIMM_A2". The original re pattern expression
> cann't match in some platform, this patch fixed it.
> 
> Signed-off-by: Jun Dong <junx.dong@intel.com>

Acked-by: Lijuan Tu <lijuan.tu@intel.com>
Applied, thanks
  

Patch

diff --git a/nics/system_info.py b/nics/system_info.py
index 5ecdd77d..fa8525de 100644
--- a/nics/system_info.py
+++ b/nics/system_info.py
@@ -80,7 +80,7 @@  class SystemInfo(object):
         """
         s_regex = r"(\s+)Size: (\d+) MB"
         s1_regex = r"(\s+)Size: (\d+) GB"
-        l_regex = r"(\s+)Locator: .*_(\w+)"
+        l_regex = r"(\s+)Locator: .*[_\-\s](\w+)"
         speed_regex = r"(\s+)Speed: (.*)"
         size = ""
         locate = ""