[Kimchi-devel] [RFC]: help, how to get the mac after create a VM interface.

Christy Perez christy at linux.vnet.ibm.com
Thu Jan 23 20:34:00 UTC 2014


On Thu, 2014-01-23 at 10:13 +0800, Sheldon wrote:
> On 01/23/2014 06:55 AM, Christy Perez wrote:
> > Agree. Not reliable. I did forget that other people may be doing the
> > exact same thing at the exact same time, though, which makes it a bad
> > approach.
> a global lock just for mac?
> >
How about just using randomMAC() and then checking the ARP cache before
passing it to libvirt? I feel like the odds of two people generating the
same MAC using randomMAC() at the same time are almost zero.

Or -- we could just have a lock for any and all modifications to a VM.
IOW - a VM-specific lock. Maybe not all modifications would need to
acquire it, but this one would be one that would.

> > Regards,
> >
> > - Christy
> >
> > On Wed, 2014-01-22 at 15:51 -0200, Crístian Viana wrote:
> >> Am 22-01-2014 15:45, schrieb Christy Perez:
> >>> libvirt always adds the new interface to the end of the group. I did a
> >>> little experimenting to make sure. So, you could just parse the
> >>> interfaces and pull the MAC from the last one returned. It's not very
> >>> elegant, though.
> >> ... and not very reliable. There may be other operations happening at
> >> the same time (like someone else creating another NIC), and the last
> >> interface returned may have been created by other user. It's a web app,
> >> we should expect simultaneous access.
> >>
> >> But I don't have another solution for this...
> >
> > _______________________________________________
> > Kimchi-devel mailing list
> > Kimchi-devel at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/kimchi-devel
> 
> 





More information about the Kimchi-devel mailing list