neondatabase / autoscaling

Postgres vertical autoscaling in k8s
Apache License 2.0
152 stars 21 forks source link

runner: mount raw block device #822

Closed skyzh closed 5 months ago

skyzh commented 7 months ago

This pull request adds support for mounting a raw block device to the VM for future local file cache implementation.

https://github.com/neondatabase/neon/issues/6919

skyzh commented 6 months ago

TODO: add test cases, and ready for review :)

Omrigan commented 6 months ago

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.

skyzh commented 6 months ago

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.

skyzh commented 5 months ago

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.

Omrigan commented 5 months ago

Discussed with @skyzh, closing for the time being.