From 9633573408d64e8a1c35d4efd7a0c0ade0637ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 10 Feb 2016 18:15:16 +0100 Subject: [PATCH] core: adjust units comment for host.memory_total, and fix related places QubesOS/qubes-issues#1737 --- qubes/__init__.py | 2 +- qubes/tests/vm/__init__.py | 2 +- qubes/tests/vm/qubesvm.py | 4 ++-- qubes/vm/qubesvm.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qubes/__init__.py b/qubes/__init__.py index 616c1503..bafc8e0f 100644 --- a/qubes/__init__.py +++ b/qubes/__init__.py @@ -204,7 +204,7 @@ class QubesHost(object): @__builtin__.property def memory_total(self): - '''Total memory, in bytes''' + '''Total memory, in kbytes''' self._fetch() return self._total_mem diff --git a/qubes/tests/vm/__init__.py b/qubes/tests/vm/__init__.py index e4ec7e7c..1bba43df 100644 --- a/qubes/tests/vm/__init__.py +++ b/qubes/tests/vm/__init__.py @@ -33,7 +33,7 @@ class TestVMM(object): class TestHost(object): # pylint: disable=too-few-public-methods def __init__(self): - self.memory_total = 1000 * 1024 * 1024 + self.memory_total = 1000 * 1024 self.no_cpus = 4 class TestApp(qubes.tests.TestEmitter): diff --git a/qubes/tests/vm/qubesvm.py b/qubes/tests/vm/qubesvm.py index 4ab96c8f..39f1f864 100644 --- a/qubes/tests/vm/qubesvm.py +++ b/qubes/tests/vm/qubesvm.py @@ -331,11 +331,11 @@ class TC_90_QubesVM(qubes.tests.QubesTestCase): def test_170_maxmem(self): vm = self.get_vm() self.assertPropertyDefaultValue(vm, 'maxmem', - self.app.host.memory_total / 1024 / 1024 / 2) + self.app.host.memory_total / 1024 / 2) self.assertPropertyValue(vm, 'maxmem', 500, 500, '500') del vm.maxmem self.assertPropertyDefaultValue(vm, 'maxmem', - self.app.host.memory_total / 1024 / 1024 / 2) + self.app.host.memory_total / 1024 / 2) self.assertPropertyValue(vm, 'maxmem', '500', 500, '500') self.assertPropertyInvalidValue(vm, 'maxmem', -100) self.assertPropertyInvalidValue(vm, 'maxmem', '-100') diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 1527298c..8540234d 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -181,7 +181,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): doc='Memory currently available for this VM.') maxmem = qubes.property('maxmem', type=int, - default=(lambda self: self.app.host.memory_total / 1024 / 1024 / 2), + default=(lambda self: self.app.host.memory_total / 1024 / 2), doc='''Maximum amount of memory available for this VM (for the purpose of the memory balancer).''')