On Mon, 27 Feb 2012 20:07:28 -0600 Michael Roth <mdr...@linux.vnet.ibm.com> wrote:
> What about something like this instead: > > { 'enum': 'GuestIpAddressType', > 'data': [ 'ipv4', 'ipv6' ] } > > { 'type': 'GuestIpAddress', > 'data': {'ip-address': 'str', > 'ip-address-type': 'GuestIpAddressType', > 'prefix': 'int'} } > > { 'type': 'GuestNetworkInterface', > 'data': {'interface': {'name': 'str', > '*hardware-address': 'str', > '*ip-addresses': ['GuestIpAddress'] } } } > > { 'type': 'GuestNetworkInfo', > 'data': { 'interfaces': ['GuestNetworkInterfaces'] } } > > { 'command': 'guest-network-info', > 'returns': 'GuestNetworkInfo' } > > In the future we might have: > > { 'type': 'GuestNetworkInfo', > 'data': { 'interfaces': ['GuestNetworkInterfaces'], > 'routes': ['GuestNetworkRoute'], > 'bridges': ['GuestNetworkBridge'], > 'firewall-rules': ['firewall-rule'], # yikes > etc. } } Both approaches are fine to me, but another possibility is to split this into multiple commands, like guest-interfaces-info, guest-routes-info etc. This would allow for simpler commands with less clutter. > > Once we settle down on this I can send another version for review. > > Personally, if guest agent would report description (see my other e-mail > > [1]) I don't see big advantage in introducing dozens of error codes here. > > descriptions are mapped to QERRs though, so it'd only be useful if you > defined specific errors for these cases. I agree with Luiz, but at the > same time it's not exactly tractable to enumerate all possible errors for > every > command into a unique QERR except for common things like FD_NOT_FOUND. So > maybe > just a QERR_QGA_INTERFACE_ENUMERATION_FAILED, that took a stringified error > message? I don't really have a strong opinion either way. Well, turns out I'm not sure what to do here either. On the one hand it's a huge work (and probably unnecessary) to add all possible errors. On the other hand, it's really hard to debug a problem when all information you have is a generic error. As this a relatively simple query command, I'm fine with simple/generic errors.