[libvirt PATCH] virsh: domsetlaunchsecstate: mark options as mandatory

Peter Krempa pkrempa at redhat.com
Wed Jan 26 15:59:41 UTC 2022


On Wed, Jan 26, 2022 at 16:43:52 +0100, Ján Tomko wrote:
> We exit if they are not present.
> 
> Let the virsh option parser do the checking instead of checking
> it manually. Change the type to OT_DATA (i.e. a mandatory string),
> mark them as required and remove VSH_OFLAG_REQ_OPT so that the
> header file and the secret file can be specified without the option
> names.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=2046024
> 
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
>  tools/virsh-domain.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index b56f6a90f5..d279af68b2 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -9587,13 +9587,13 @@ static const vshCmdInfo info_domsetlaunchsecstate[] = {
>  static const vshCmdOptDef opts_domsetlaunchsecstate[] = {
>      VIRSH_COMMON_OPT_DOMAIN_FULL(0),
>      {.name = "secrethdr",
> -     .type = VSH_OT_STRING,
> -     .flags = VSH_OFLAG_REQ_OPT,
> +     .type = VSH_OT_DATA,
> +     .flags = VSH_OFLAG_REQ,
>       .help = N_("path to file containing the secret header"),
>      },
>      {.name = "secret",
> -     .type = VSH_OT_STRING,
> -     .flags = VSH_OFLAG_REQ_OPT,
> +     .type = VSH_OT_DATA,
> +     .flags = VSH_OFLAG_REQ,
>       .help = N_("path to file containing the secret"),
>      },
>      {.name = "set-address",

Won't this prevent us from being able to specify a different set of
parameters to the API if e.g. the header/secret combination comes out of
fashion?




More information about the libvir-list mailing list