[netcf-devel] mac-tag in XML

David Lutterkort lutter at redhat.com
Wed Jul 29 16:59:54 UTC 2009


On Wed, 2009-07-29 at 09:39 +0200, Jonas Eriksson wrote:
> Is the <mac> tag in XML to be used to search for interfaces or to
> set the mac address of that interface that contains the mac tag?
> As this is converted to HWADDR and, according to the info that I
> have found, I have asumed that this is for searching for the
> correct interface.

Yes, initscripts uses the HWADDR only to search for an interface. When
you issue 'ifup IFACE', initscripts first look for a file ifcfg-IFACE.
If none exists, it looks up the actual MAC address for IFACE from /sys,
then searches for an ifcfg file that mentions that MAC as its HWADDR.

I'm actually in the middle of fixing the initscripts driver to respect
that search order - it's not an issue for interfaces that netcf defined,
but I also need to make sure that netcf produces reasonable results on a
box that has been configured by hand, and the output of dumpxml/list
etc. should match what the native scripts do.

> This proved a bit difficult on SuSE, as the connection device
> name <-> mac address is handled strictly by persistent udev-rules
> written when an interface is first found.

Yes, that's how it's handled on newer Fedora (and I think RHEL5), too.
The device name/MAC association is made through udev rules.

>  I solved this by
> implementing the following prio logic:
> 
> 1. xmlif.name == hostif.name && xmlif.macaddr == hostif.macaddr
> 2. xmlif.macaddr == hostif.macaddr
> 3. xmlif.name == hostif.name
> 
> This may lead to interface name changing when doing a
> define/dumpxml-cycle given that an interface with the wrong name
> but correct mac address is found. Is this the intended way of
> netcf's mac address handling?

Whether this is correct or not highly depends on how config files for an
interface are searched on SuSe. I'd say whatever matches the native SuSe
scripts is the right thing.

> If this assumption is correct, why cannot the interface-tag
> inside the vlan-tag in netcf-xml contain a mac-tag? If this is
> wrong, i hope that we can mitigate this even though the xml
> schema is considered stable.

I didn't add a <mac> to vlan interfaces, because they always get their
MAC address from the underlying device, and that device is known becuase
of the naming convention for vlan's. But if you see a need to specify it
explicitly, we can easily add that to the schema as an optional entry.

David




More information about the netcf-devel mailing list