From owner-freebsd-virtualization@freebsd.org Sat Jul 25 00:23:21 2020 Return-Path: Delivered-To: freebsd-virtualization@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84FDB378899 for ; Sat, 25 Jul 2020 00:23:21 +0000 (UTC) (envelope-from rr@robroygregg.com) Received: from mail.robroygregg.com (173-13-147-189-sfba.hfc.comcastbusiness.net [173.13.147.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BD6HD0FZQz4SpW for ; Sat, 25 Jul 2020 00:23:19 +0000 (UTC) (envelope-from rr@robroygregg.com) Received: from beak.h.net (beak.h.net [192.168.32.10]) by mail.robroygregg.com (OpenSMTPD) with ESMTP id 87568b21; Fri, 24 Jul 2020 17:23:11 -0700 (PDT) Received: from localhost (rr@localhost) by beak.h.net (8.15.2/8.15.2/Submit) with ESMTP id 06P0NBEw076515; Fri, 24 Jul 2020 17:23:11 -0700 (PDT) (envelope-from rr@robroygregg.com) X-Authentication-Warning: beak.h.net: rr owned process doing -bs Date: Fri, 24 Jul 2020 17:23:11 -0700 (PDT) From: Rob Roy Gregg X-X-Sender: rr@beak.h.net To: wanpengqian@gmail.com cc: freebsd-virtualization@freebsd.org Subject: Re: Can bhyve pass disk vendor, model and serial values to guests? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21.99999 (BSF 352 2019-06-22) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Rspamd-Queue-Id: 4BD6HD0FZQz4SpW X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of rr@robroygregg.com has no SPF policy when checking 173.13.147.189) smtp.mailfrom=rr@robroygregg.com X-Spamd-Result: default: False [2.97 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.37)[0.373]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; TO_DN_NONE(0.00)[]; AUTH_NA(1.00)[]; DMARC_NA(0.00)[robroygregg.com]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_MEDIUM(0.63)[0.627]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_SPAM_LONG(0.07)[0.074]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7922, ipnet:173.8.0.0/13, country:US]; SUBJECT_ENDS_QUESTION(1.00)[] X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jul 2020 00:23:21 -0000 On Sat, 20 Jun 2020, Wanpeng Qian wrote: > On Fri, 19 Jun 2020, Rob Roy Gregg wrote: > >> FreeBSD Friends, >> >> I tried the forums and thought I'd ask here next; here's the thread: >> >> https://forums.freebsd.org/threads/can-bhyve-pass-disk-vendor-model-and-serial-values-to-guests.75851/ >> >> This is on 12.1-RELEASE-p6. >> >> Can bhyve pass disks to guests in a way that preserves the disk's >> actual vendor, model and serial values (as viewed from inside of the guest)? >> >> Here's how a passed-in disk looks inside the guest with ahci-hd >> emulation: >> >> linux_in_bhyve# lsblk --output vendor,model,serial /dev/sda >> VENDOR MODEL SERIAL >> ATA BHYVE SATA DISK BHYVE-FC87-ABA5-711B >> >> And with virtio-blk emulation: >> >> linux_in_bhyve# lsblk -o vendor,model,serial /dev/vdb >> VENDOR MODEL SERIAL >> 0x1af4 >> >> Meanwhile, a similar disk configured on ESXi 5.5 U3b as a >> "pass-through RDM" looks like this; this is what I'd like to see in >> the bhyve guest also: >> >> linux_in_esxi# lsblk -o vendor,model,serial /dev/sdb >> VENDOR MODEL SERIAL >> HITACHI OPEN-V-CM 60060e801602a100000102a100000bba >> >> Thank you! > > Hi Gregg > > There is a patch for this, but you have to apply manually for 12.1R > > You can get it here > > https://reviews.freebsd.org/D24174 Wanpeng, thank you! I installed FreeBSD-13.0-CURRENT-amd64-20200709-r363032-disc1.iso, applied your patch, and used this vm-bhyve config: disk1_type="ahci-hd" disk1_name="/dev/da4,ser=410109,model=OPEN-V-CM" disk1_dev="custom" Which made this bhyve argument: -s 5:0,ahci-hd,/dev/da4,ser=410109,model=OPEN-V-CM Which made the disk look like this in the guest: linux_in_bhyve# lsblk --output vendor,model,serial /dev/sda VENDOR MODEL SERIAL ATA OPEN-V-CM 410109 This is really neat. Thanks for your patch. Unfortunately, the software I'm using checks both the vendor and model fields. I think it's happy with the model field now, but it's seeing "ATA" for the vendor and it wants "HITACHI." I'm guessing that ATA itself may not really support this vendor field. I noticed that the ESXi VM has a virtual SCSI HBA instead. Do you know how I can make this disk's vendor field "HITACHI" instead of "ATA," in a bhyve guest? Thank you again for your patch Wanpeng.