core: adjust units comment for host.memory_total, and fix related places

QubesOS/qubes-issues#1737
This commit is contained in:
Marek Marczykowski-Górecki 2016-02-10 18:15:16 +01:00 committed by Wojtek Porczyk
parent 88a63cbe3a
commit 9633573408
4 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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):

View File

@ -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')

View File

@ -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).''')