-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
0010-libxl-add-support-for-stubdom_mem-option.patch
119 lines (112 loc) · 4.23 KB
/
0010-libxl-add-support-for-stubdom_mem-option.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
From 0255a4579ed2f7920b3156e8a5cbe0a4a47de278 Mon Sep 17 00:00:00 2001
From: HW42 <hw42@ipsumj.de>
Date: Sat, 22 Apr 2017 08:59:12 +0200
Subject: [PATCH] libxl: add support for stubdom_mem option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
src/conf/domain_conf.c | 21 +++++++++++++++++++++
src/conf/domain_conf.h | 1 +
src/conf/schemas/domaincommon.rng | 10 ++++++++++
src/libxl/libxl_conf.c | 3 +++
4 files changed, 35 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index befc5e97ff..3832937d37 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18990,6 +18990,17 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt,
}
def->emulator_cmdline = virXPathString("string(./devices/emulator/@cmdline)", ctxt);
+ n = virXPathULongLong("string(./devices/emulator/@memory)",
+ ctxt,
+ &def->emulator_memory);
+ if (n == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("emulator memory (in KiB) must be an integer"));
+ return NULL;
+ } else if (n < 0) {
+ def->emulator_memory = 0;
+ }
+
/* analysis of the disk devices */
if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0)
return NULL;
@@ -21579,6 +21590,14 @@ virDomainDefCheckABIStabilityFlags(virDomainDef *src,
goto error;
}
+ if (src->emulator_memory != dst->emulator_memory) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target domain emulator memory size %1$llu does not match source %2$llu"),
+ dst->emulator_memory,
+ src->emulator_memory);
+ goto error;
+ }
+
if (!virDomainDefFeaturesCheckABIStability(src, dst))
goto error;
@@ -28228,6 +28247,8 @@ virDomainDefFormatInternalSetRootName(virDomainDef *def,
virBufferAsprintf(buf, " type='%s'",
virDomainEmulatorTypeTypeToString(def->emulator_type));
}
+ if (def->emulator_memory != 0)
+ virBufferAsprintf(buf, " memory='%llu'", def->emulator_memory);
virBufferEscapeString(buf, " cmdline='%s'", def->emulator_cmdline);
if (!def->emulator) {
virBufferAddLit(buf, "/>\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 44a9a6ab5c..759f4f70c2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3059,6 +3059,7 @@ struct _virDomainDef {
char *emulator;
virDomainEmulatorType emulator_type;
char *emulator_cmdline;
+ 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.
* See virDomainDefFeaturesCheckABIStability() for details. */
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 3e21b51dd8..2482bf8d1e 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -4156,6 +4156,11 @@
<text/>
</attribute>
</optional>
+ <optional>
+ <attribute name="memory">
+ <ref name="memoryKB"/>
+ </attribute>
+ </optional>
<ref name="absFilePath"/>
</group>
<group>
@@ -4166,6 +4171,11 @@
<value>stubdom-linux</value>
</choice>
</attribute>
+ <optional>
+ <attribute name="memory">
+ <ref name="memoryKB"/>
+ </attribute>
+ </optional>
<empty/>
</group>
</choice>
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 40106d901c..5a6738353f 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -711,6 +711,9 @@ libxlMakeDomBuildInfo(virDomainDef *def,
}
}
+ if (def->emulator_memory != 0)
+ b_info->stubdomain_memkb = def->emulator_memory;
+
if (def->nserials) {
if (def->nserials == 1) {
if (libxlMakeChrdevStr(def->serials[0], &b_info->u.hvm.serial) <
--
2.45.2