[PATCH 3/6] cpu_conf: Simplify formatting of guest CPU attributes

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

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/conf/cpu_conf.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 6058d26fa5..02506c020b 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -604,20 +604,20 @@ virCPUDefFormatBufFull(virBufferPtr buf,
     if (!def)
         return 0;
 
-    /* Format attributes */
-    if (def->type == VIR_CPU_TYPE_GUEST) {
+    /* Format attributes for guest CPUs unless they only specify
+     * topology or cache. */
+    if (def->type == VIR_CPU_TYPE_GUEST &&
+        (def->mode != VIR_CPU_MODE_CUSTOM || def->model)) {
         const char *tmp;
 
-        if (def->mode != VIR_CPU_MODE_CUSTOM || def->model) {
-            if (!(tmp = virCPUModeTypeToString(def->mode))) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Unexpected CPU mode %d"), def->mode);
-                goto cleanup;
-            }
-            virBufferAsprintf(&attributeBuf, " mode='%s'", tmp);
+        if (!(tmp = virCPUModeTypeToString(def->mode))) {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Unexpected CPU mode %d"), def->mode);
+            goto cleanup;
         }
+        virBufferAsprintf(&attributeBuf, " mode='%s'", tmp);
 
-        if (def->model && def->mode == VIR_CPU_MODE_CUSTOM) {
+        if (def->mode == VIR_CPU_MODE_CUSTOM) {
             if (!(tmp = virCPUMatchTypeToString(def->match))) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("Unexpected CPU match policy %d"),
-- 
2.14.1

--
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]
  Powered by Linux