
29.08.2013 12:11, Gao feng kirjoitti:
The suggested patch also greatly simplifies name selection by removing the loops trying to find a supposedly unused interface name. If you don't like using mac address in the interface name we could just replace it with a random string with a loop checking that the selected name wasn't in use when it was selected. The current approach of trying to use a name with a low number just doesn't work in an environment where another process does the same thing.
Use mac address to create an unique name is not a good idea, I suggest you pass an index to virLXCProcessSetupInterfaceBridged. use this index and domain_name to create an unique name.
Such as, for the first net interface for domain "fedora19" parentVeth's name is "fedora19-host-1", containerVeth is "fedora19-container-1" for the second interface, parentVeth's name is "fedora19-host-2", containerVeth is "fedora19-container-2" ...
find out a proper name for these veth device :)
Interface names are limited to 16 characters, so we can't really use the full domain name there and I suppose it makes sense to prefix them with "veth". That leaves 12 characters for the which is enough for a random name that will effectively never collide with anything else, but I'd still prefer naming them according to the mac address. The randomly generated address with 3 random bytes is unique enough to be used as a mac address in a network - it should be unique enough to be used as an interface name on a single host (and you can still override it in domain configuration if you want to.) / Oskari