On 10/08/2009 06:14 AM, Daniel P. Berrange wrote:
On Wed, Oct 07, 2009 at 05:04:40PM -0400, Laine Stump wrote:
> (Yes, you read the subject correctly - 3 of 2!)
>
> The minimal XML returned from ncf_if_xml_state() doesn't contain these
> attributes, and it was preventing it from passing through the
> parse/format step (making my patches from earlier today unusable).
>
> Because adding an "UNSPECIFIED" value to the enums for type and
> startmode would have made it possible for someone to send xml with,
> eg, type="unspecified" (which we don't want), I've followed the
> convention already used for the dhcp "peerdns" attribute - if it isn't
> specified, the value is -1.
>
IMHO 'type' should always be a mandatory attribute. There's no reason
why the live XML dump should not include it - we shouldn't make it
optional merely because it hasn't been implemented fully yet.
So I need to either 1) find the proper way of getting the interface type
from somewhere other than the config file, 2) use the interface type
from the config file (even though we've just decided to not put any info
from the config file into the live info) or 3) just insert a default
type. And whatever I do, I need to do it before any of this
functionality is usable.
I don't like (3) - it's one thing to have default behavior that is
unnamed, but something entirely different to call it, eg, "ethernet",
which may imply other behavior to a person. I don't immediately have a
method to do (1), so unless someone has an idea for that, I'm left with
(2), which is fairly straightforward, but we'd said we didn't want to do
that (or am I taking the edict of "no info from config files" too far?).