[PATCH] Set sensible defaults for cpu match and feature policy

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

 



To enable the CPU XML from the capabilities to be pasted directly
into the guest XML with no editing, pick a sensible default for
match and feature policy. The CPU match will be exact and the
feature policy will be require. This should ensure safety for
migration and give DWIM semantics for users

* src/conf/cpu_conf.c: Default to exact match and require policy
---
 src/conf/cpu_conf.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 3274659..68d3daf 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -147,12 +147,10 @@ virCPUDefParseXML(const xmlNodePtr node,
         char *match = virXMLPropString(node, "match");
 
         if (!match) {
-            if (virXPathBoolean("boolean(./model)", ctxt)) {
-                virCPUReportError(VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("Missing match attribute for CPU specification"));
-                goto error;
-            }
-            def->match = -1;
+            if (virXPathBoolean("boolean(./model)", ctxt))
+                def->match = VIR_CPU_MATCH_EXACT;
+            else
+                def->match = -1;
         } else {
             def->match = virCPUMatchTypeFromString(match);
             VIR_FREE(match);
@@ -251,7 +249,10 @@ virCPUDefParseXML(const xmlNodePtr node,
             char *strpolicy;
 
             strpolicy = virXMLPropString(nodes[i], "policy");
-            policy = virCPUFeaturePolicyTypeFromString(strpolicy);
+            if (strpolicy == NULL)
+                policy = VIR_CPU_FEATURE_REQUIRE;
+            else
+                policy = virCPUFeaturePolicyTypeFromString(strpolicy);
             VIR_FREE(strpolicy);
 
             if (policy < 0) {
-- 
1.7.2.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]