From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTrQb-0002uJ-KZ for qemu-devel@nongnu.org; Tue, 07 Jun 2011 04:14:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTrQZ-0002jB-Nj for qemu-devel@nongnu.org; Tue, 07 Jun 2011 04:14:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTrQZ-0002j7-8d for qemu-devel@nongnu.org; Tue, 07 Jun 2011 04:14:19 -0400 From: Markus Armbruster References: <1307430291.28149.126.camel@das-HP-EliteBook-8530w> Date: Tue, 07 Jun 2011 10:14:16 +0200 In-Reply-To: <1307430291.28149.126.camel@das-HP-EliteBook-8530w> (Dave Seddon's message of "Tue, 07 Jun 2011 17:04:51 +1000") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] qemu - SCSI disk "Device Model", "Serial Number", and "Firmware Version"? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dave@seddon.ca Cc: qemu-devel@nongnu.org Dave Seddon writes: > Greetings, > > Just wondering if it would be difficult to add the ability to define the > SCSI disk "Device Model", "Serial Number", and "Firmware Version". I've > been using the '-device lsi' successfully to emulate the LSI controller, > but now I want to emulate certain disks too. > > e.g. I've been using this: > --------------------------- > ... > -drive if=3Dnone,id=3Ddisk00,file=3D/home/das/documents/qemu/disk00.img.= qcow,media=3Ddisk,cache=3Dwriteback \ > -device lsi \ > -device scsi-disk,drive=3Ddisk00,bus=3Dscsi.0 \ > ... > --------------------------- > > > The reason this would be really cool is that tools like smartmontools > seem to match on the "Device Model", and the device-model "QEMU" hasn't > made it into the list yet. > > I found hunting around the net that somebody has tried to make this > work. I'm not sure if it works. > '-drive ...,serial=3Dxyz' > > > > This is how the QEMU disks are currently seen in dmesg: > ------------------------------------------------------- > scsi 0:0:0:0: Direct-Access QEMU QEMU HARDDISK 0.12 PQ: 0 > ANSI: 3 > target0:0:0: tagged command queuing enabled, command queue depth 16. > target0:0:0: Beginning Domain Validation > target0:0:0: Domain Validation skipping write tests > target0:0:0: Ending Domain Validation > ------------------------------------------------------- > > This is an example of a real disk, that I would like to 'fake': > ------------------------------------------------------- > scsi 2:0:0:0: Direct-Access ATA ST3500320NS SN06 PQ: 0 ANSI= : 5 > sd 2:0:0:0: [sda] 976773168 512-byte hardware sectors (500108 MB) > sd 2:0:0:0: [sda] Write Protect is off > sd 2:0:0:0: [sda] Mode Sense: 73 00 00 08 > sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't supp= ort DPO or FUA > sd 2:0:0:0: [sda] 976773168 512-byte hardware sectors (500108 MB) > sd 2:0:0:0: [sda] Write Protect is off > sd 2:0:0:0: [sda] Mode Sense: 73 00 00 08 > sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't supp= ort DPO or FUA > ------------------------------------------------------- > > > Here's an example of the nasty/QEMU output of smartmontools: > ------------------------------------------------------- > # smartctl -d sat --all /dev/sg0 > smartctl version 5.38 [i686-spcdn-linux-gnu] Copyright (C) 2002-8 Bruce A= llen > Home page is http://smartmontools.sourceforge.net/ > > =3D=3D=3D START OF INFORMATION SECTION =3D=3D=3D > Device Model: [No Information Found] > Serial Number: [No Information Found] > Firmware Version: =EF=BF=BD=1D" That's not what I see. What version of QEMU are you using? > Device is: Not in smartctl database [for details use: -P showall] > ATA Version is: 1 > ATA Standard is: Exact ATA specification draft version not indicated > Local Time is: Tue Jun 7 16:57:08 2011 UTC > SMART is only available in ATA Version 3 Revision 3 or greater. > We will try to proceed in spite of this. > SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 82-83 don't show = if SMART supported. > Checking for SMART support by trying SMART ENABLE comma= nd. > SMART ENABLE appeared to work! Continuing. > SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 85-87 don't show = if SMART is enabled. > A mandatory SMART command failed: exiting. To continue, add one or more '= -T permissive' options > ------------------------------------------------------- > > > Here's an example of the output of smartmontools from a real disk: > ------------------------------------------------------- > # smartctl -d sat --all /dev/sg1 > smartctl version 5.38 [i686-spcdn-linux-gnu] Copyright (C) 2002-8 Bruce > Allen > Home page is http://smartmontools.sourceforge.net/ > > =3D=3D=3D START OF INFORMATION SECTION =3D=3D=3D > Device Model: ST3500320NS <--- CAN WE SIMULATE THIS? No. Hardcoded to "QEMU HARDDISK ". > Serial Number: 9QMCAMS6 <--- AND THIS? > Firmware Version: SN06 <--- AND THIS? Yes. But -drive doesn't give you enough control. You need to use -device. I'd point you to docs/qdev-device-use.txt for the details, except it's outdated, and my patch to update it has been stuck on the list for three weeks. Need to repost. Try -drive if=3Dnone,id=3Ddisk0,... -device scsi-hd,drive=3Ddisk0,serial=3DS,ver=3DV > User Capacity: 500,107,862,016 bytes > Device is: Not in smartctl database [for details use: -P showall] > ATA Version is: 8 > ATA Standard is: ATA-8-ACS revision 4 > Local Time is: Tue Jun 7 06:01:29 2011 UTC > SMART support is: Available - device has SMART capability. > SMART support is: Enabled > ------------------------------------------------------- > > > > Looking in the source, I can see that the "QEMU HARDDISK" for example is > statically defined. Would this be difficult to make an option for the > '-drive '? Doubt it would be difficult. But would it be useful? It's a bluff, and if the guest calls it by using vendor-specific stuff, we'll surely fail, won't we? [...]