Skip to content
Closed
Show file tree
Hide file tree
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
12 changes: 4 additions & 8 deletions src/cmd-buildextend-metal
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,16 @@ if [ -n "${ref_is_temp}" ]; then
ref_arg=${commit}
fi

target_drive=("-drive" "if=virtio,id=target,format=${image_format},file=${path}.tmp,cache=unsafe")
target_device_opt="scsi-disk,drive=target,wwn=0x2a"
# we need 4096 block size for ECKD DASD and (obviously) metal4k
if [[ $image_type == dasd || $image_type == metal4k ]]; then
device_type=virtio-blk
if [[ $image_type == dasd ]]; then
device_type=virtio-blk-ccw
fi
target_drive=("-drive" "if=none,id=target,format=${image_format},file=${path}.tmp,cache=unsafe" \
"-device" "${device_type},drive=target,physical_block_size=4096,logical_block_size=4096,scsi=off")
target_device_opt="${target_device_opt},physical_block_size=4096,logical_block_size=4096"
fi
target_drive=("-drive" "if=none,id=target,format=${image_format},file=${path}.tmp,cache=unsafe" \
"-device" "virtio-scsi-${devtype},id=scsitarget" "-device" "${target_device_opt}")

runvm "${target_drive[@]}" -- \
/usr/lib/coreos-assembler/create_disk.sh \
--disk /dev/vda \
--buildid "${build}" \
--imgid "${img}" \
--grub-script /usr/lib/coreos-assembler/grub.cfg \
Expand Down
21 changes: 20 additions & 1 deletion src/create_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ run as part of 'coreos-assembler build'.
EOC
}

disk=
rootfs_size="0"
boot_verity=0
rootfs_type="xfs"
Expand Down Expand Up @@ -73,7 +74,25 @@ udevtrig() {

export PATH=$PATH:/sbin:/usr/sbin
arch="$(uname -m)"
disk="${disk:?--disk must be defined}"

if [ -z "${disk:-}" ]; then
# hex 0x2a = 42 in decimal; this is set in cmd-buildextend-metal.
# We use the WWN as an unambiguous way to identify our target disk,
# independent of other devices attached to the VM (caches, etc.)
wwn=000000000000002a
for dev in /sys/block/*; do
if grep -F -e "${wwn}" "${dev}/device/wwid" 2>/dev/null; then
disk="/dev/$(basename ${dev})"
break
fi
done
if [ -z "${disk:-}" ]; then
echo "failed to find disk with wwn ${wwn}" 1>&2
bash
exit 1
fi
fi

buildid="${buildid:?--buildid must be defined}"
imgid="${imgid:?--imgid must be defined}"
ostree="${ostree:?--ostree-repo must be defined}"
Expand Down
2 changes: 1 addition & 1 deletion src/supermin-init-prelude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [ -L "${workdir}"/src/config ]; then
mount -t 9p -o rw,trans=virtio,version=9p2000.L source "${workdir}"/src/config
fi
mkdir -p "${workdir}"/cache /host/container-work
cachedev=$(blkid -lt LABEL=cosa-cache -o device)
cachedev=$(blkid -lt LABEL=cosa-cache -o device || true)
if [ -n "${cachedev}" ]; then
mount "${cachedev}" "${workdir}"/cache
else
Expand Down