From b49d3f24c6916e7954869bc159eac4861c67f9b0 Mon Sep 17 00:00:00 2001
From: tasleson tasleson@redhat.com
Date: Tue, 2 Apr 2024 16:21:03 +0800
Subject: [PATCH]  Correct HBA-Mode and Correct hashlib.md5 usage

---
 plugin/megaraid_plugin/megaraid.py | 2 +-
 test/cmdtest.py.in                 | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugin/megaraid_plugin/megaraid.py b/plugin/megaraid_plugin/megaraid.py
index eee7233..9004262 100644
--- a/plugin/megaraid_plugin/megaraid.py
+++ b/plugin/megaraid_plugin/megaraid.py
@@ -547,7 +547,7 @@ class MegaRAID(IPlugin):
                 if ctrl_show_all_output["Status"]["Current Personality"] == "HBA-Mode ":
                     mode = System.MODE_HBA
                 else:
-                    mode = System.MODE_HBA
+                    mode = System.MODE_HARDWARE_RAID
             else:
                 mode = System.MODE_UNKNOWN
 
diff --git a/test/cmdtest.py.in b/test/cmdtest.py.in
index 273f07d..46d3379 100755
--- a/test/cmdtest.py.in
+++ b/test/cmdtest.py.in
@@ -65,6 +65,10 @@ def random_iqn():
 
     s = "iqn.1994-05.com.domain:01."
     m = hashlib.md5()
+    try:
+        m = hashlib.md5(usedforsecurity=False)
+    except Exception:
+        m = hashlib.md5()
     u = os.uname()
     for i in u:
         m.update(i.encode('utf-8'))
-- 
2.27.0

