Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ EOF

cachedisk=()
if [ -f "${workdir}/cache/cache.qcow2" ]; then
cachedisk=("-hdb" "${workdir}/cache/cache.qcow2")
cachedisk=("-drive" "if=none,id=drive-scsi0-0-0-1,discard=unmap,file=${workdir}/cache/cache.qcow2" \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random thought...do we still need the cache disk versus relying on a 9p mount? I may investigate this.
Would simplify things a lot if we had just one disk attached to the VM versus two.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the original design, but we moved away from that because composing directly into 9p caused issues. And composing on the side and moving cache/data back and forth was a lot of overhead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out #124 (comment) and following.

"-device" "scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1")
fi

# support local dev cases where src/config is a symlink
Expand All @@ -494,9 +495,15 @@ 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") arch_args='-bios /usr/share/AAVMF/AAVMF_CODE.fd' ;;
"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" ;;
esac

#shellcheck disable=SC2086
Expand All @@ -506,8 +513,10 @@ 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 \
-hda "${vmbuilddir}/root" \
-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 \
"${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" \
Expand Down