Skip to content
Snippets Groups Projects
Commit 4fc4c20b authored by dkg's avatar dkg
Browse files

Place explicitly-declared block device drivers at the end of the PCI bus

In 1745eff4 we risk reorganizing the
list of PCI devices, due to how raw -drive disks end up placing their
parent devices at the end of the PCI bus.

Instead, we should explicitly place the directives to configure the
block device interfaces at the tail of the PCI bus.

This should hopefully address the final concerns in
dkg/kvm-manager#7
parent aee6e387
Branches
Tags backupninja_upstream/1.2.0
No related merge requests found
...@@ -108,6 +108,8 @@ INITRD="$OWNERHOME/vms/$VMNAME/initrd" ...@@ -108,6 +108,8 @@ INITRD="$OWNERHOME/vms/$VMNAME/initrd"
KVMARGS= KVMARGS=
unset KERNEL_CMDLINE unset KERNEL_CMDLINE
declare -a KVM_DISK_DEVS=()
BOOTCHOICE=c BOOTCHOICE=c
if [ -e "$KERNEL" -a -e "$INITRD" ] ; then if [ -e "$KERNEL" -a -e "$INITRD" ] ; then
...@@ -150,7 +152,7 @@ for disk in HD{A..Z}; do ...@@ -150,7 +152,7 @@ for disk in HD{A..Z}; do
if [ -b "${!disk}" ]; then if [ -b "${!disk}" ]; then
driver_var_name="${disk}_DRIVER" driver_var_name="${disk}_DRIVER"
if [ -n "${!driver_var_name}" -a "${!driver_var_name}" = "scsi-hd" ]; then if [ -n "${!driver_var_name}" -a "${!driver_var_name}" = "scsi-hd" ]; then
KVMARGS="$KVMARGS -device virtio-scsi-pci,id=scsi" KVM_DISK_DEVS+=(-device virtio-scsi-pci,id=scsi)
break break
fi fi
fi fi
...@@ -159,7 +161,8 @@ done ...@@ -159,7 +161,8 @@ done
if [ -n "$HDA" ]; then if [ -n "$HDA" ]; then
build_disk_io_params HDA build_disk_io_params HDA
driver=${HDA_DRIVER:-virtio-blk-pci} driver=${HDA_DRIVER:-virtio-blk-pci}
KVMARGS="$KVMARGS -drive file=$HDA,if=none,cache=none,id=disk-${index},format=raw${first_disk_extra_args}${disk_io_params} -device ${driver},drive=disk-${index},bootindex=1" KVMARGS="$KVMARGS -drive file=$HDA,if=none,cache=none,id=disk-${index},format=raw${first_disk_extra_args}${disk_io_params}"
KVM_DISK_DEVS+=(-device "${driver},drive=disk-${index},bootindex=1")
fi fi
# loop here on everything after HDA: # loop here on everything after HDA:
for disk in HD{B..Z}; do for disk in HD{B..Z}; do
...@@ -169,7 +172,8 @@ for disk in HD{B..Z}; do ...@@ -169,7 +172,8 @@ for disk in HD{B..Z}; do
driver_var_name="${disk}_DRIVER" driver_var_name="${disk}_DRIVER"
[ -n "${!driver_var_name}" ] && driver=${!driver_var_name} [ -n "${!driver_var_name}" ] && driver=${!driver_var_name}
build_disk_io_params "${disk}" build_disk_io_params "${disk}"
KVMARGS="$KVMARGS -drive file=${!disk},if=none,cache=none,id=disk-${index},format=raw${disk_io_params} -device ${driver},drive=disk-${index}" KVMARGS="$KVMARGS -drive file=${!disk},if=none,cache=none,id=disk-${index},format=raw${disk_io_params}"
KVM_DISK_DEVS+=(-device "${driver},drive=disk-${index}")
fi fi
done done
...@@ -203,5 +207,5 @@ exec /usr/bin/kvm $KVMARGS \ ...@@ -203,5 +207,5 @@ exec /usr/bin/kvm $KVMARGS \
-chardev "socket,id=serial0,path=$CONSOLENAME,server" -device isa-serial,chardev=serial0 \ -chardev "socket,id=serial0,path=$CONSOLENAME,server" -device isa-serial,chardev=serial0 \
-smp "${SMP:-1},maxcpus=${MAXCPUS:-8}" \ -smp "${SMP:-1},maxcpus=${MAXCPUS:-8}" \
-device "virtio-net-pci,netdev=n1,id=net0,mac=$MAC,bus=pci.0" \ -device "virtio-net-pci,netdev=n1,id=net0,mac=$MAC,bus=pci.0" \
-netdev "tap,id=n1,ifname=$TAP,script=no,downscript=no" -netdev "tap,id=n1,ifname=$TAP,script=no,downscript=no" \
"${KVM_DISK_DEVS[@]}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment