[Why] We now need auto install iso to the specific disk of testbox, so in order to avoid conflict with rootfs_partition, we support a new field for local disk: rootfs_disk.
Signed-off-by: Yu Chuan 13186087857@163.com --- filters/run_on_local_disk | 8 ++++---- lib/bootstrap.sh | 23 +++++++++++++++++++++++ lkp-exec/qemu | 7 ++++++- 3 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/filters/run_on_local_disk b/filters/run_on_local_disk index 389d1ca17fdc..2092bd2b6028 100755 --- a/filters/run_on_local_disk +++ b/filters/run_on_local_disk @@ -1,11 +1,11 @@ #!/bin/bash
-# check if testbox has rootfs_partition to run the job +# check if testbox has rootfs_partition or rootfs_disk to run the job
if [[ "$run_on_local_disk" == "yes" || "$run_on_local_disk" == "true" ]]; then - if [[ -z "$rootfs_partition" ]]; then - echo "rm $job_file due to no rootfs_partition" - echo "run_on_local_disk needs rootfs_partition" + if [[ -z "$rootfs_partition" && -z "$rootfs_disk" ]]; then + echo "rm $job_file due to no rootfs_partition or rootfs_disk" + echo "run_on_local_disk needs rootfs_partition or rootfs_disk" exit 1 fi fi diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index b04ea3dd48b7..6c0055bd19f5 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -490,6 +490,12 @@ wait_load_disk() ls $rootfs_partition >/dev/null 2>&1 && return # eg: LABEL=LKP-ROOTFS blkid | grep -q ${rootfs_partition#*=} && return + + # eg: /dev/disk/by-id/ata-WDC_WD1002FAEX-00Z3A0_WD-WCATRC577623 + ls $rootfs_disk >/dev/null 2>&1 && return + # eg: LABEL=LKP-ROOTFS + blkid | grep -q ${rootfs_disk#*=} && return + sleep 1 done
@@ -515,6 +521,23 @@ mount_rootfs() mkdir -p $ROOTFS_DIR/tmp CACHE_DIR=$ROOTFS_DIR/tmp cleanup_pkg_cache $CACHE_DIR + elif [ -n "$rootfs_disk" ]; then + # wait for the machine to load the disk + wait_load_disk || { + # skipping following test if disk can't be load + echo "can't load the disk $rootfs_disk, skip testing..." + set_job_state 'load_disk_fail' + return 1 + } + ROOTFS_DIR=/opt/rootfs + mkdir -p $ROOTFS_DIR + mount $rootfs_disk $ROOTFS_DIR || { + mkfs.btrfs -f $rootfs_disk + mount $rootfs_disk $ROOTFS_DIR + } + mkdir -p $ROOTFS_DIR/tmp + CACHE_DIR=$ROOTFS_DIR/tmp + cleanup_pkg_cache $CACHE_DIR else CACHE_DIR=/tmp/cache mkdir -p $CACHE_DIR diff --git a/lkp-exec/qemu b/lkp-exec/qemu index 9e4b576cf50f..1cbd316f6146 100755 --- a/lkp-exec/qemu +++ b/lkp-exec/qemu @@ -91,14 +91,16 @@ replace_script_partition_val() local nr_hdd_vdisk="$(echo $hdd_partitions | wc -w)" local nr_ssd_vdisk="$(echo $ssd_partitions | wc -w)" local nr_swap_vdisk="$(echo $swap_partitions | wc -w)" + local nr_rootfs_vdisk="$(echo $rootfs_partition | wc -w)" + [ -z "$rootfs_partition" ] && nr_rootfs_vdisk="$(echo $rootfs_disk | wc -w)"
[[ $nr_hdd_partitions ]] || nr_hdd_partitions=$nr_hdd_vdisk [[ $nr_ssd_partitions ]] || nr_ssd_partitions=$nr_ssd_vdisk
VDISK_NUM=$((nr_hdd_partitions+nr_ssd_partitions+nr_swap_vdisk+nr_rootfs_vdisk))
- [[ "$hdd_partitions$ssd_partitions$swap_partitions$rootfs_partition" =~ '/dev/vda' ]] && return + [[ "$hdd_partitions$ssd_partitions$swap_partitions$rootfs_partition$rootfs_disk" =~ '/dev/vda' ]] && return
if ((VDISK_NUM)); then local index=0 @@ -115,6 +117,9 @@ replace_script_partition_val() -e "s%export swap_partitions=.*%export swap_partitions='${vdisk_swap_val}'%" \ -e "s%export rootfs_partition=.*%export rootfs_partition='${vdisk_rootfs_val}'%" \ $job_script + + [ -z "$rootfs_partition" ] && + sed -i -e "s%export rootfs_disk=.*%export rootfs_disk='${vdisk_rootfs_val}'%" $job_script fi }