add support for linux stubdoms
(cherry picked from commit e14ac1500a05162b3c07a5f44b4f0223f43fe90c)
This commit is contained in:
parent
eaf5c27b27
commit
f7094bec4f
@ -409,6 +409,11 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
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).''')
|
||||||
|
|
||||||
|
stubdom_mem = qubes.property('stubdom_mem', type=int,
|
||||||
|
setter=_setter_positive_int,
|
||||||
|
default=None,
|
||||||
|
doc='Memory ammount allocated for the stubdom')
|
||||||
|
|
||||||
internal = qubes.property('internal', default=False,
|
internal = qubes.property('internal', default=False,
|
||||||
type=bool, setter=qubes.property.bool,
|
type=bool, setter=qubes.property.bool,
|
||||||
doc='''Internal VM (not shown in qubes-manager, don't create appmenus
|
doc='''Internal VM (not shown in qubes-manager, don't create appmenus
|
||||||
@ -1136,7 +1141,19 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if mem_required is None:
|
if mem_required is None:
|
||||||
mem_required = int(self.memory) * 1024 * 1024
|
if self.hvm:
|
||||||
|
if self.stubdom_mem:
|
||||||
|
stubdom_mem = self.stubdom_mem
|
||||||
|
else:
|
||||||
|
if self.features.get('linux-stubdom', False):
|
||||||
|
stubdom_mem = 128 # from libxl_create.c
|
||||||
|
else:
|
||||||
|
stubdom_mem = 28 # from libxl_create.c
|
||||||
|
stubdom_mem += 16 # video ram
|
||||||
|
else:
|
||||||
|
stubdom_mem = 0
|
||||||
|
|
||||||
|
mem_required = int(self.memory + stubdom_mem) * 1024 * 1024
|
||||||
|
|
||||||
qmemman_client = qubes.qmemman.client.QMemmanClient()
|
qmemman_client = qubes.qmemman.client.QMemmanClient()
|
||||||
try:
|
try:
|
||||||
|
@ -112,17 +112,32 @@
|
|||||||
|
|
||||||
{% if vm.hvm %}
|
{% if vm.hvm %}
|
||||||
<emulator
|
<emulator
|
||||||
type="stubdom"
|
{% if vm.features.get('linux-stubdom', False) %}
|
||||||
{% if vm.netvm %}
|
type="stubdom-linux"
|
||||||
|
{% else %}
|
||||||
|
type="stubdom"
|
||||||
|
{% endif %}
|
||||||
|
{% if vm.netvm and not vm.features.get('linux-stubdom', False) %}
|
||||||
cmdline="-net lwip,client_ip={{ vm.ip -}}
|
cmdline="-net lwip,client_ip={{ vm.ip -}}
|
||||||
,server_ip={{ vm.dns[1] -}}
|
,server_ip={{ vm.dns[1] -}}
|
||||||
,dns={{ vm.netvm.gateway -}}
|
,dns={{ vm.netvm.gateway -}}
|
||||||
,gw={{ vm.netvm.gateway -}}
|
,gw={{ vm.netvm.gateway -}}
|
||||||
,netmask={{ vm.netmask }}"
|
,netmask={{ vm.netmask }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if vm.stubdom_mem %}
|
||||||
|
memory="{{ vm.stubdom_mem * 1024 -}}"
|
||||||
|
{% endif %}
|
||||||
/>
|
/>
|
||||||
<input type="tablet" bus="usb"/>
|
<input type="tablet" bus="usb"/>
|
||||||
<video type="vga"/>
|
{% if vm.features.get('linux-stubdom', False) %}
|
||||||
|
<video type="cirrus"/>
|
||||||
|
{% else %}
|
||||||
|
<video type="vga"/>
|
||||||
|
{% endif %}
|
||||||
|
{% if vm.features.get('linux-stubdom', False) %}
|
||||||
|
{# TODO only add qubes gui if gui-agent is not installed in HVM #}
|
||||||
|
<graphics type="qubes"/>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<console type="pty">
|
<console type="pty">
|
||||||
<target type="xen" port="0"/>
|
<target type="xen" port="0"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user