-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
Description
In some situations, glusterfs.peered fails to detect a peer as being localhost.
More concretely, in some cases salt.utils.network.host_to_ips(name) may return an address like 127.0.1.1. This happens for instance if the host name is associated to a loopback address in /etc/hosts.
This loopback address obviously never matches the addresses returned by salt.utils.network.ip_addrs() or salt.utils.network.ip_addrs6(), hence localhost detection fails.
Setup
# salt 'minion1' cmd.run 'cat /etc/hosts'
minion1:
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.1.1 minion1 minion1
$ cat glusterfs.sls
Add gluster peers:
glusterfs.peered:
- names:
- minion1
- minion2
Moreover, the minions must have glusterd installed and running.
Steps to Reproduce the behavior
# salt 'minion1' state.apply glusterfs
(...)
ID: Add gluster peers
Function: glusterfs.peered
Name: minion1
Result: False
Comment: Host minion1 was successfully peered but did not appear in the list of peers
Started: (...)
Duration: (...)
Changes:
----------
ID: Add gluster peers
Function: glusterfs.peered
Name: minion2
Result: True
Comment: Host minion2 already peered
Started: (...)
Duration: (...)
Changes:
(...)
Expected behavior
Peering minion1 shouldn't fail, and instead the comment should have been "Peering with localhost is not needed".
Screenshots
If applicable, add screenshots to help explain your problem.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3004.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.2
libgit2: Not Installed
M2Crypto: 0.38.0
Mako: Not Installed
msgpack: 1.0.3
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.12.0
pygit2: Not Installed
Python: 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0]
python-gnupg: Not Installed
PyYAML: 6.0
PyZMQ: 23.2.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: arch
locale: utf-8
machine: x86_64
release: 5.18.7-arch1-1
system: Linux
version: Arch Linux