core: adjust units comment for host.memory_total, and fix related places
QubesOS/qubes-issues#1737
This commit is contained in:
parent
88a63cbe3a
commit
9633573408
@ -204,7 +204,7 @@ class QubesHost(object):
|
|||||||
|
|
||||||
@__builtin__.property
|
@__builtin__.property
|
||||||
def memory_total(self):
|
def memory_total(self):
|
||||||
'''Total memory, in bytes'''
|
'''Total memory, in kbytes'''
|
||||||
|
|
||||||
self._fetch()
|
self._fetch()
|
||||||
return self._total_mem
|
return self._total_mem
|
||||||
|
@ -33,7 +33,7 @@ class TestVMM(object):
|
|||||||
class TestHost(object):
|
class TestHost(object):
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.memory_total = 1000 * 1024 * 1024
|
self.memory_total = 1000 * 1024
|
||||||
self.no_cpus = 4
|
self.no_cpus = 4
|
||||||
|
|
||||||
class TestApp(qubes.tests.TestEmitter):
|
class TestApp(qubes.tests.TestEmitter):
|
||||||
|
@ -331,11 +331,11 @@ class TC_90_QubesVM(qubes.tests.QubesTestCase):
|
|||||||
def test_170_maxmem(self):
|
def test_170_maxmem(self):
|
||||||
vm = self.get_vm()
|
vm = self.get_vm()
|
||||||
self.assertPropertyDefaultValue(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.assertPropertyValue(vm, 'maxmem', 500, 500, '500')
|
||||||
del vm.maxmem
|
del vm.maxmem
|
||||||
self.assertPropertyDefaultValue(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.assertPropertyValue(vm, 'maxmem', '500', 500, '500')
|
||||||
self.assertPropertyInvalidValue(vm, 'maxmem', -100)
|
self.assertPropertyInvalidValue(vm, 'maxmem', -100)
|
||||||
self.assertPropertyInvalidValue(vm, 'maxmem', '-100')
|
self.assertPropertyInvalidValue(vm, 'maxmem', '-100')
|
||||||
|
@ -181,7 +181,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
doc='Memory currently available for this VM.')
|
doc='Memory currently available for this VM.')
|
||||||
|
|
||||||
maxmem = qubes.property('maxmem', type=int,
|
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
|
doc='''Maximum amount of memory available for this VM (for the purpose
|
||||||
of the memory balancer).''')
|
of the memory balancer).''')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user