Richard W.M. Jones
2023-Feb-17 11:44 UTC
[Libguestfs] [PATCH v2v v2 3/3] -o qemu: Always use -cpu host unless overridden by source hypervisor
As with the prior commit, prefer -cpu host for all guests (except when we have more information from the source hypervisor). Although there is the disadvantage that -cpu host is non-migratable, in practice it would be very difficult to live migrate a host launched using direct qemu commands. Note that after this change, gcaps_arch_min_version is basically an informational field. No output uses it, but it will appear in debug output and there's the possibility we might use it for a future output mode. Thanks: Laszlo Ersek --- lib/types.mli | 6 +++++- output/output_qemu.ml | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/types.mli b/lib/types.mli index 743daa8a14..4a183dd3ae 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -268,7 +268,11 @@ type guestcaps = { minimum version. Notably RHEL >= 9 requires at least x86_64-v2. If the guest is capable of running on QEMU's default VCPU model - for the architecture ([-cpu qemu64]) then this is set to [0]. *) + for the architecture ([-cpu qemu64]) then this is set to [0]. + + Note this capability is not actually used by any current output + mode. It is retained in case we might use it in future, but we + might remove it if it is not used. *) gcaps_virtio_1_0 : bool; (** The guest supports the virtio devices that it does at the virtio-1.0 diff --git a/output/output_qemu.ml b/output/output_qemu.ml index 491906ebf9..2bbacb6eda 100644 --- a/output/output_qemu.ml +++ b/output/output_qemu.ml @@ -175,11 +175,7 @@ module QEMU = struct arg "-m" (Int64.to_string (source.s_memory /^ 1024L /^ 1024L)); - (match source.s_cpu_model, guestcaps.gcaps_arch_min_version with - | None, 0 -> () - | None, _ -> arg "-cpu" "host" - | Some model, _ -> arg "-cpu" model - ); + arg "-cpu" (Option.default "host" source.s_cpu_model); if source.s_vcpu > 1 then ( (match source.s_cpu_topology with -- 2.39.0
Laszlo Ersek
2023-Feb-20 10:36 UTC
[Libguestfs] [PATCH v2v v2 3/3] -o qemu: Always use -cpu host unless overridden by source hypervisor
On 2/17/23 12:44, Richard W.M. Jones wrote:> As with the prior commit, prefer -cpu host for all guests (except when > we have more information from the source hypervisor). Although there > is the disadvantage that -cpu host is non-migratable, in practice it > would be very difficult to live migrate a host launched using direct > qemu commands. > > Note that after this change, gcaps_arch_min_version is basically an > informational field. No output uses it, but it will appear in debug > output and there's the possibility we might use it for a future output > mode. > > Thanks: Laszlo Ersek > --- > lib/types.mli | 6 +++++- > output/output_qemu.ml | 6 +----- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/lib/types.mli b/lib/types.mli > index 743daa8a14..4a183dd3ae 100644 > --- a/lib/types.mli > +++ b/lib/types.mli > @@ -268,7 +268,11 @@ type guestcaps = { > minimum version. Notably RHEL >= 9 requires at least x86_64-v2. > > If the guest is capable of running on QEMU's default VCPU model > - for the architecture ([-cpu qemu64]) then this is set to [0]. *) > + for the architecture ([-cpu qemu64]) then this is set to [0]. > + > + Note this capability is not actually used by any current output > + mode. It is retained in case we might use it in future, but we > + might remove it if it is not used. *) > > gcaps_virtio_1_0 : bool; > (** The guest supports the virtio devices that it does at the virtio-1.0 > diff --git a/output/output_qemu.ml b/output/output_qemu.ml > index 491906ebf9..2bbacb6eda 100644 > --- a/output/output_qemu.ml > +++ b/output/output_qemu.ml > @@ -175,11 +175,7 @@ module QEMU = struct > > arg "-m" (Int64.to_string (source.s_memory /^ 1024L /^ 1024L)); > > - (match source.s_cpu_model, guestcaps.gcaps_arch_min_version with > - | None, 0 -> () > - | None, _ -> arg "-cpu" "host" > - | Some model, _ -> arg "-cpu" model > - ); > + arg "-cpu" (Option.default "host" source.s_cpu_model);(Ah yes, we have our own Option module from common/mlstdutils/std_utils.ml*, not the "standard" one <https://v2.ocaml.org/api/Option.html>.)> > if source.s_vcpu > 1 then ( > (match source.s_cpu_topology withReviewed-by: Laszlo Ersek <lersek at redhat.com>
Apparently Analagous Threads
- [PATCH v2v v2 0/3] Use host-model
- [PATCH] v2v: rework handling of CPU topology
- [PATCH 4/4] v2v: Pass CPU vendor, model and topology from source to target.
- [V2V PATCH v2 1/5] Revert "Remove guestcaps_block_type Virtio_SCSI"
- [V2V PATCH v2 1/5] Revert "Remove guestcaps_block_type Virtio_SCSI"