Page MenuHomePhabricator

Several bugs in cluster configuration
In progress, Requires assessmentPublicBUG

Description

Hello!
In cluster configuration there are two bugs:

  1. It is possible to configure a cluster with short hostnames as the node name, but it can't be resolved.
  2. It is possible to configure signaling interface for a cluster with DHCP configuration, but it can't be guaranteed that IP will be configured at the moment of heartbeat start and as addition, this configuration can't be loaded during boot, due to checking in the configuration script.

The first problem could be fixed with the next patch:

The first problem could be fixed with the next patch:

diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index 1988f7b..0aa6399 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -45,7 +45,7 @@ config_file_resolv = '/etc/resolv.conf'
 config_tmpl_hosts = """
 ### Autogenerated by host_name.py ###
 127.0.0.1       localhost
-127.0.1.1       {{ hostname }}{% if domain_name %}.{{ domain_name }}{% endif %}
+127.0.1.1       {{ hostname }}{% if domain_name %}.{{ domain_name }} {{ hostname }}{% endif %}

 # The following lines are desirable for IPv6 capable hosts
 ::1             localhost ip6-localhost ip6-loopback
@@ -258,18 +258,16 @@ def apply(config):
     if config is None:
         return None

-    fqdn = config['hostname']
-    if config['domain_name']:
-        fqdn += '.' + config['domain_name']
+    hostname = config['hostname']

     # rsyslog runs into a race condition at boot time with systemd
     # restart rsyslog only if the hostname changed.
     hn = subprocess.check_output(['hostnamectl', '--static']).decode().strip()

-    os.system("hostnamectl set-hostname --static {0}".format(fqdn.rstrip('.')))
+    os.system("hostnamectl set-hostname --static {0}".format(hostname))

     # Restart services that use the hostname
-    if hn != fqdn:
+    if hn != hostname:
         os.system("systemctl restart rsyslog.service")

     # If SNMP is running, restart it too

After this patch, the short hostname of a router can be resolved properly, like by default in Debian or VyOS 1.1.8.

It seems that a proper solution for the second problem should be denying of using interfaces without a static IP for set cluster interface.

Details

Difficulty level
Unknown (require assessment)
Version
1.2.2
Why the issue appeared?
Will be filled on close

Event Timeline

zsdc created this task.Jul 16 2019, 8:50 PM
zsdc assigned this task to UnicronNL.
zsdc changed the task status from Open to In progress.
pasik added a subscriber: pasik.Mon, Jul 22, 9:00 PM