[libvirt] [PATCH v2] interface: report generic error message of lookup failure

Guannan Ren gren at redhat.com
Wed May 15 11:23:20 UTC 2013


On 05/15/2013 05:03 PM, Laine Stump wrote:
> On 05/14/2013 08:16 PM, Guannan Ren wrote:
>> "couldn't find interface named"
>> "couldn't find interface with MAC address"
>>
>> use generic message as follows
>> "couldn't find interface with"
> If you were going to do this, having "with" at the end sounds awkward;
> it would be better to just make it "couldn't find interface '%s'".
>
> However, it doesn't make sense to make the messages in the driver itself
> generic, because they are inside functions that are specific to mac
> address / name, so it's appropriate for the error message to be specific.
>
> I think I like Dan's suggestion (3) the best - in virsh, before doing
> any lookups just try parsing the string into a mac address (with
> virMacAddrParse()) - if virMacAddrParse() is successful, you then only
> need to try lookupbymac (and can report "couldn't find interface with
> MAC address '%s' if the lookup fails), and if virMacAddrParse fails, you
> then only need to try lookupbyname.
>
> Once you've done that, you shouldn't need any changes to the libvirtd
> log messages at all.
>

    Get it,  doing generic behaviours in drivers is indeed not a good idea.
    It is the job of upper apps. I will do it still in virsh.




More information about the libvir-list mailing list