[PATCH 2/3] virsh: add support for '--validate' option in define interface
Peter Krempa
pkrempa at redhat.com
Fri Aug 6 13:17:23 UTC 2021
On Fri, Aug 06, 2021 at 15:08:15 +0200, Kristina Hanicova wrote:
> Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
> ---
> include/libvirt/libvirt-interface.h | 4 ++++
The patch summary just mentions "virsh" but this is really modifying the
API. In general API modifications are more important ...
> tools/virsh-interface.c | 10 +++++++++-
.. perhaps even to a point where the virsh change should be separate.
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/include/libvirt/libvirt-interface.h b/include/libvirt/libvirt-interface.h
> index 7591c6c7fb..e849699230 100644
> --- a/include/libvirt/libvirt-interface.h
> +++ b/include/libvirt/libvirt-interface.h
> @@ -79,6 +79,10 @@ typedef enum {
> VIR_INTERFACE_XML_INACTIVE = 1 << 0 /* dump inactive interface information */
> } virInterfaceXMLFlags;
>
> +typedef enum {
> + VIR_INTERFACE_DEFINE_VALIDATE = (1 << 0), /* Validate the XML document against schema */
> +} virInterfaceDefineFlags;
> +
> char * virInterfaceGetXMLDesc (virInterfacePtr iface,
> unsigned int flags);
> virInterfacePtr virInterfaceDefineXML (virConnectPtr conn,
Note that the comment for this function in src/libvirt-interface.c
needs to be updated as well.
For now it notes that:
* @flags: extra flags; not used yet, so callers should always pass 0
> diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
> index 41acae5dcb..f72d40baab 100644
> --- a/tools/virsh-interface.c
> +++ b/tools/virsh-interface.c
> @@ -525,6 +525,10 @@ static const vshCmdInfo info_interface_define[] = {
>
> static const vshCmdOptDef opts_interface_define[] = {
> VIRSH_COMMON_OPT_FILE(N_("file containing an XML interface description")),
> + {.name = "validate",
> + .type = VSH_OT_BOOL,
> + .help = N_("validate the XML against the schema")
> + },
You also need to add this new argument to docs/manpages/virsh.rst
More information about the libvir-list
mailing list