support for Xen HVM Viridian (Hyper-V) enlightenment interface

Introduce libvirt support for Xen HVM Viridian (Hyper-V) enlightenment
interface guest feature.

 src/conf/domain_conf.c     |    3 ++-
 src/conf/domain_conf.h     |    1 +
 src/xen/xen_hypervisor.c   |   11 +++++++++++
 src/xenapi/xenapi_driver.c |    2 ++
 src/xenapi/xenapi_utils.c  |    2 ++
 src/xenxs/xen_sxpr.c       |    4 ++++
 src/xenxs/xen_xm.c         |   12 +++++++++++-
 7 files changed, 33 insertions(+), 2 deletions(-)
This commit is contained in:
Daniel Gollub 2011-06-15 15:27:43 +02:00 committed by Eric Blake
parent a2ff807a68
commit c4bd6d96f4
8 changed files with 34 additions and 2 deletions

View File

@ -176,6 +176,7 @@ Patches have also been contributed by:
Neil Wilson <neil@aldur.co.uk>
Ohad Levy <ohadlevy@gmail.com>
Michael Chapman <mike@very.puzzling.org>
Daniel Gollub <gollub@b1-systems.de>
[....send patches to get your name here....]

View File

@ -84,7 +84,8 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
"acpi",
"apic",
"pae",
"hap")
"hap",
"viridian")
VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST,
"destroy",

View File

@ -899,6 +899,7 @@ enum virDomainFeature {
VIR_DOMAIN_FEATURE_APIC,
VIR_DOMAIN_FEATURE_PAE,
VIR_DOMAIN_FEATURE_HAP,
VIR_DOMAIN_FEATURE_VIRIDIAN,
VIR_DOMAIN_FEATURE_LAST
};

View File

@ -2401,7 +2401,18 @@ xenHypervisorBuildCapabilities(virConnectPtr conn,
0,
1) == NULL)
goto no_memory;
/* Xen 3.4.x and beyond supports the Viridian (Hyper-V)
* enlightenment interface. Default is off.
*/
if ((hv_major == 3 && hv_minor >= 4) || (hv_major > 3))
if (virCapabilitiesAddGuestFeature(guest,
"viridian",
0,
1) == NULL)
goto no_memory;
}
}
caps->defaultConsoleTargetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;

View File

@ -1430,6 +1430,8 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, int flags ATTRIBUTE_UNUSED)
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_PAE);
else if (STREQ(result->contents[i].key, "hap"))
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_HAP);
else if (STREQ(result->contents[i].key, "viridian"))
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_VIRIDIAN);
}
}
xen_string_string_map_free(result);

View File

@ -536,6 +536,8 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
allocStringMap(&strings, (char *)"pae", (char *)"true");
if (def->features & (1 << VIR_DOMAIN_FEATURE_HAP))
allocStringMap(&strings, (char *)"hap", (char *)"true");
if (def->features & (1 << VIR_DOMAIN_FEATURE_VIRIDIAN))
allocStringMap(&strings, (char *)"viridian", (char *)"true");
}
if (strings != NULL)
(*record)->platform = strings;

View File

@ -1171,6 +1171,8 @@ xenParseSxpr(const struct sexpr *root,
def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
if (sexpr_int(root, "domain/image/hvm/hap"))
def->features |= (1 << VIR_DOMAIN_FEATURE_HAP);
if (sexpr_int(root, "domain/image/hvm/viridian"))
def->features |= (1 << VIR_DOMAIN_FEATURE_VIRIDIAN);
/* Old XenD only allows localtime here for HVM */
if (sexpr_int(root, "domain/image/hvm/localtime"))
@ -2166,6 +2168,8 @@ xenFormatSxpr(virConnectPtr conn,
virBufferAddLit(&buf, "(pae 1)");
if (def->features & (1 << VIR_DOMAIN_FEATURE_HAP))
virBufferAddLit(&buf, "(hap 1)");
if (def->features & (1 << VIR_DOMAIN_FEATURE_VIRIDIAN))
virBufferAddLit(&buf, "(viridian 1)");
virBufferAddLit(&buf, "(usb 1)");

View File

@ -369,6 +369,10 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto cleanup;
else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_HAP);
if (xenXMConfigGetBool(conf, "viridian", &val, 0) < 0)
goto cleanup;
else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_VIRIDIAN);
if (xenXMConfigGetBool(conf, "hpet", &val, -1) < 0)
goto cleanup;
@ -1507,12 +1511,18 @@ virConfPtr xenFormatXM(virConnectPtr conn,
(1 << VIR_DOMAIN_FEATURE_APIC)) ? 1 : 0) < 0)
goto no_memory;
if (xendConfigVersion >= 3)
if (xendConfigVersion >= 3) {
if (xenXMConfigSetInt(conf, "hap",
(def->features &
(1 << VIR_DOMAIN_FEATURE_HAP)) ? 1 : 0) < 0)
goto no_memory;
if (xenXMConfigSetInt(conf, "viridian",
(def->features &
(1 << VIR_DOMAIN_FEATURE_VIRIDIAN)) ? 1 : 0) < 0)
goto no_memory;
}
if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) {
if (def->clock.data.timezone) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,