Attach additional raw rbd device to VM?


Is it possible to attach an additional rbd device to a VM as a block device vs as a 9p mount?

Currently it’s only possible if you do it by hand, I don’t see any reason why we couldn’t pretty easily tweak our existing logic to support the existing ceph rbd/fs syntax in the source field of a disk device. @tomp want to take a look at this since you’ve done the existing disk implementation?

For now, you’ll need to run rbd map -p POOL VOL and then add something like:

lxc config device add NAME my-rbd disk source=/dev/rbdX

Or if you’re lucky enough to be on a system where you get named devices, then possibly something like:

lxc config device add NAME my-rbd disk source=/dev/rbd/POOL/VOL

This will attach it as a drive to the VM.

@tomp if you end up looking into this, note that I believe qemu has a native ceph rbd implementation which we could leverage instead of having to map + use normal drive code. That would take some of the logic away from the kernel.

Though if that’s not trivial to do, I’d say we just use the existing logic we have in place and pass it as a normal block device.

I’ve created an issue for this at