]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Add support for VIR_CONNECT_BASELINE_CPU_IGNORE_HOST flag
authorJiri Denemark <jdenemar@redhat.com>
Wed, 25 Jun 2025 11:53:42 +0000 (13:53 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 18 Jul 2025 09:56:14 +0000 (11:56 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/manpages/virsh.rst
tools/virsh-host.c

index 7082ca773aedaebfece44d609b622198a2d1cea0..bcb5495ed97812edca764f1f14c33c00127e8694 100644 (file)
@@ -1012,14 +1012,15 @@ hypervisor-cpu-baseline
 ::
 
    hypervisor-cpu-baseline [FILE] [virttype] [emulator] [arch] [machine]
-      [--features] [--migratable] [model]
+      [--features] [--migratable] [--ignore-host] [model]
 
 Compute a baseline CPU which will be compatible with all CPUs defined in an XML
 *FILE*. This command must be called on one of the hosts described in *FILE*.
 Calling it on another host results in an undefined behavior as the computed CPU
 model is influenced by the hypervisor (the result may use an unexpected CPU
 model or some features may disabled even though they are supported on all input
-CPUs).
+CPUs). The undefined behavior can be avoided using *--ignore-host* option (see
+below).
 
 This is different from ``cpu-baseline`` which does not consider any hypervisor
 abilities when computing the baseline CPU.
@@ -1059,7 +1060,11 @@ specifies the path to the emulator, *arch* specifies the CPU architecture, and
 resulting XML description will explicitly include all features that make up the
 CPU, without this option features that are part of the CPU model will not be
 listed in the XML description. If *--migratable* is specified, features that
-block migration will not be included in the resulting CPU.
+block migration will not be included in the resulting CPU. If *--ignore-host*
+is specified and *FILE* contains more than one CPU, the command will not
+consider hypervisor abilities when computing the baseline. With this option
+baseline can be safely computed on any host (even those not described in
+*FILE*).
 
 
 hypervisor-cpu-models
index 16f9411730ece614462b0f2912867f1b10eae6d7..51b71b512c66a42d526d55d65b4b3fc186011b63 100644 (file)
@@ -1700,6 +1700,12 @@ static const vshCmdOptDef opts_hypervisor_cpu_baseline[] = {
      .type = VSH_OT_BOOL,
      .help = N_("Do not include features that block migration")
     },
+    {.name = "ignore-host",
+     .type = VSH_OT_BOOL,
+     .help = N_("when computing baseline from several CPUs, do not take "
+                "hypervisor capabilities into account and work with input "
+                "data only")
+    },
     {.name = "model",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
@@ -1730,6 +1736,8 @@ cmdHypervisorCPUBaseline(vshControl *ctl,
         flags |= VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES;
     if (vshCommandOptBool(cmd, "migratable"))
         flags |= VIR_CONNECT_BASELINE_CPU_MIGRATABLE;
+    if (vshCommandOptBool(cmd, "ignore-host"))
+        flags |= VIR_CONNECT_BASELINE_CPU_IGNORE_HOST;
 
     if (vshCommandOptString(ctl, cmd, "file", &from) < 0 ||
         vshCommandOptString(ctl, cmd, "virttype", &virttype) < 0 ||