diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py
index eadb35088..7fd4ee5a2 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -598,6 +598,12 @@ class GenericHardwareManager(HardwareManager):
             total = int(psutil.TOTAL_PHYMEM)
         elif psutil.version_info[0] == 2:
             total = int(psutil.phymem_usage().total)
+        elif psutil.version_info[0] == 5:
+            total = int(psutil.virtual_memory().total)
+        else:
+            total = None
+            LOG.warning("Cannot fetch total memory size: unsupported psutil "
+                        "version %s", psutil.version_info[0])
 
         try:
             out, _e = utils.execute("dmidecode --type 17 | grep Size",
diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py
index edfb76c1c..db87b5f3e 100644
--- a/ironic_python_agent/tests/unit/test_hardware.py
+++ b/ironic_python_agent/tests/unit/test_hardware.py
@@ -728,11 +728,11 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
         self.assertEqual('x86_64', cpus.architecture)
         self.assertEqual([], cpus.flags)
 
-    @mock.patch('psutil.version_info', (2, 0))
-    @mock.patch('psutil.phymem_usage', autospec=True)
+    @mock.patch('psutil.version_info', (5, 0))
+    @mock.patch('psutil.virtual_memory', autospec=True)
     @mock.patch.object(utils, 'execute')
-    def test_get_memory(self, mocked_execute, mocked_usage):
-        mocked_usage.return_value = mock.Mock(total=3952 * 1024 * 1024)
+    def test_get_memory(self, mocked_execute, mocked_virtmem):
+        mocked_virtmem.return_value.total = 3952 * 1024 * 1024
         mocked_execute.return_value = (
             ("Foo\nSize: 2048 MB\nSize: 2 GB\n"
              "Installed Size: Not Installed\n"