[lxc-devel] [lxc/lxc] 513f23: Refactor lxc-snapshot

GitHub noreply at github.com
Thu Aug 27 20:14:56 UTC 2015


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 513f23df5c0ebdb36954dc75d7bf293a7ec800aa
      https://github.com/lxc/lxc/commit/513f23df5c0ebdb36954dc75d7bf293a7ec800aa
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-08-27 (Thu, 27 Aug 2015)

  Changed paths:
    M src/lxc/arguments.h
    M src/lxc/lxc_snapshot.c

  Log Message:
  -----------
  Refactor lxc-snapshot

- lxc_snapshot.c lacked necessary members in the associated lxc_arguments struct
  in arguments.h. This commit extends the lxc_arguments struct to include
  several parameters used by lxc-snapshot which allows a rewrite that is more
  consistent with the rest of the lxc-* executables.
- All tests have been moved beyond the call to lxc_log_init() to allow for the
  messages to be printed or saved.
- Some small changes to the my_args struct. (The enum task is set to SNAP (for
  snapshot) per default and variables illustrating the usage of the command line
  flags are written in all caps.)
- arguments.h has been extended to accommodate a future rewrite of lxc-clone
- Traditional behaviour of the executable has been retained in this commit.

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: f29bb5d52b777248f6e94c26722a54522f98beef
      https://github.com/lxc/lxc/commit/f29bb5d52b777248f6e94c26722a54522f98beef
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-08-27 (Thu, 27 Aug 2015)

  Changed paths:
    M src/lxc/lxc_destroy.c

  Log Message:
  -----------
  lxc-destroy: Remove container with all snapshots

- This enables the user to destroy a container with all its snapshots without
  having to use lxc-snapshot first to destroy all snapshots. (The enum values
  DESTROY and SNAP from the previous commit are reused here again.)
- Some unification regarding the usage of exit() and return has been done.

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 3d7ad474b07937d39c6c8d7c7fcba67a46900eb0
      https://github.com/lxc/lxc/commit/3d7ad474b07937d39c6c8d7c7fcba67a46900eb0
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-08-27 (Thu, 27 Aug 2015)

  Changed paths:
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  Make LXC_CLONE_KEEPNAME work

- Passing the LXC_CLONE_KEEPNAME flag to do_lxcapi_clone() was not respected and
  let to unexpected behaviour for e.g. lxc-clone. We wrap
  clear_unexp_config_line() and set_config_item_line() in an appropriate
  if-condition.

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 5e8757eda52b54733bad088492062d061331b0d8
      https://github.com/lxc/lxc/commit/5e8757eda52b54733bad088492062d061331b0d8
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-08-27 (Thu, 27 Aug 2015)

  Changed paths:
    M src/lxc/lxc_attach.c
    M src/lxc/lxc_cgroup.c
    M src/lxc/lxc_checkpoint.c
    M src/lxc/lxc_console.c
    M src/lxc/lxc_create.c
    M src/lxc/lxc_device.c
    M src/lxc/lxc_execute.c
    M src/lxc/lxc_freeze.c
    M src/lxc/lxc_info.c
    M src/lxc/lxc_init.c
    M src/lxc/lxc_monitor.c
    M src/lxc/lxc_start.c
    M src/lxc/lxc_stop.c
    M src/lxc/lxc_unfreeze.c
    M src/lxc/lxc_wait.c

  Log Message:
  -----------
  Fix grammar in some of the executables
"NAME for name of the container" becomes "NAME of the container"

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 0ea055b395656950608c9b82009a31344898a035
      https://github.com/lxc/lxc/commit/0ea055b395656950608c9b82009a31344898a035
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-08-27 (Thu, 27 Aug 2015)

  Changed paths:
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  mod_rdep(): Write path and name of clone to file

If we currently create clone-snapshots via lxc-clone only the plain total
number of the containers it serves as a base-container is written to the file
"lxc-snapshots". This commit modifies mod_rdep() so it will store the paths and
names to the containers that are clone-snapshots (similar to the "lxc_rdepends"
file for the clones). **Users which still have containers that have a non-empty
(with a number > 0 as an entry) "lxc-snapshots" file in the old format are not
affected by this change. It will be used until all old clones have been
deleted!** For all others, the "lxc_snapshots" file placed under the original
container now looks like this:

      /var/lib/lxc
      bb
      /var/lib/lxc
      cc
      /opt
      dd

This is an example of a container that provides the base for three
clone-snapshots bb, cc, and dd. Where bb and cc both are placed in the usual
path for privileged containers and dd is placed in a custom path.

- Add additional argument to function that takes in the clone-snapshotted
  lxc_container.
- Have mod_rdep() write the path and name of the clone-snapshotted container the
  file lxc_snapshots of the original container.
- If a clone-snapshot gets deleted the corresponding line in the file
  lxc_snapshot of the original container will be deleted and the file updated
  via mmap() + memmove() + munmap().
- Adapt has_fs_snapshots().
- **If an lxc-snapshot file in the old format is found we'll keep using it.**

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 19712e0473f1caacb8833157a888f7efc3656ff6
      https://github.com/lxc/lxc/commit/19712e0473f1caacb8833157a888f7efc3656ff6
  Author: Christian Brauner <christianvanbrauner at gmail.com>
  Date:   2015-08-27 (Thu, 27 Aug 2015)

  Changed paths:
    M src/lxc/lxc_destroy.c

  Log Message:
  -----------
  Destroy container with snapshots & clone-snapshots

- This enables lxc-destroy to destroy a container with all its snapshots
  including clone-snapshots not located in the snaps/ folder.

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: c01859e8ac5fa51ae7f2dd42caafd5ff5070f743
      https://github.com/lxc/lxc/commit/c01859e8ac5fa51ae7f2dd42caafd5ff5070f743
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2015-08-27 (Thu, 27 Aug 2015)

  Changed paths:
    M src/lxc/lxc_destroy.c

  Log Message:
  -----------
  fix open() results check to include 0

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


Compare: https://github.com/lxc/lxc/compare/2d8632d5b75c...c01859e8ac5f


More information about the lxc-devel mailing list