From 015bf00ab0d022de898a6568b6824095f12a583b Mon Sep 17 00:00:00 2001 From: Sergey Date: Mon, 6 Jul 2020 01:49:02 +0300 Subject: [PATCH] Add check for empty dir for podman connection mount (#72) Workaround for issue https://github.com/containers/libpod/issues/6856 When podman runs with CGroups v2 and rootless container, it mounts directory without error, but mounted directory is empty. Add check for the directory if it's empty. --- plugins/connection/podman.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/connection/podman.py b/plugins/connection/podman.py index 6eea59f8..12b542e6 100644 --- a/plugins/connection/podman.py +++ b/plugins/connection/podman.py @@ -11,6 +11,7 @@ __metaclass__ = type import distutils.spawn +import os import shlex import shutil import subprocess @@ -141,6 +142,9 @@ def _connect(self): rc, self._mount_point, stderr = self._podman("mount") if rc != 0: display.v("Failed to mount container %s: %s" % (self._container_id, stderr.strip())) + elif not os.listdir(self._mount_point.strip()): + display.v("Failed to mount container with CGroups2: empty dir %s" % self._mount_point.strip()) + self._mount_point = None else: self._mount_point = self._mount_point.strip() display.vvvvv("MOUNTPOINT %s RC %s STDERR %r" % (self._mount_point, rc, stderr))