Skip to content

Commit

Permalink
create_libvirt_xml: honor "gcaps_default_cpu"
Browse files Browse the repository at this point in the history
If "s_cpu_model" is None and "gcaps_default_cpu" is "false", generate the
<cpu mode="host-passthrough"/> element for libvirt.

This element produces an (almost) exact copy of the host (i.e., physical)
CPU for the guest, which is the best choice for guest OSes that cannot run
on QEMU's default VCPU type -- considering that domains converted by
virt-v2v are not expected to be migrateable without further tweaks by an
administrator.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2076013
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220420162333.24069-7-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
  • Loading branch information
lersek committed Apr 22, 2022
1 parent bcc3ded commit a3e45b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion output/create_libvirt_xml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,15 @@ let create_libvirt_xml ?pool source inspect
];

if source.s_cpu_model <> None ||
not guestcaps.gcaps_default_cpu ||
source.s_cpu_topology <> None then (
let cpu_attrs = ref []
and cpu = ref [] in

(match source.s_cpu_model with
| None -> ()
| None ->
if not guestcaps.gcaps_default_cpu then
List.push_back cpu_attrs ("mode", "host-passthrough");
| Some model ->
List.push_back cpu_attrs ("match", "minimum");
(match source.s_cpu_vendor with
Expand Down

0 comments on commit a3e45b3

Please sign in to comment.