From: Jiri Denemark <jdenemar(a)redhat.com>
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
docs/manpages/virsh.rst | 11 ++++++++---
tools/virsh-host.c | 8 ++++++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 7082ca773a..bcb5495ed9 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -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
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 16f9411730..51b71b512c 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -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 ||
--
2.50.0