Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- docs/manpages/virsh.rst | 9 ++++++--- tools/virsh-host.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index c855269041..8fee4c7afe 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -866,7 +866,7 @@ cpu-compare :: - cpu-compare FILE [--error] + cpu-compare FILE [--error] [--validate] Compare CPU definition from XML <file> with host CPU. (See ``hypervisor-cpu-compare`` command for comparing the CPU definition with the CPU @@ -882,7 +882,8 @@ the CPU definition. For more information on guest CPU definition see: `https://libvirt.org/formatdomain.html#elementsCPU <https://libvirt.org/formatdomain.html#elementsCPU>`__. If *--error* is specified, the command will return an error when the given CPU is incompatible with host CPU and a message providing more details about the -incompatibility will be printed out. +incompatibility will be printed out. If *--validate* is specified, validates +the format of the XML document against an internal RNG schema. cpu-models @@ -928,7 +929,7 @@ hypervisor-cpu-compare :: - hypervisor-cpu-compare FILE [virttype] [emulator] [arch] [machine] [--error] + hypervisor-cpu-compare FILE [virttype] [emulator] [arch] [machine] [--error] [--validate] Compare CPU definition from XML <file> with the CPU the hypervisor is able to provide on the host. (This is different from ``cpu-compare`` which compares the @@ -951,6 +952,8 @@ specifies the path to the emulator, *arch* specifies the CPU architecture, and *machine* specifies the machine type. If *--error* is specified, the command will return an error when the given CPU is incompatible with the host CPU and a message providing more details about the incompatibility will be printed out. +If *--validate* is specified, validates the format of the XML document against +an internal RNG schema. hypervisor-cpu-baseline diff --git a/tools/virsh-host.c b/tools/virsh-host.c index d4eb3f977d..cda2ef4ac1 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1214,6 +1214,10 @@ static const vshCmdOptDef opts_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("validate the XML document against schema") + }, {.name = NULL} }; @@ -1230,6 +1234,9 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "error")) flags |= VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE; + if (vshCommandOptBool(cmd, "validate")) + flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML; + if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0) return false; @@ -1636,6 +1643,10 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = { .type = VSH_OT_BOOL, .help = N_("report error if CPUs are incompatible") }, + {.name = "validate", + .type = VSH_OT_BOOL, + .help = N_("validate the XML document against schema") + }, {.name = NULL} }; @@ -1657,6 +1668,9 @@ cmdHypervisorCPUCompare(vshControl *ctl, if (vshCommandOptBool(cmd, "error")) flags |= VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE; + if (vshCommandOptBool(cmd, "validate")) + flags |= VIR_CONNECT_COMPARE_CPU_VALIDATE_XML; + if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0 || vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 || vshCommandOptStringReq(ctl, cmd, "emulator", &emulator) < 0 || -- 2.26.2