Commit 2a576b7cc5c3 ("v2v: -o libvirt: Don't write only <vendor> without <model> (RHBZ#1591789).", 2018-06-21) introduced a path in the code where we create a childless
<cpu match="minimum"/> element. Namely, after said commit, in case source.s_cpu_vendor <> None && source.s_cpu_model = None && source.s_cpu_topology = None we no longer trigger a libvirt error; however, we do create the element <cpu match="minimum"/> without any children. Surprisingly, libvirt doesn't complain; it silently ignores and eliminates this element from the domain XML. Remove this code path by restricting the outer condition, for creating the <cpu> element, to: source.s_cpu_model <> None || source.s_cpu_topology <> None This reflects that "s_cpu_vendor" only plays a role if "s_cpu_model" is specified -- and the latter guarantees in itself that the <cpu> element will be generated with at least one child element. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2076013 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- output/create_libvirt_xml.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/create_libvirt_xml.ml b/output/create_libvirt_xml.ml index d2ca894d60bb..4a71f8bb27f5 100644 --- a/output/create_libvirt_xml.ml +++ b/output/create_libvirt_xml.ml @@ -157,53 +157,53 @@ let create_libvirt_xml ?pool source inspect (match source.s_genid with | None -> () | Some genid -> List.push_back body (e "genid" [] [PCData genid]) ); (match get_osinfo_id inspect with | None -> () | Some osinfo_id -> List.push_back_list body [ e "metadata" [] [ e "libosinfo:libosinfo" ["xmlns:libosinfo", "http://libosinfo.org/xmlns/libvirt/domain/1.0"] [ e "libosinfo:os" ["id", osinfo_id] []; ]; ]; ]; ); let memory_k = source.s_memory /^ 1024L in List.push_back_list body [ e "memory" ["unit", "KiB"] [PCData (Int64.to_string memory_k)]; e "currentMemory" ["unit", "KiB"] [PCData (Int64.to_string memory_k)]; e "vcpu" [] [PCData (string_of_int source.s_vcpu)] ]; - if source.s_cpu_vendor <> None || source.s_cpu_model <> None || + if source.s_cpu_model <> None || source.s_cpu_topology <> None then ( let cpu = ref [] in (match source.s_cpu_model with | None -> () | Some model -> (match source.s_cpu_vendor with | None -> () | Some vendor -> List.push_back cpu (e "vendor" [] [PCData vendor]) ); List.push_back cpu (e "model" ["fallback", "allow"] [PCData model]) ); (match source.s_cpu_topology with | None -> () | Some { s_cpu_sockets; s_cpu_cores; s_cpu_threads } -> let topology_attrs = [ "sockets", string_of_int s_cpu_sockets; "cores", string_of_int s_cpu_cores; "threads", string_of_int s_cpu_threads; ] in List.push_back cpu (e "topology" topology_attrs []) ); List.push_back_list body [ e "cpu" [ "match", "minimum" ] !cpu ] ); -- 2.19.1.3.g30247aa5d201 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs