-
add support for nbd · 76a26f55Serge Hallyn authored
backing stores supported by qemu-nbd can be attached to a nbd block device using qemu-nbd. This user-space process (pair) stays around for the duration of the device attachment. Obviously we want it to go away when the container shuts down, but not before the filesystems have been cleanly unmounted. The device attachment is done from the task which will become the container monitor before the container setup+init task is spawned. That task starts in a new pid namespace to ensure that the qemu-nbd process will be killed if need be. It sets its parent death signal to sighup, and, on receiving sighup, attempts to do a clean qemu-device detach, then exits. This should ensure that the device is detached if the qemu monitor crashes or exits. It may be worth adding a delay before the qemu-nbd is detached, but my brief tests haven't seen any data corruption. Only the parts required for running a nbd-backed container are implemented here. Create, destroy, and clone are not. The first use of this that I imagine is for people to use downloaded nbd-backed images (like ubuntu cloud images, or anything previously used with qemu). I imagine people will want to create/clone/destroy out of band using qemu-img, but if I'm wrong about that we can implement the rest later. Because attach_block_device() is done before the bdev is initialized, and bdev_init needs to know the nbd index so that it can mount the filesystem, we now need to pass the lxc_conf. file_exists() is moved to utils.c so we can use it from bdev.c The nbd attach/detach should lay the groundwork for trivial implementation of qed and raw images. changelog (may 12): fix idx check at detach changelog (may 15): generalize qcow2 to nbd Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Dwight Engen <dwight.engen@oracle.com>
76a26f55
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| include | Loading commit data... | |
| lua-lxc | Loading commit data... | |
| lxc | Loading commit data... | |
| python-lxc | Loading commit data... | |
| tests | Loading commit data... | |
| Makefile.am | Loading commit data... |