-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
0009-libxl-add-support-for-qubes-graphic-device.patch
354 lines (335 loc) · 13.4 KB
/
0009-libxl-add-support-for-qubes-graphic-device.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
From d9407161ed3a0e78e27f67ffb3ca99eb605c69d5 Mon Sep 17 00:00:00 2001
From: HW42 <[email protected]>
Date: Sat, 22 Apr 2017 08:57:58 +0200
Subject: [PATCH] libxl: add support for qubes graphic device
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
src/conf/domain_conf.c | 43 +++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 5 ++++
src/conf/schemas/domaincommon.rng | 13 ++++++++++
src/libxl/libxl_conf.c | 9 +++++++
src/libxl/libxl_domain.c | 1 +
src/libxl/libxl_driver.c | 1 +
src/qemu/qemu_command.c | 2 ++
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_driver.c | 2 ++
src/qemu/qemu_hotplug.c | 1 +
src/qemu/qemu_process.c | 5 ++++
src/qemu/qemu_validate.c | 1 +
src/vmx/vmx.c | 1 +
13 files changed, 85 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 093568fd1c..befc5e97ff 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -952,6 +952,7 @@ VIR_ENUM_IMPL(virDomainGraphics,
"vnc",
"rdp",
"desktop",
+ "qubes",
"spice",
"egl-headless",
"dbus",
@@ -2003,6 +2004,10 @@ void virDomainGraphicsDefFree(virDomainGraphicsDef *def)
g_free(def->data.desktop.display);
break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
+ VIR_FREE(def->data.qubes_gui.domain);
+ break;
+
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
g_free(def->data.spice.rendernode);
g_free(def->data.spice.keymap);
@@ -11531,6 +11536,30 @@ virDomainGraphicsDefParseXMLDesktop(virDomainGraphicsDef *def,
return 0;
}
+static int virDomainGraphicsDefParseXMLQubes(virDomainGraphicsDef *def,
+ xmlNodePtr node)
+{
+ int ret = -1;
+ char *log_level = virXMLPropString(node, "log_level");
+
+ if (log_level) {
+ if (virStrToLong_i(log_level, NULL, 10,
+ &def->data.qubes_gui.log_level) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse Qubes GUI log_level %1$s"), log_level);
+ goto error;
+ }
+ } else {
+ def->data.qubes_gui.log_level = 0;
+ }
+
+ def->data.qubes_gui.domain = virXMLPropString(node, "domain");
+
+ ret = 0;
+ error:
+ VIR_FREE(log_level);
+ return ret;
+}
static int
virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDef *def,
@@ -11817,6 +11846,10 @@ virDomainGraphicsDefParseXML(virDomainXMLOption *xmlopt,
if (virDomainGraphicsDefParseXMLDesktop(def, node) < 0)
goto error;
break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
+ if (virDomainGraphicsDefParseXMLQubes(def, node) < 0)
+ goto error;
+ break;
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
if (virDomainGraphicsDefParseXMLSpice(def, node, ctxt, flags) < 0)
goto error;
@@ -26157,6 +26190,14 @@ virDomainGraphicsDefFormat(virBuffer *buf,
break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
+ if (def->data.qubes_gui.domain)
+ virBufferEscapeString(buf, " domain='%s'",
+ def->data.qubes_gui.domain);
+ virBufferAsprintf(buf, " log_level='%d'",
+ def->data.qubes_gui.log_level);
+ break;
+
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
if (!glisten) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -31048,6 +31089,7 @@ virDomainGraphicsDefHasOpenGL(const virDomainDef *def)
switch (graphics->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
continue;
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
@@ -31109,6 +31151,7 @@ virDomainGraphicsGetRenderNode(const virDomainGraphicsDef *graphics)
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
break;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b1b29df20d..44a9a6ab5c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1850,6 +1850,7 @@ typedef enum {
VIR_DOMAIN_GRAPHICS_TYPE_VNC,
VIR_DOMAIN_GRAPHICS_TYPE_RDP,
VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
+ VIR_DOMAIN_GRAPHICS_TYPE_QUBES,
VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS,
VIR_DOMAIN_GRAPHICS_TYPE_DBUS,
@@ -2026,6 +2027,10 @@ struct _virDomainGraphicsDef {
virTristateBool gl;
char *rendernode;
} spice;
+ struct {
+ char *domain;
+ int log_level;
+ } qubes_gui;
struct {
char *rendernode;
} egl_headless;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 684335d6a2..3e21b51dd8 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -4285,6 +4285,19 @@
<ref name="listenElements"/>
</interleave>
</group>
+ <group>
+ <attribute name="type">
+ <value>qubes</value>
+ </attribute>
+ <attribute name="domain">
+ <text/>
+ </attribute>
+ <optional>
+ <attribute name="log_level">
+ <data type="integer"/>
+ </attribute>
+ </optional>
+ </group>
<group>
<attribute name="type">
<value>spice</value>
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 80d17a0b0b..40106d901c 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1576,6 +1576,9 @@ libxlMakeVfb(virPortAllocatorRange *graphicsports,
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
+ libxl_defbool_set(&x_vfb->vnc.enable, false);
+ libxl_defbool_set(&x_vfb->sdl.enable, false);
}
return 0;
@@ -1650,6 +1653,12 @@ libxlMakeBuildInfoVfb(virPortAllocatorRange *graphicsports,
unsigned short port;
virDomainGraphicsListenDef *glisten = NULL;
+ if (l_vfb->type == VIR_DOMAIN_GRAPHICS_TYPE_QUBES) {
+ libxl_defbool_set(&b_info->u.hvm.qubes_gui.enable, true);
+ b_info->u.hvm.qubes_gui.domname = g_strdup(l_vfb->data.qubes_gui.domain);
+ b_info->u.hvm.qubes_gui.log_level = l_vfb->data.qubes_gui.log_level;
+ }
+
if (l_vfb->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
continue;
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 0f129ec69c..1a2487e999 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -876,6 +876,7 @@ libxlDomainCleanup(libxlDriverPrivate *driver,
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 9c0b8c866c..6aac88d940 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -461,6 +461,7 @@ libxlReconnectDomain(virDomainObj *vm,
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6ec1e9cbef..b02b09a825 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8560,6 +8560,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfig *cfg,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
return -1;
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
default:
@@ -10149,6 +10150,7 @@ qemuBuildCommandLineValidate(virQEMUDriver *driver,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
break;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1a90311ca5..4f993c2935 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3973,6 +3973,7 @@ qemuDomainDefSuggestDefaultAudioBackend(virQEMUDriver *driver,
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
break;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fc1704f4fc..0ece9924e4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14712,6 +14712,7 @@ qemuDomainOpenGraphics(virDomainPtr dom,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -14783,6 +14784,7 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom,
break;
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 4a3f4f657e..1fbb52a77b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4445,6 +4445,7 @@ qemuDomainChangeGraphics(virQEMUDriver *driver,
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b9b6ccf1de..6f5ff93cf6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4819,6 +4819,7 @@ qemuProcessGraphicsReservePorts(virDomainGraphicsDef *graphics,
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
@@ -4859,6 +4860,7 @@ qemuProcessGraphicsAllocatePorts(virQEMUDriver *driver,
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
@@ -5027,6 +5029,7 @@ qemuProcessGraphicsSetupListen(virQEMUDriver *driver,
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
@@ -5113,6 +5116,7 @@ qemuProcessGraphicsSetupRenderNode(virDomainGraphicsDef *graphics,
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
virReportEnumRangeError(virDomainGraphicsType, graphics->type);
break;
@@ -5334,6 +5338,7 @@ qemuProcessStartValidateGraphics(virDomainObj *vm)
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
case VIR_DOMAIN_GRAPHICS_TYPE_DBUS:
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index b392428f48..f0a0a91bf5 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4412,6 +4412,7 @@ qemuValidateDomainDeviceDefGraphics(const virDomainGraphicsDef *graphics,
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
break;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index d082a07660..1cbdcaf5b5 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3511,6 +3511,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOption *xmlopt, virDomainDef
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_QUBES:
case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS:
--
2.45.2