Skip to content

Commit b0102b3

Browse files
committed
Add global preload to template gathering
Affects suspend, which uses this function. For: QubesOS/qubes-issues#1512
1 parent 8de4cd0 commit b0102b3

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

qubes/vm/dispvm.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,26 @@ def _setter_template(self, prop, value):
4141

4242

4343
def get_preload_templates(domains) -> list:
44-
return [
45-
qube
46-
for qube in domains
47-
if int(qube.features.get("preload-dispvm-max", 0) or 0) > 0
48-
and qube.klass == "AppVM"
49-
and getattr(qube, "template_for_dispvms", False)
50-
]
44+
appvms = []
45+
dom0 = domains["dom0"]
46+
default_dispvm = getattr(dom0.app, "default_dispvm", None)
47+
# Only add default_dispvm now if it will not be added by the other clause.
48+
if (
49+
int(dom0.features.get("preload-dispvm-max", 0) or 0) > 0
50+
and default_dispvm
51+
and int(default_dispvm.features.get("preload-dispvm-max", 0) or 0) == 0
52+
):
53+
appvms.append(default_dispvm)
54+
appvms.extend(
55+
[
56+
qube
57+
for qube in domains
58+
if int(qube.features.get("preload-dispvm-max", 0) or 0) > 0
59+
and qube.klass == "AppVM"
60+
and getattr(qube, "template_for_dispvms", False)
61+
]
62+
)
63+
return appvms
5164

5265

5366
class DispVM(qubes.vm.qubesvm.QubesVM):

0 commit comments

Comments
 (0)