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

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