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

Michal Prívozník mprivozn at redhat.com
Wed Jan 26 16:04:31 UTC 2022


On 1/26/22 16:43, 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(-)
> 


> @@ -9627,9 +9627,6 @@ cmdDomSetLaunchSecState(vshControl * ctl, const vshCmd * cmd)
>      if (vshCommandOptStringReq(ctl, cmd, "secret", &secfile) < 0)
>          return false;
>  
> -    if (sechdrfile == NULL || secfile == NULL)
> -        return false;
> -
>      if (virFileReadAll(sechdrfile, 1024*64, &sechdr) < 0) {
>          vshSaveLibvirtError();
>          return false;

In a follow up patch this check should be reintroduced to qemu driver
impl because there's no way it can work if neither is passed to the API.

But for this patch as is:

Reviewed-by: Michal Privoznik <mprivozn at redhat.com>

Michal




More information about the libvir-list mailing list