[lxc-devel] [lxc/lxc] 76a26f: add support for nbd

GitHub noreply at github.com
Fri May 16 13:59:58 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 76a26f559ff2d9d47b2c886310e8e8c95af2c667
      https://github.com/lxc/lxc/commit/76a26f559ff2d9d47b2c886310e8e8c95af2c667
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2014-05-16 (Fri, 16 May 2014)

  Changed paths:
    M src/lxc/bdev.c
    M src/lxc/bdev.h
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/lxccontainer.c
    M src/lxc/start.c
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  add support for nbd

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 at ubuntu.com>
Acked-by: Dwight Engen <dwight.engen at oracle.com>


  Commit: f1c26f2cbdb25da7292ea83446b2ca482973ecb5
      https://github.com/lxc/lxc/commit/f1c26f2cbdb25da7292ea83446b2ca482973ecb5
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2014-05-16 (Fri, 16 May 2014)

  Changed paths:
    M doc/lxc.container.conf.sgml.in

  Log Message:
  -----------
  lxc.container.conf: document the type: lxc.rootfs conventions

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Dwight Engen <dwight.engen at oracle.com>


  Commit: 3abd3e54eb69201ccb72f758d1cd126311dc3055
      https://github.com/lxc/lxc/commit/3abd3e54eb69201ccb72f758d1cd126311dc3055
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2014-05-16 (Fri, 16 May 2014)

  Changed paths:
    M src/lxc/bdev.c

  Log Message:
  -----------
  nbd: exit cleanly if nbd fails to attach

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Dwight Engen <dwight.engen at oracle.com>


Compare: https://github.com/lxc/lxc/compare/7e4ca1a21deb...3abd3e54eb69


More information about the lxc-devel mailing list