-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
0011-libxl-add-support-for-emulator-kernel-and-ramdisk-pa.patch
134 lines (127 loc) · 4.97 KB
/
0011-libxl-add-support-for-emulator-kernel-and-ramdisk-pa.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
From efceecae6a35be5a297fb6dbc49ffc2cbe155a3c Mon Sep 17 00:00:00 2001
From: Dmitry Fedorov <[email protected]>
Date: Wed, 13 Apr 2022 16:19:49 +0200
Subject: [PATCH] libxl: add support for emulator' kernel and ramdisk path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add ability to configure emulator kernel and ramdisk path.
Signed-off-by: Dmitry Fedorov <[email protected]>
Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
src/conf/domain_conf.c | 6 ++++++
src/conf/domain_conf.h | 2 ++
src/conf/schemas/domaincommon.rng | 20 ++++++++++++++++++++
src/libxl/libxl_conf.c | 19 +++++++++++++++++++
4 files changed, 47 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3832937d37..93daae18f6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4019,6 +4019,8 @@ void virDomainDefFree(virDomainDef *def)
virBitmapFree(def->cpumask);
g_free(def->emulator);
g_free(def->emulator_cmdline);
+ g_free(def->emulator_kernel);
+ g_free(def->emulator_ramdisk);
g_free(def->description);
g_free(def->title);
g_free(def->kvm_features);
@@ -18989,6 +18991,8 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt,
}
}
def->emulator_cmdline = virXPathString("string(./devices/emulator/@cmdline)", ctxt);
+ def->emulator_kernel = virXPathString("string(./devices/emulator/@kernel)", ctxt);
+ def->emulator_ramdisk = virXPathString("string(./devices/emulator/@ramdisk)", ctxt);
n = virXPathULongLong("string(./devices/emulator/@memory)",
ctxt,
@@ -28250,6 +28254,8 @@ virDomainDefFormatInternalSetRootName(virDomainDef *def,
if (def->emulator_memory != 0)
virBufferAsprintf(buf, " memory='%llu'", def->emulator_memory);
virBufferEscapeString(buf, " cmdline='%s'", def->emulator_cmdline);
+ virBufferEscapeString(buf, " kernel='%s'", def->emulator_kernel);
+ virBufferEscapeString(buf, " ramdisk='%s'", def->emulator_ramdisk);
if (!def->emulator) {
virBufferAddLit(buf, "/>\n");
} else {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 759f4f70c2..b3edac1587 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3059,6 +3059,8 @@ struct _virDomainDef {
char *emulator;
virDomainEmulatorType emulator_type;
char *emulator_cmdline;
+ char *emulator_kernel;
+ char *emulator_ramdisk;
unsigned long long emulator_memory;
/* Most {caps_,hyperv_,kvm_,}feature options utilize a virTristateSwitch
* to handle support. A few assign specific data values to the option.
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 2482bf8d1e..44c21582ce 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -4161,6 +4161,16 @@
<ref name="memoryKB"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="kernel">
+ <ref name="absFilePath"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="ramdisk">
+ <ref name="absFilePath"/>
+ </attribute>
+ </optional>
<ref name="absFilePath"/>
</group>
<group>
@@ -4176,6 +4186,16 @@
<ref name="memoryKB"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="kernel">
+ <ref name="absFilePath"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="ramdisk">
+ <ref name="absFilePath"/>
+ </attribute>
+ </optional>
<empty/>
</group>
</choice>
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 5a6738353f..39a97b0405 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -711,6 +711,25 @@ libxlMakeDomBuildInfo(virDomainDef *def,
}
}
+ if (def->emulator_kernel) {
+ if (!virFileExists(def->emulator_kernel)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("emulator's kernel '%1$s' not found"),
+ def->emulator_kernel);
+ return -1;
+ }
+ b_info->stubdomain_kernel = g_strdup(def->emulator_kernel);
+ }
+ if (def->emulator_ramdisk) {
+ if (!virFileExists(def->emulator_ramdisk)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("emulator's ramdisk '%1$s' not found"),
+ def->emulator_ramdisk);
+ return -1;
+ }
+ b_info->stubdomain_ramdisk = g_strdup(def->emulator_ramdisk);
+ }
+
if (def->emulator_memory != 0)
b_info->stubdomain_memkb = def->emulator_memory;
--
2.45.2