]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Add "validate" argument to [hypervisor-]cpu-compare
authorTim Wiederhake <twiederh@redhat.com>
Wed, 7 Oct 2020 08:54:58 +0000 (10:54 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 7 Oct 2020 09:26:27 +0000 (11:26 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
docs/manpages/virsh.rst
tools/virsh-host.c

index c855269041fa7d02ef30b6e58d179f0e4ab177a8..8fee4c7afec3b95e2b2d4d7215fb31d2bead9a2f 100644 (file)
@@ -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
index d4eb3f977db15cd5696977624e1a3b1a034b1378..cda2ef4ac156e21189d41dabb2a1bacb29c210d4 100644 (file)
@@ -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 ||