Skip to content

Commit

Permalink
Add check for empty dir for podman connection mount
Browse files Browse the repository at this point in the history
Workaround for issue containers/podman#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.
  • Loading branch information
sshnaidm committed Jul 5, 2020
1 parent 8d44ce9 commit a0868a7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/connection/podman.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
__metaclass__ = type

import distutils.spawn
import os
import shlex
import shutil
import subprocess
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit a0868a7

Please sign in to comment.