Skip to content

Instantly share code, notes, and snippets.

@dylangerdaly
Last active April 17, 2019 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylangerdaly/74be3f316ce8f0ddfb27b0202aa5ec2d to your computer and use it in GitHub Desktop.
Save dylangerdaly/74be3f316ce8f0ddfb27b0202aa5ec2d to your computer and use it in GitHub Desktop.
From: Dylanger Daly <dylanger@thegrail.co>
Index: libvirt-3.3.0/docs/schemas/domaincommon.rng
===================================================================
--- libvirt-3.3.0.orig/docs/schemas/domaincommon.rng
+++ libvirt-3.3.0/docs/schemas/domaincommon.rng
@@ -5365,6 +5365,11 @@
<ref name="featurestate"/>
</element>
</optional>
+ <optional>
+ <element name="spoof_xen">
+ <ref name="featurestate"/>
+ </element>
+ </optional>
</interleave>
</element>
</define>
Index: libvirt-3.3.0/src/conf/domain_conf.c
===================================================================
--- libvirt-3.3.0.orig/src/conf/domain_conf.c
+++ libvirt-3.3.0/src/conf/domain_conf.c
@@ -165,7 +165,8 @@ VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_K
"hidden")
VIR_ENUM_IMPL(virDomainXen, VIR_DOMAIN_XEN_LAST,
- "e820_host")
+ "e820_host",
+ "spoof_xen")
VIR_ENUM_IMPL(virDomainCapsFeature, VIR_DOMAIN_CAPS_FEATURE_LAST,
"audit_control",
@@ -17745,6 +17746,7 @@ virDomainDefParseXML(xmlDocPtr xml,
switch ((virDomainXen) feature) {
case VIR_DOMAIN_XEN_E820_HOST:
+ case VIR_DOMAIN_XEN_SPOOF_XEN:
if (!(tmp = virXPathString("string(./@state)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR,
_("missing 'state' attribute for "
@@ -19737,6 +19739,7 @@ virDomainDefFeaturesCheckABIStability(vi
for (i = 0; i < VIR_DOMAIN_XEN_LAST; i++) {
switch ((virDomainXen) i) {
case VIR_DOMAIN_XEN_E820_HOST:
+ case VIR_DOMAIN_XEN_SPOOF_XEN:
if (src->xen_features[i] != dst->xen_features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of Xen feature '%s' differs: "
@@ -24775,6 +24778,7 @@ virDomainDefFormatInternal(virDomainDefP
for (j = 0; j < VIR_DOMAIN_XEN_LAST; j++) {
switch ((virDomainXen) j) {
case VIR_DOMAIN_XEN_E820_HOST:
+ case VIR_DOMAIN_XEN_SPOOF_XEN:
if (def->xen_features[j])
virBufferAsprintf(buf, "<%s state='%s'/>\n",
virDomainXenTypeToString(j),
Index: libvirt-3.3.0/src/conf/domain_conf.h
===================================================================
--- libvirt-3.3.0.orig/src/conf/domain_conf.h
+++ libvirt-3.3.0/src/conf/domain_conf.h
@@ -1704,6 +1704,7 @@ typedef enum {
typedef enum {
VIR_DOMAIN_XEN_E820_HOST = 0,
+ VIR_DOMAIN_XEN_SPOOF_XEN,
VIR_DOMAIN_XEN_LAST
} virDomainXen;
Index: libvirt-3.3.0/src/xenconfig/xen_common.c
===================================================================
--- libvirt-3.3.0.orig/src/xenconfig/xen_common.c
+++ libvirt-3.3.0/src/xenconfig/xen_common.c
@@ -557,6 +557,14 @@ xenParseCPUFeatures(virConfPtr conf,
if (xenConfigGetBool(conf, "hap", &val, 1) < 0)
return -1;
+ if (xenConfigGetBool(conf, "spoof_xen", &val, 0) < 0) {
+ return -1;
+
+ } else if (val) {
+ def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
+ def->xen_features[VIR_DOMAIN_XEN_SPOOF_XEN] = VIR_TRISTATE_SWITCH_ON;
+ }
+
else if (!val)
def->features[VIR_DOMAIN_FEATURE_HAP] = VIR_TRISTATE_SWITCH_OFF;
if (xenConfigGetBool(conf, "viridian", &val, 0) < 0)
Index: libvirt-3.3.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-3.3.0.orig/src/libxl/libxl_conf.c
+++ libvirt-3.3.0/src/libxl/libxl_conf.c
@@ -420,6 +420,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr de
def->features[VIR_DOMAIN_FEATURE_ACPI] ==
VIR_TRISTATE_SWITCH_ON);
+ if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+ switch ((virTristateSwitch) def->xen_features[VIR_DOMAIN_XEN_SPOOF_XEN]) {
+ case VIR_TRISTATE_SWITCH_ON:
+ libxl_defbool_set(&b_info->u.hvm.spoof_xen, true);
+ break;
+ case VIR_TRISTATE_SWITCH_OFF:
+ libxl_defbool_set(&b_info->u.hvm.spoof_xen, false);
+ break;
+ case VIR_TRISTATE_SWITCH_ABSENT:
+ case VIR_TRISTATE_SWITCH_LAST:
+ break;
+ }
+ }
+
if (caps && def->cpu) {
bool hasHwVirt = false;
bool svm = false, vmx = false;
Index: libvirt-3.3.0/tests/Makefile.am
===================================================================
--- libvirt-3.3.0.orig/tests/Makefile.am
+++ libvirt-3.3.0/tests/Makefile.am
@@ -268,15 +268,6 @@ endif WITH_DRIVER_MODULES
ssh_SOURCES = ssh.c
ssh_LDADD = $(COVERAGE_LDFLAGS)
-if WITH_XEN
-test_programs += xml2sexprtest sexpr2xmltest \
- xmconfigtest xencapstest
-endif WITH_XEN
-
-if WITH_LIBXL
-test_programs += xlconfigtest
-endif WITH_LIBXL
-
if WITH_QEMU
test_programs += qemuxml2argvtest qemuxml2xmltest \
qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment