[libvirt] [PATCH] virsh: domain: Fix option handling in domxml-to-native

Peter Krempa posted 1 patch 6 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/d5492596b0545e679150dd0f1f0812e530aeffd9.1508831491.git.pkrempa@redhat.com
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] virsh: domain: Fix option handling in domxml-to-native
Posted by Peter Krempa 6 years, 6 months ago
Commit fdeac7a05fdf85458d72e89efcfa0f444525aaad tried to fix the output
of 'virsh --help domxml-to-native' by switching types around. One of the
changes broke the option parser. VSH_OT_ARGV should be used only for
variable argument count, not to make the help generator look pretty.

The correct option type in this case is VSH_OT_STRING as it's not
mandatory now since it can be substituted by using --domain.

This makes --help for this command look incorrect, but the parser works
as it should.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1494400
---
 tools/virsh-domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e1a312a6a..1e33e8295 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10152,7 +10152,7 @@ static const vshCmdOptDef opts_domxmltonative[] = {
      .help = N_("domain name, id or uuid")
     },
     {.name = "xml",
-     .type = VSH_OT_ARGV,
+     .type = VSH_OT_STRING,
      .help = N_("xml data file to export from")
     },
     {.name = NULL}
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: domain: Fix option handling in domxml-to-native
Posted by Pavel Hrdina 6 years, 6 months ago
On Tue, Oct 24, 2017 at 09:51:31AM +0200, Peter Krempa wrote:
> Commit fdeac7a05fdf85458d72e89efcfa0f444525aaad tried to fix the output
> of 'virsh --help domxml-to-native' by switching types around. One of the
> changes broke the option parser. VSH_OT_ARGV should be used only for
> variable argument count, not to make the help generator look pretty.
> 
> The correct option type in this case is VSH_OT_STRING as it's not
> mandatory now since it can be substituted by using --domain.
> 
> This makes --help for this command look incorrect, but the parser works
> as it should.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1494400
> ---
>  tools/virsh-domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list