[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] 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(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0d9fef4..a90f676 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 41c8136..e591268 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -890,6 +890,7 @@ enum virDomainFeature {
     VIR_DOMAIN_FEATURE_APIC,
     VIR_DOMAIN_FEATURE_PAE,
     VIR_DOMAIN_FEATURE_HAP,
+    VIR_DOMAIN_FEATURE_VIRIDIAN,
 
     VIR_DOMAIN_FEATURE_LAST
 };
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 21e6645..ff9c8cb 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -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;
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 6f64208..58e762f 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1414,6 +1414,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);
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 9362cf1..342ae5b 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -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;
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 59d585d..b5877bb 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -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)");
 
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index accf5f4..c9440fa 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -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,
-- 
1.7.1



-- 
Daniel Gollub
Linux Consultant & Developer
Tel.: +49-160 47 73 970 
Mail: gollub b1-systems de

B1 Systems GmbH
Osterfeldstra├če 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]