Merge PR #40223 into master

* refs/pull/40223/head:
	cephadm: prevent podman from breaking socket.getfqdn()

Reviewed-by: Daniel Pivonka <dpivonka@redhat.com>
This commit is contained in:
Sage Weil 2021-03-19 08:31:24 -04:00
commit 6b43b2bfe6
2 changed files with 8 additions and 3 deletions

View File

@ -135,3 +135,4 @@ sunnyku Sunny Kumar <sunkumar@redhat.com>
adk3798 Adam King <adking@redhat.com>
runsisi luo runbing <luo.runbing@zte.com.cn>
xxhdx1985126 Xuehan Xu <xuxuehan@360.cn>
Daniel-Pivonka Daniel Pivonka <dpivonka@redhat.com>

View File

@ -3036,9 +3036,13 @@ class CephContainer:
'--ipc=host',
]
if 'podman' in self.ctx.container_path and \
os.path.exists('/etc/ceph/podman-auth.json'):
cmd_args.append('--authfile=/etc/ceph/podman-auth.json')
if 'podman' in self.ctx.container_path:
# podman adds the container *name* to /etc/hosts (for 127.0.1.1)
# by default, which makes python's socket.getfqdn() return that
# instead of a valid hostname.
cmd_args.append('--no-hosts')
if os.path.exists('/etc/ceph/podman-auth.json'):
cmd_args.append('--authfile=/etc/ceph/podman-auth.json')
envs: List[str] = [
'-e', 'CONTAINER_IMAGE=%s' % self.image,