Comment # 1 on bug 1157133 from
I found the discussion years ago.
https://lists.gnu.org/archive/html/qemu-devel/2015-01/msg04406.html

For the virtio-mmio devices, including virtio-blk-device, the devices are
inserted in reverse order, i.e. hd1 was inserted into the head of the list
instead of the tail, so hd1 became vda instead of vdb.

The easy workaround is to switch the order of parameters for hd0 and hd1.
However, if the order really matters, using scsi-hd could be a solution.

For example:

-device virtio-scsi-pci,id=scsi0 \
\
-blockdev driver=file,node-name=hd0-file,filename=hd0.img,cache.no-flush=on \
-blockdev driver=qcow2,node-name=hd0,file=hd0-file,cache.no-flush=on \
-device
scsi-hd,bus=scsi0.0,scsi-id=0,id=hd0-device,drive=hd0,bootindex=0,serial=hd0 \
\
-blockdev driver=file,node-name=hd1-file,filename=hd1.img,cache.no-flush=on \
-blockdev driver=qcow2,node-name=hd1,file=hd1-file,cache.no-flush=on \
-device scsi-hd,bus=scsi0.0,scsi-id=1,id=hd1-device,drive=hd1,serial=hd1

I can specify the scsi-id directly, so the order of the disks on scsi0 is
fixed, and the order of the parameters arbitrarily doesn't matter anymore.


You are receiving this mail because: