qubes: minor fixes in handling defaults
- fix assigning 'template' property - do not do it if VM already have it set - cap default maxmem at 4000, as we clamp it to 10*memory anyway (and default memory is 400)
This commit is contained in:
parent
dd93650ea7
commit
5d8ecd60de
@ -103,7 +103,7 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
|
|||||||
del self.volume_config[name]['vid']
|
del self.volume_config[name]['vid']
|
||||||
|
|
||||||
super(AppVM, self).__init__(app, xml, **kwargs)
|
super(AppVM, self).__init__(app, xml, **kwargs)
|
||||||
if not hasattr(template, 'template') and template is not None:
|
if not hasattr(self, 'template') and template is not None:
|
||||||
self.template = template
|
self.template = template
|
||||||
if 'source' not in self.volume_config['root']:
|
if 'source' not in self.volume_config['root']:
|
||||||
msg = 'missing source for root volume'
|
msg = 'missing source for root volume'
|
||||||
|
@ -213,7 +213,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
|
|
||||||
maxmem = qubes.property('maxmem', type=int,
|
maxmem = qubes.property('maxmem', type=int,
|
||||||
setter=_setter_positive_int,
|
setter=_setter_positive_int,
|
||||||
default=(lambda self: self.app.host.memory_total / 1024 / 2),
|
default=(lambda self: min(self.app.host.memory_total / 1024 / 2, 4000)),
|
||||||
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