Closed skyzh closed 5 months ago
TODO: add test cases, and ready for review :)
Due to (probably) a bug of QEMU, we cannot directly append serial=
in the -drive field. It can only be specified in -device. And it doesn't boot if we only change one drive to use -device virtio. We have to change all attached drives to use -drive + -device.
Perhaps this is intentional. From man qemu-system-x86_64
:
-drive option[,option[,option[,...]]]
Define a new drive. This includes creating a block driver node (the backend) as well
as a guest device, and is mostly a shortcut for defining the corresponding -blockdev
and -device options.
So the idea is -blockdev
is responsible for the disk "backend" and -device
is for disk "frontend". Since serial
is a virtualized property, it is define on a "frontend" side.
How about with smth like lsblk -o "serial,name" -p? Or perhaps look it up how lsblk does it and reimplement the same way.
@Omrigan unfortunately, lsblk does not show the serial number or name for the raw block device :( could be a bug with lsblk.
Put this pull request on hold until we hit the disk space limit. This pull request only makes sense if the LFC take a significant amount of space and we need to reclaim the space very quickly. Also need to address the page cache problem -- it seems that raw block devices do not take the full page cache.
Discussed with @skyzh, closing for the time being.
This pull request adds support for mounting a raw block device to the VM for future local file cache implementation.
blkid
to find the disk. We attached the disk withserial=<ID>
.serial=<ID>
in the-drive
field. It can only be specified in-device
. And it doesn't boot if we only change one drive to use-device virtio
. We have to change all attached drives to use-drive
+-device
.blkid
does not look at serial number.udevadm info --query=all
will only print the serial number afterudevadm trigger
, but it doesn't work at boot. Therefore, we have to useudevadm -a
to walk through all attributes and find the serial number.mountPath
.https://github.com/neondatabase/neon/issues/6919