rcbops / rpc-maas

Ansible playbooks for deploying Rackspace Monitoring-as-a-Service within Openstack Environments
Apache License 2.0
32 stars 68 forks source link

Make storage check use df in container namespace #725

Closed JCallicoat closed 4 months ago

JCallicoat commented 3 years ago

The previous method of using chroot to check container storage fails when the container uses a symlink from /etc/mtab to ../proc/self/mounts since the container is running in an isolated pid/mnt namespace and /proc/self is not visible in the chroot.

This commit uses the the attach_wait method from the lxc module to run the df command in the container pid/mnt namespace and parses the df output to gather usage percentage for each mounted device.

Fixes #724

BjoernT commented 3 years ago

Yes that's how we had it pretty much done for other checks to use lxc-attach. But these checks had been deactivated due to pytho3 issues with the lxc-python module. Did you test this on a recent deployment under python3?

rax-rstark commented 3 years ago

Is it worth having a python2 branch with this fix in place?

BjoernT commented 3 years ago

Is it worth having a python2 branch with this fix in place?

We already have a python2 branch in place but we need to check if this was also used for docker containers (OSP) or just lxc