Skip to content

Commit

Permalink
qemu vm: fix using right VM_ROOTDEV
Browse files Browse the repository at this point in the history
Moving the VM_ROOTDEV check to fixup_vm method, where virtio has been configured

Fixes issue 715
  • Loading branch information
adrianschroeter committed Jan 10, 2022
1 parent dd8a8c9 commit fc4e083
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions build-vm-qemu
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ vm_verify_options_qemu() {

vm_kernel=/.build.kernel.kvm
vm_initrd=/.build.initrd.kvm

case $qemu_device in
virtio*)
VM_ROOTDEV=/dev/disk/by-id/virtio-0
VM_SWAPDEV=/dev/disk/by-id/virtio-1
;;
*)
VM_ROOTDEV=/dev/sda
VM_SWAPDEV=/dev/sdb
;;
esac
}

vm_startup_qemu() {
Expand Down Expand Up @@ -224,14 +213,24 @@ vm_kill_qemu() {
vm_fixup_qemu() {
vm_fixup_kvm

case $qemu_device in
virtio*)
VM_ROOTDEV=/dev/disk/by-id/virtio-0
VM_SWAPDEV=/dev/disk/by-id/virtio-1
;;
*)
VM_ROOTDEV=/dev/sda
VM_SWAPDEV=/dev/sdb
;;
esac

if test -z "$qemu_serial_device" ; then
if test -e "$BUILD_ROOT/.build.console.kvm" -a ! -L "$BUILD_ROOT/.build.console.kvm" && grep -q '^virtio$' "$BUILD_ROOT/.build.console.kvm" ; then
echo "Detected virtio-serial support"
qemu_serial_device=virtio-serial,max_ports=2
qemu_console=hvc0
fi
fi

}

vm_attach_root_qemu() {
Expand Down

0 comments on commit fc4e083

Please sign in to comment.