[arch-releng] [PATCH] Fix detection of virtio block devices

Dieter Plaetinck dieter at plaetinck.be
Sun Feb 26 06:40:17 EST 2012


On Fri, 17 Feb 2012 11:11:04 +1030
Kevin Shanahan <kmshanah at disenchant.net> wrote:

> When installing on a KVM guest with virtio block devices, the disk
> detection fails because of missing 'type' file in sysfs for these
> devices. Try identifying via the 'vendor' file if 'type' is missing.
> 
> Signed-off-by: Kevin Shanahan <kmshanah at disenchant.net>
> ---
>  src/core/libs/lib-blockdevices-filesystems.sh |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
> index 84a6b34..8f67e65 100644
> --- a/src/core/libs/lib-blockdevices-filesystems.sh
> +++ b/src/core/libs/lib-blockdevices-filesystems.sh
> @@ -225,6 +225,16 @@ finddisks() {
>  				echo -ne "/dev/$DEVNAME $1"
>  				unset DEVNAME
>  			fi
> +		elif [[ -f $dev/device/vendor ]]; then
> +			local vendor
> +			read vendor < /sys/block/${dev##*/}/device/vendor
> +			# Virtio disks (/dev/vd*) don't have a the 'type' file in sysfs
> +			# but seem to have a vendor file with a unique value
> +			if [[ "$vendor" = "0x1af4" ]]; then
> +				source "$dev/uevent"
> +				echo -ne "/dev/$DEVNAME $1"
> +				unset DEVNAME
> +			fi
>  		fi
>  	done
>  

this seems to be a patch for the master branch.
have a look at the develop branch, where changes already have been made to support virtio.

Dieter


More information about the arch-releng mailing list