From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQgSw-0007OM-Ne for qemu-devel@nongnu.org; Wed, 16 Nov 2011 09:27:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RQgSr-0007Yr-Ab for qemu-devel@nongnu.org; Wed, 16 Nov 2011 09:27:54 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:42591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQgSr-0007YL-6F for qemu-devel@nongnu.org; Wed, 16 Nov 2011 09:27:49 -0500 Received: by wyg34 with SMTP id 34so599523wyg.4 for ; Wed, 16 Nov 2011 06:27:47 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <1321426669-7337-1-git-send-email-cyliu@suse.com> Date: Wed, 16 Nov 2011 14:27:47 +0000 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] Add -f option to qemu-nbd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Yong Wu Cc: Chunyan Liu , qemu-devel@nongnu.org On Wed, Nov 16, 2011 at 11:49 AM, Zhi Yong Wu wrote: > On Wed, Nov 16, 2011 at 6:34 PM, Stefan Hajnoczi wro= te: >> On Wed, Nov 16, 2011 at 6:57 AM, Chunyan Liu wrote: >>> Currently qemu-nbd does not support finding free nbd device for users l= ike >>> "losetup -f" and issuing "qemu-nbd -c /dev/nbdX disk.img" won't report = error >>> message when /dev/nbd is already in use. It makes things a little confu= sing. >>> This patch adds "-f" option to qemu-nbd to support finding a free nbd d= evice >>> for users. Please review and share your comments. Thanks. >>> >>> Signed-off-by: Chunyan Liu >>> --- >>> =A0qemu-nbd.c | =A0 65 ++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++- >>> =A01 files changed, 64 insertions(+), 1 deletions(-) >> >> This patch finds a free device but does not immediately attach to it >> and use it. =A0Interfaces like this are prone to race conditions, I >> think it would make more sense to combine the -f option with running >> the actual NBD server. >> >> I suggest: >> qemu-nbd -f disk.img > Why must we add one new option? I prefer to not adding new option, > only enhance existing function of qemu-nbd -c disk.img. That would change the command-line interface and break existing users. There might be scripts or tools that call out to qemu-nbd, they would break if we changed the meaning of -c. Stefan