Re: [Nbd] How to find a free NBD device?
- To: nbd-general@lists.sourceforge.net
- Subject: Re: [Nbd] How to find a free NBD device?
- From: Andreas Klauer <Andreas.Klauer@...1264...>
- Date: Mon, 3 Mar 2014 19:16:19 +0100
- Message-id: <20140303181619.GA17222@...1265...>
- In-reply-to: <20140303174147.GA16734@...1265...>
- References: <20140303174147.GA16734@...1265...>
On Mon, Mar 03, 2014 at 06:41:47PM +0100, Andreas Klauer wrote:
> Is there something I'm missing?
Sorry, I see this has been discussed earlier on this list:
http://sourceforge.net/p/nbd/mailman/message/31467855/
Another thing I found is a patch for qemu-nbd:
(the patch didn't seem to make it though)
http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg02201.html
That patch discussion also mentions a NBD_SET_LOCK but I could not
find any other reference to that...
So the method seems to be:
1) check /proc/partitions
2) check /sys/block/nbd*/pid
3) lock your own program and hope no-one is racing you
Is that it?
Regards
Andreas
Reply to: