cmdlib: Use -hda/-hdb instead of virtio-scsi incantations
Qemu has convenient shorthand CLI arguments to do what we
want here.  We're explicitly not using virtio because supermin
hardcodes `/dev/sda` sadly.
Prep for changing this code to use `kola qemuexec`.
@@ -484,8 +484,7 @@ EOF
cachedisk=()
if [ -f "${workdir}/cache/cache.qcow2" ]; then
- cachedisk=("-drive" "if=none,id=drive-scsi0-0-0-1,discard=unmap,file=${workdir}/cache/cache.qcow2" \
- "-device" "scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1")
+ cachedisk=("-hdb" "${workdir}/cache/cache.qcow2")
fi
# support local dev cases where src/config is a symlink
@@ -495,15 +494,9 @@ EOF
srcvirtfs=("-virtfs" "local,id=source,path=${workdir}/src/config,security_model=none,mount_tag=source")
fi
- scsibus="bus=pci.0,addr=0x3"
arch_args=
case $arch in
- "aarch64")
- # 'pci' bus doesn't work on aarch64
- scsibus="bus=pcie.0,addr=0x3"
- arch_args='-bios /usr/share/AAVMF/AAVMF_CODE.fd'
- ;;
- "s390x") scsibus="devno=fe.0.0003" ;;
+ "aarch64") arch_args='-bios /usr/share/AAVMF/AAVMF_CODE.fd' ;;
esac
#shellcheck disable=SC2086
@@ -513,10 +506,8 @@ EOF
-initrd "${vmbuilddir}/initrd" \
-netdev user,id=eth0,hostname=supermin \
-device virtio-net-"${devtype}",netdev=eth0 \
- -device virtio-scsi-"${devtype}",id=scsi0,"${scsibus}" \
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-"${devtype}",rng=rng0 \
- -drive if=none,id=drive-scsi0-0-0-0,snapshot=on,file="${vmbuilddir}/root" \
- -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \
+ -hda "${vmbuilddir}/root" \
"${cachedisk[@]}" \
-virtfs local,id=workdir,path="${workdir}",security_model=none,mount_tag=workdir \
"${srcvirtfs[@]}" -serial stdio -append "root=/dev/sda console=${DEFAULT_TERMINAL} selinux=1 enforcing=0 autorelabel=1" \
