Commit 98d98ecb authored by Michal Berger's avatar Michal Berger Committed by Jim Harris
Browse files

test/vhost: Switch from msdos to gpt



Disks used under the vhost benchmarks can be > 2TB so the msdos pt
is not very suitable here. Use something more robust like gpt.

Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Change-Id: I3e98bcb655c2f55a515f4000b0668b26d71c8fca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16889


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
parent 905c4dcf
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ function cleanup_split_cfg() {
function cleanup_parted_config() {
	notice "Removing parted disk configuration"
	for disk in "${disk_cfg_kernel_names[@]}"; do
		parted -s /dev/${disk}n1 rm 1
		wipefs --all "/dev/${disk}n1"
	done
}

@@ -303,30 +303,27 @@ if [[ "$ctrl_type" == "kernel_vhost" ]]; then
	for ((i = 0; i < ${#disk_cfg_kernel_names[@]}; i++)); do
		nvme=${disk_cfg_kernel_names[$i]}
		splits=${disk_cfg_splits[$i]}
		notice "  Creating extended partition on disk /dev/${nvme}n1"
		parted -s /dev/${nvme}n1 mklabel msdos
		parted -s /dev/${nvme}n1 mkpart extended 2048s 100%
		notice "  Creating partition table (GPT) on /dev/${nvme}n1"
		parted -s /dev/${nvme}n1 mklabel gpt

		part_size=$((100 / ${disk_cfg_splits[$i]})) # Split 100% of disk into roughly even parts
		echo "  Creating  ${splits} partitions of relative disk size ${part_size}"
		for p in $(seq 0 $((splits - 1))); do
			p_start=$((p * part_size))
			p_end=$((p_start + part_size))
			parted -s /dev/${nvme}n1 mkpart logical ${p_start}% ${p_end}%
			sleep 3
			parted -s "/dev/${nvme}n1" mkpart "part$p" ${p_start}% ${p_end}%
		done

		sleep 3

		# Prepare kernel vhost configuration
		# Below grep: match only NVMe partitions which are not "Extended" type.
		# For example: will match nvme0n1p15 but not nvme0n1p1
		partitions=$(find /dev -name "${nvme}n1*" | sort --version-sort | grep -P 'p(?!1$)\d+')
		partitions=("/dev/${nvme}n1p"*)
		# Create block backstores for vhost kernel process
		for p in $partitions; do
		for p in "${partitions[@]}"; do
			backstore_name=$(basename $p)
			backstores+=("$backstore_name")
			targetcli backstores/block create $backstore_name $p
		done
		partitions=($partitions)

		# Create kernel vhost controllers and add LUNs
		# Setup VM configurations