[virt-tools-list] [virt-manager PATCH] virt-clone: improve some error prompts

Cole Robinson crobinso at redhat.com
Wed Dec 10 12:01:15 UTC 2014


On 12/09/2014 10:40 PM, Chen, Hanxiao wrote:
>
>
>> -----Original Message-----
>> From: Cole Robinson [mailto:crobinso at redhat.com]
>> Sent: Tuesday, December 09, 2014 8:05 PM
>> To: Chen, Hanxiao/陈 晗霄; virt-tools-list at redhat.com
>> Subject: Re: [virt-tools-list] [virt-manager PATCH] virt-clone: improve some
>> error prompts
>>
>> On 12/09/2014 01:39 AM, Chen Hanxiao wrote:
>>> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
>>> ---
>>>    virt-clone | 6 ++++--
>>>    1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/virt-clone b/virt-clone
>>> index 4bd5ca3..78f7885 100755
>>> --- a/virt-clone
>>> +++ b/virt-clone
>>> @@ -39,7 +39,8 @@ def get_clone_name(new_name, auto_clone, design):
>>>            logging.debug("Auto-generated clone name '%s'", new_name)
>>>
>>>        if not new_name:
>>> -        fail(_("A name is required for the new virtual machine."))
>>> +        fail(_("A name is required for the new virtual machine,"
>>> +            " use '-n NAME' to specify one."))
>>>        design.clone_name = new_name
>>>
>>>
>>> @@ -57,7 +58,8 @@ def get_original_guest(guest_name, origfile, design):
>>>                fail(e)
>>>
>>>        if not guest_name:
>>> -        fail(_("An original machine name or xml file is required."))
>>> +        fail(_("An original machine name or xml file is required.\n"
>>> +            "Try '-o ORIGINAL_GUEST' or '--original-xml=ORIGINAL_XML'."))
>>>        design.original_guest = guest_name
>>>
>>>
>>>
>>
>> I'd rather not complicate the second error message with --original-xml, since
>> that should be a very rarely used option.
>>
>> Also, I'd prefer documenting the long options instead, so --name and
>> --original. Feel free to just push the updating patch
>>
>
>
> Thanks for your comments.
>
> I updated it as the diff below and pushed.
>
> - Chen
>
> index 78f7885..6001bf7 100755
> --- a/virt-clone
> +++ b/virt-clone
> @@ -40,7 +40,7 @@ def get_clone_name(new_name, auto_clone, design):
>
>       if not new_name:
>           fail(_("A name is required for the new virtual machine,"
> -            " use '-n NAME' to specify one."))
> +            " use '--name NEW_VM_NAME' to specify one."))
>       design.clone_name = new_name
>
>
> @@ -58,8 +58,8 @@ def get_original_guest(guest_name, origfile, design):
>               fail(e)
>
>       if not guest_name:
> -        fail(_("An original machine name or xml file is required.\n"
> -            "Try '-o ORIGINAL_GUEST' or '--original-xml=ORIGINAL_XML'."))
> +        fail(_("An original machine name is required,"
> +            " use '--original ORIGINAL_GUEST' and try again."))
>       design.original_guest = guest_name
>

Looks good

Thanks,
Cole




More information about the virt-tools-list mailing list