From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47373 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJd2z-0000Lq-0q for qemu-devel@nongnu.org; Tue, 01 Jun 2010 21:47:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJd2s-0003Ae-Mz for qemu-devel@nongnu.org; Tue, 01 Jun 2010 21:47:08 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:34650) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJd2s-0003AH-I2 for qemu-devel@nongnu.org; Tue, 01 Jun 2010 21:47:02 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e33.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o521gjnR020786 for ; Tue, 1 Jun 2010 19:42:45 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o521kvA1136552 for ; Tue, 1 Jun 2010 19:46:57 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o521kulr010895 for ; Tue, 1 Jun 2010 19:46:56 -0600 Date: Tue, 1 Jun 2010 20:46:52 -0500 From: Ryan Harper Subject: Re: [Qemu-devel] [PATCH 0/4] Add virtio disk identification support Message-ID: <20100602014652.GA16406@us.ibm.com> References: <4BAAF541.4090605@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BAAF541.4090605@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: john cooper Cc: Anthony Liguori , Rusty Russell , Marc Haber , qemu-devel@nongnu.org * john cooper [2010-03-25 00:45]: > This series adds the minimal support to qemu and virtio_blk > to support passing of a virtio_blk serial id string from qemu > through the guest driver and to the guest userland. > > This is derived in part from a patch set posted by Rusty some > time ago, but has been minimized to remove support for prior > versions which attempted to provide the same functionality via > pci config/io space. This version rather uses a virtio request > as proposed in Rusty's example. > > Also removed is the packaging of the serial/id string within > the glorious bag of bits returned by the ATA_IDENTIFY command. > Here we transfer only the 20 bytes of serial/id string from > qemu to the guest userland. In the proposed interface, this > is made available by an ioctl() into the virtio_blk driver > however other interfaces (eg: /sys) have also been proposed. > A code snippet is attached below as an example of ioctl usage. > > The resulting code is quite minimal and I believe it addresses > all concerns raised in prior versions. > > -john I've applied the qemu and kernel side of this patch series and tested this out using the sample code below. I've also reworked this example into a virtioblk_id tool to work with udev to generate /dev/disk/by-id links; I'll be submitting a patch set to linux-hotplug with these changes, (and update for path_id) and some udev rules to persistent-storage script to autogenerate by-id and by-path symlinks for virtio-blk devices. I've also got a patch to apply ontop of the qemu patches to generate a default serial number if one isn't specified (like we do for ide devices). Anthony, is this series in your queue yet? Acked-by: Ryan Harper > > > > #include > #include > #include > #include > #include > > #define IOCTL_CMD 'VBID' > > main() > { > int fd, rv; > char buf[512]; > > bzero(buf, sizeof (buf)); > if ((fd = open("/dev/vda", O_RDONLY)) < 0) > perror("open"); > else if (ioctl(fd, IOCTL_CMD, buf) < 0) > perror("ioctl"); > else > printf("[%s]\n", buf); > } > > -- > john.cooper@redhat.com > -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com