Richard W.M. Jones
2018-Jun-15 15:18 UTC
[Libguestfs] [PATCH] v2v: -o libvirt: Don't write only <vendor> without <model> (RHBZ#1591789).
Avoids the libvirt error: error: XML error: CPU vendor specified without CPU model --- v2v/create_libvirt_xml.ml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml index 582419f00..fbe90eeaa 100644 --- a/v2v/create_libvirt_xml.ml +++ b/v2v/create_libvirt_xml.ml @@ -51,15 +51,17 @@ let create_libvirt_xml ?pool source target_buses guestcaps source.s_cpu_topology <> None then ( let cpu = ref [] in - (match source.s_cpu_vendor with - | None -> () - | Some vendor -> - List.push_back cpu (e "vendor" [] [PCData vendor]) - ); - (match source.s_cpu_model with - | None -> () - | Some model -> + (match source.s_cpu_vendor, source.s_cpu_model with + | None, None + (* Avoid libvirt error: "CPU vendor specified without CPU model" *) + | Some _, None -> () + | None, Some model -> List.push_back cpu (e "model" ["fallback", "allow"] [PCData model]) + | Some vendor, Some model -> + List.push_back_list cpu [ + e "vendor" [] [PCData vendor]; + e "model" ["fallback", "allow"] [PCData model] + ] ); (match source.s_cpu_topology with | None -> () -- 2.16.2
Pino Toscano
2018-Jun-21 11:11 UTC
Re: [Libguestfs] [PATCH] v2v: -o libvirt: Don't write only <vendor> without <model> (RHBZ#1591789).
On Friday, 15 June 2018 17:18:57 CEST Richard W.M. Jones wrote:> Avoids the libvirt error: > > error: XML error: CPU vendor specified without CPU model > ---LGTM. Thanks, -- Pino Toscano
Reasonably Related Threads
- [PATCH] v2v: rework handling of CPU topology
- [PATCH 4/4] v2v: Pass CPU vendor, model and topology from source to target.
- Re: [PATCH] v2v: Set machine type explicitly for outputs which support it (RHBZ#1581428).
- Re: [PATCH] v2v: Preserve VM Generation ID (RHBZ#1598350).
- [PATCH] v2v: Set machine type explicitly for outputs which support it (RHBZ#1581428).