LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0001-replace-deprecated-phymem_usage-with-virtual_memory.patch of Package ironic-python-agent (Project home:mmnelemane:branches:Cloud:OpenStack:Mitaka:Staging)

--- ironic-python-agent-1.0.2.orig/ironic_python_agent/hardware.py	2016-03-22 22:44:25.000000000 +0100
+++ ironic-python-agent-1.0.2/ironic_python_agent/hardware.py	2016-05-23 17:59:30.391160570 +0200
@@ -391,7 +391,7 @@
         if psutil.version_info[0] == 1:
             total = int(psutil.TOTAL_PHYMEM)
         elif psutil.version_info[0] == 2:
-            total = int(psutil.phymem_usage().total)
+            total = int(psutil.virtual_memory().total)
 
         try:
             out, _e = utils.execute("dmidecode --type memory | grep Size",
--- ironic-python-agent-1.0.2.orig/ironic_python_agent/tests/unit/test_hardware.py	2016-03-22 22:44:25.000000000 +0100
+++ ironic-python-agent-1.0.2/ironic_python_agent/tests/unit/test_hardware.py	2016-05-23 18:00:00.187278938 +0200
@@ -387,7 +387,7 @@
         self.assertEqual(cpus.architecture, 'x86_64')
 
     @mock.patch('psutil.version_info', (2, 0))
-    @mock.patch('psutil.phymem_usage', autospec=True)
+    @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)