[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel]xl create PV guest with qcow/qcow2 disk images fail



On Wed, 2011-11-09 at 09:27 +0000, Stefano Stabellini wrote:
> On Wed, 9 Nov 2011, Chunyan Liu wrote:
> > In a following email you wrote that without the sleep the device is
> > "not prepared yet".
> > What do you mean by that?
> > The device is present but reading/writing to it returns an error?
> > 
> >       If so, rather than a sleep we need an explicit wait for the device
> >       to be ready. Even trying to read from the device in a loop until it
> >       succeeds would be better than a sleep. At least we would know exactly
> >       what we are doing and why we are doing it.
> > 
> > 
> > OK, after checking qemu-nbd source code, I think I know where the problem 
> > is. I tried to fork_exec "qemu-nbd -c /dev/nbd0
> > disk.img", with this command option, qemu-nbd will call daemon(3) to run in 
> > background and itself should exit immediately,
> > that's why waitpid can successfully wait the exit of qemu-nbd pid and 
> > fork_exec will return 0. The problem is that I
> > should not use fork_exec return value to decide if the disk.img is already 
> > connected to nbd device. That's not correct.
> 
> Good.
> 
> 
> > This is not great. I would read /proc/partitions instead.
> > 
> > Thanks, that's a better way to find if a nbd device is free. The whole 
> > thing (find a free nbd device and connect disk.img
> > to that nbd device) seems better to write a script to do that and in libxl 
> > call that script.

Really this is the sort of thing qemu-nbd should do for us (c.f.
"losetup -f"). I think it would be worth getting such a patch upstream
even if we can't yet make use of it.

Ian.

> 
> Maybe, but I think it makes sense for it to be in libxl and after all
> reading/writing a file can be done quite well in a library too.
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.