diff --git a/computes/models.py b/computes/models.py index 7a078e42..94f64f94 100644 --- a/computes/models.py +++ b/computes/models.py @@ -90,11 +90,11 @@ class Compute(Model): @cached_property def cpu_count(self): - return self.proxy.get_node_info()[3] - + return self.proxy.host_info[2] + @cached_property def ram_size(self): - return self.proxy.get_node_info()[2] + return self.proxy.host_info[1] * 1048576 # MiB @cached_property def ram_usage(self): diff --git a/computes/tests/test_capacity.py b/computes/tests/test_capacity.py index dda82f71..07fae02c 100644 --- a/computes/tests/test_capacity.py +++ b/computes/tests/test_capacity.py @@ -36,6 +36,12 @@ class CapacityTests(TestCase): self.assertIsNone(self.compute.capacity) details.assert_not_called() + @patch("computes.models.wvmHostDetails") + def test_cpus_and_memory_come_from_the_host_info(self, details): + details.return_value.host_info = ["x86_64", 32768, 8, 2400] + self.assertEqual((self.compute.cpu_count, self.compute.ram_size), (8, 32 * GIB)) + details.return_value.get_node_info.assert_not_called() # no hostname, sysinfo or URI read + class ComputesPageTests(TestCase): def test_the_list_shows_what_each_compute_has_given(self):