
So, qemu-ga doesn't understand that there can't be more than one device with same MAC addr. So, I think we are left with the following options:
Actually that's wrong. You *can* have 2 completely different physical NICs with the same MAC address.
(i) Modify qemu-guest-agent to return addresses belonging to same MAC address grouped under one interface only.
You would not want to group based on MAC address - you explicitly just want to normalize by stripping the legacy aliases suffixes.
Actually, the order in which the qemu-agent returns the value isn't always: ethX ethX:0 ethX:1 ethY ethY:0 ethY:2 It can be: ethX ethY:2 ethX:0 ethY:0 ethX:1 ethY which, after stripping, will just be left with: ethX ethY ethX ethY ethX ethY whereas, we would want: ethX ethX ethX ethY ethY ethY Hence, grouping either by the stripped down interface name or by the MAC address will be required. So that all IP addresses related to a single NIC are not distributed in the output.
OR (ii) Let the reply be as it is now. Strip the ":0", ":1" from the
response
of guest agent (Is this really necessary?) . We'll have to parse the JSON multiple times and fill the virDomainInterface structs by grouping them according to the MAC addresses.
I think we need to do (ii) regardless to cope with existing deployed QEMU agent versions.
We should also recommend to QEMU developers to fix the agent to not expose these legacy device alias names.
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/:| |: http://libvirt.org -o- http://virt-manager.org:| |: http://autobuild.org -o- http://search.cpan.org/~danberr/:| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc:|
-- Nehal J Wani UG3, BTech CS+MS(CL) IIIT-Hyderabad http://commandlinewani.blogspot.com