
On Thu, Jun 18, 2009 at 02:22:16PM -0400, Laine Stump wrote:
On 06/18/2009 01:53 PM, David Lutterkort wrote:
On Thu, 2009-06-18 at 18:06 +0100, Daniel P. Berrange wrote:
On Thu, Jun 18, 2009 at 04:06:40PM +0200, Daniel Veillard wrote:
We should allow standalone IPv4 and IPv6, or both. Each could either use DHCP or allow one or more IP address and routes.
You need to have allow for IP adddresses & routes to be present even when doing DHCP, because you need to discover what was auto-configured.
That only makes sense when reading an existing config, with the meaning 'the interface uses DHCP when it is brought up, and has the following address currently assigned to it'; it makes no sense when using the XML to configure a device.
I would prefer for that case a separate API call to ask for currently assigned addresses.
I agree that the API call to retrieve the current configuration should be separate from the API call to retrieve the current state of the interface. If you mix them, a "get config / write config" pair would no longer be a NOP (for example, you would end up with the IP addresses/routes obtained from DHCP being written into the config file, and that can't be good.)
That is why the virInterfaceDumpXML() elements has a 'flags' argument. With no flags set it would return the config matching the interfaces' current state. If VIR_INTEFACE_INACTIVE is set, then it would always return the persistent offline config. So an app doing a read+modify+write sequence should always use VIR_INTERFACE_INACTIVE. This model matches that done for our other APIs. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|