[libvirt] [PATCH] Support reporting live interface IP/netmask.

Laine Stump laine at laine.org
Mon Oct 5 16:18:33 UTC 2009


On 10/05/2009 07:02 AM, Daniel P. Berrange wrote:
> On Tue, Sep 29, 2009 at 04:02:30PM -0400, Laine Stump wrote:
>    
>> From: root<root at vlap.laine.org>
>>
>> This patch adds the flag VIR_INTERFACE_XML_INACTIVE to
>> virInterfaceGetXMLDesc's flags. When it is *not* set (the default),
>> the live interface info will be returned in the XML. in particular,
>> the IP address(es) and netmask(s) will be retrieved by querying the
>> device directly, rather than just reporting what's in the config
>> file. The backend of this is in netcf's new ncf_if_xml_state()
>> function.
>>
>> Any live interface ip address info in the xml will have the property
>> "source" set to "device", eg:
>>
>>           <ip address='10.24.0.1' prefix='24' source='device'/>
>>      
> This new 'source' attribute is bogus. The fact that the XML is the
> showing the device details, and not the config file details is
> inherent in the fact that we're querying the live interface. This
> distinction applies to the entire XML dump, not just the<ip>  tag.
>    

The 'source' attribute came out of the exchange at the bottom of these 
messages:

https://fedorahosted.org/pipermail/netcf-devel/2009-September/000258.html
https://fedorahosted.org/pipermail/netcf-devel/2009-September/000259.html
https://fedorahosted.org/pipermail/netcf-devel/2009-September/000260.html

(I included all the messages in case too much context was removed in the 
replies).

Some/most of the stuff in the XML still comes from the config files even 
though we're querying the "live interface', because some info isn't 
available reliably in any other way (for example, it's useful to know 
that dhcp is setup for the interface, but I don't believe there's any 
way to query dhclient to see if that truly is the case). The idea was to 
put some sort of tag on the particular items that were really coming 
from the device. I will say that, if nothing else, having this extra 
attribute has mmade it easier for me to verify that my patches are 
actually doing something ;-) In the end, I looked at it kindly  because 
it didn't seem to hurt anything (most people just ignore extra stuff in 
the xml), and might help someone.

This attribute is already in the latest netcf release, but of course if 
required we could ignore it in libvirt (it would be a shame to have 
netcf and libvirt's xml diverge so soon, though. I figured we'd get at 
least a year or so before we had to start worring about that :-/)





More information about the libvir-list mailing list