Ganeti supports LXC as one of its hypervisor but it is outdated and broken.
This patch series fixes existing broken implementation of LXC hypervisor.
First, fix existing broken implementation of LXC hypervisor to make it working.
Fix around storage mount, instance start, instance stop, daemonized process
handling and add unit tests.
These changes are expecting LXC >= 1.0.0 is installed, but the old
implementation was totally broken so I believe adding this requirement won't
be a problem.
Second, improve around cgroup management to support various environment.
Existing implementation of cgroup functions in hv_lxc is very poor because
it assuming cgroup fs is already mounted, and also assuming first mount point
of cgroup fs that appeares in /proc/mounts, containing all subsystems in it.
We should mount required cgroup fs manually if needed and respect cgroup
hierarchy that is currently belonging.
Third, change location of lxc-start log file for usability.
- Add instance uuid to lxc-start log file name to keep it isolated between
old/new instances having same name.
- Move lxc-start log file location from var/run/ganeti/lxc/*.log
to var/log/ganeti/lxc/*.log. It is more handy if we could do something like:
tail -F /var/log/ganeti/{,lxc/}*.log
Yuto KAWAMURA(kawamuray) (24):
Fix quote style in hv_lxc
Fix broken StopInstance in hv_lxc
Fix GetAllInstanceInfo in hv_lxc
Add functions to perform block device partition mapping
Add functions to manage instance stash file in hv_lxc
Mount rootfs by LXC container
Change StartInstance behavior in hv_lxc
Add _IsInstanceAlive method in hv_lxc
Change GetInstanceInfo to use _IsInstanceAlive in hv_lxc
Change StopInstance to use _IsInstanceAlive in hv_lxc
Add RunResultOk helper to hv_lxc unit test
Add unit tests for _IsInstanceAlive of hv_lxc
Add unit tests for GetInstanceInfo of hv_lxc
Extend failed_by_timeout flag to RunResult
Improve starting process of LXC container
Rename functions _Instance*File to _Instance*FilePath
Changed strategy of cgroup fs management in hv_lxc
Add _GetCgroupInstanceValue in hv_lxc
Respect cgroup hierarchy currently belonging in hv_lxc
Add unit tests for cgroup management functions of hv_lxc
Add function _EnsureCgroupMounts in hv_lxc
Include the instance uuid in the lxc instance log filename
Move lxc-start log file location to var/log/ganeti/lxc
Add additional verification procedure to hv_lxc
lib/hypervisor/hv_lxc.py | 531 +++++++++++++++++----
lib/utils/process.py | 6 +-
lib/utils/storage.py | 69 ++-
man/gnt-instance.rst | 32 ++
src/Ganeti/Constants.hs | 18 +-
.../cpuset/some_group/lxc/instance1/cpuset.cpus | 1 +
.../devices/some_group/lxc/instance1/devices.list | 1 +
.../memory/lxc/instance1/memory.limit_in_bytes | 1 +
test/data/proc_cgroup.txt | 4 +
test/py/ganeti.hypervisor.hv_lxc_unittest.py | 185 +++++++
test/py/ganeti.utils.process_unittest.py | 10 +
11 files changed, 762 insertions(+), 96 deletions(-)
create mode 100644
test/data/cgroup_root/cpuset/some_group/lxc/instance1/cpuset.cpus
create mode 100644
test/data/cgroup_root/devices/some_group/lxc/instance1/devices.list
create mode 100644
test/data/cgroup_root/memory/lxc/instance1/memory.limit_in_bytes
create mode 100644 test/data/proc_cgroup.txt
--
1.8.5.5