Blame SOURCES/0058-v2v-o-libvirt-Don-t-write-only-vendor-without-model-.patch

97ae69
From 70f1d97ef7b12fddceb3b16618072ad4c142da5c Mon Sep 17 00:00:00 2001
97ae69
From: "Richard W.M. Jones" <rjones@redhat.com>
97ae69
Date: Fri, 15 Jun 2018 16:17:35 +0100
97ae69
Subject: [PATCH] v2v: -o libvirt: Don't write only <vendor> without <model>
97ae69
 (RHBZ#1591789).
97ae69
97ae69
Avoids the libvirt error:
97ae69
97ae69
  error: XML error: CPU vendor specified without CPU model
97ae69
97ae69
(cherry picked from commit e2910eeaf84afe63887afdc62b319bff1549d296)
97ae69
---
97ae69
 v2v/create_libvirt_xml.ml | 18 ++++++++++--------
97ae69
 1 file changed, 10 insertions(+), 8 deletions(-)
97ae69
97ae69
diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml
97ae69
index 582419f00..fbe90eeaa 100644
97ae69
--- a/v2v/create_libvirt_xml.ml
97ae69
+++ b/v2v/create_libvirt_xml.ml
97ae69
@@ -51,15 +51,17 @@ let create_libvirt_xml ?pool source target_buses guestcaps
97ae69
      source.s_cpu_topology <> None then (
97ae69
     let cpu = ref [] in
97ae69
 
97ae69
-    (match source.s_cpu_vendor with
97ae69
-     | None -> ()
97ae69
-     | Some vendor ->
97ae69
-        List.push_back cpu (e "vendor" [] [PCData vendor])
97ae69
-    );
97ae69
-    (match source.s_cpu_model with
97ae69
-     | None -> ()
97ae69
-     | Some model ->
97ae69
+    (match source.s_cpu_vendor, source.s_cpu_model with
97ae69
+     | None, None
97ae69
+     (* Avoid libvirt error: "CPU vendor specified without CPU model" *)
97ae69
+     | Some _, None -> ()
97ae69
+     | None, Some model ->
97ae69
         List.push_back cpu (e "model" ["fallback", "allow"] [PCData model])
97ae69
+     | Some vendor, Some model ->
97ae69
+        List.push_back_list cpu [
97ae69
+          e "vendor" [] [PCData vendor];
97ae69
+          e "model" ["fallback", "allow"] [PCData model]
97ae69
+        ]
97ae69
     );
97ae69
     (match source.s_cpu_topology with
97ae69
      | None -> ()
97ae69
-- 
fd1da6
2.17.2
97ae69