Create LXC containers with a rootfs dir

Previously, an LXC container's rootfs was being placed into
/var/lib/lxc/<container>/rootfs.  Commit
https://review.openstack.org/#/c/190048/8 inadvertently changed this so
that a container's rootfs is now placed into /var/lib/lxc/<container/.
The downside here is that we now have a directory containing a
container's root fs and the LXC configuration for the container.

This change creates a new role-level variable called
lxc_container_rootfs_directory which defaults to
"{{ lxc_container_directory }}/{{ container_name }}/rootfs" and passes
this variable when creating the container.

Change-Id: Ibbaa879166f5efaf7ca96add131cc3762dd88653
Closes-Bug: #1470101
This commit is contained in:
Matt Thompson
2015-06-30 13:57:57 +01:00
parent 85905fbf8f
commit 04149af86b
2 changed files with 2 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ lxc_container_template: ubuntu
# lxc container rootfs directory and cache path
lxc_container_directory: "/var/lib/lxc"
lxc_container_cache_path: "/var/cache/lxc"
lxc_container_rootfs_directory: "{{ lxc_container_directory }}/{{ container_name }}/rootfs"
# container_fs.* is only used with building on an LVM backend
lxc_container_fs_size: 5G

View File

@@ -57,7 +57,7 @@
template: "{{ properties.container_template|default(lxc_container_template) }}"
state: started
backing_store: "{{ properties.container_backing_store|default(lxc_container_backing_store) }}"
directory: "{{ lxc_container_directory }}/{{ container_name }}"
directory: "{{ lxc_container_rootfs_directory }}"
fs_size: "{{ properties.container_fs_size|default(lxc_container_fs_size) }}"
fs_type: "{{ properties.container_fs_type|default(lxc_container_fs_type) }}"
vg_name: "{{ properties.container_vg_name|default(lxc_container_vg_name) }}"