[Openstack] File injection support

Eric Windisch eric at cloudscaling.com
Sat Jul 14 00:56:49 UTC 2012




On Friday, July 13, 2012 at 20:35 PM, Pádraig Brady wrote:

> >  
> > More interesting though, and what might be of use to other people, the
> > "kpartx -a" calls get run and then the code in nova/virt/disk/mount.py
> > immediately checks for whether or not the newly created
> > /dev/mapper/nbdXXpX partitions exist. They'd actually get created but
> > the os.exists call would fail. Apparently the os.exists call was
> > getting run too soon. I added a time.sleep() after both the 'kpartx
> > -a' and 'kpartx -d' calls, to give things time to catch up before the
> > os.exists calls and things worked much better.
>  
> Sigh.
>  
> The amount of synchronization bugs I've noticed in lower
> Linux layers lately is worrying.
>  


The kernel tools can certainly be asynchronous at times.

Perhaps try to see if using inotify would solve this. It is platform-dependent, but it is the best way to solve these problems without race conditions.  If we're calling kpartx, platform independence is unlikely to be an issue anyway.

However, if compatibility is desired, BSD/MacOS provide similar functionality via kqueue, and Windows FindFirstChangeNotification.

Regards,
Eric Windisch





More information about the Openstack mailing list