On 26.11.2015 09:15, Cédric Bosdonnat wrote:
> As per
http://www.redhat.com/archives/libvir-list/2013-July/msg01279.html,
> wait for udev events to be handled after removing a virtual NIC.
> Any udev rule associated to NIC destroy could happen to run with a new
> device with the same name that is being created.
> ---
> src/util/virnetdevveth.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
> index 6905168..c8a38fb 100644
> --- a/src/util/virnetdevveth.c
> +++ b/src/util/virnetdevveth.c
> @@ -225,5 +225,8 @@ int virNetDevVethDelete(const char *veth)
> ret = 0;
> cleanup:
> virCommandFree(cmd);
> + /* Make sure the device is properly down: creating a new one
> + * with the same name could lead to troubles */
> + virFileWaitForDevices();
> return ret;
> }
>
I'm not fully convinced this is right approach. I mean, we do create
plenty of devices here and there and tear them down. How come this is
the only place causing trouble?
Then, this function you are patching is called in a loop in couple of
places. Wouldn't it be better to wait for udev after the loop and not in it?
Yeah, calling udev settle in a loop is not going to be very attractive
from a performance POV. I'd really rather the udev rules were fixed to
skip the veth devices
Regards,
Daniel
--
|: