Commit 58fbaabf authored by Jérome Perrin's avatar Jérome Perrin

svcbackend/standalone: use shorter names for supervisor sockets

On test nodes, these socket path sometimes exceed the linux limit.
parent e436b779
Pipeline #10525 failed with stage
in 0 seconds
...@@ -65,7 +65,7 @@ def getSupervisorRPC(socket): ...@@ -65,7 +65,7 @@ def getSupervisorRPC(socket):
yield s.supervisor yield s.supervisor
def _getSupervisordSocketPath(instance_root): def _getSupervisordSocketPath(instance_root):
return os.path.join(instance_root, 'supervisord.socket') return os.path.join(instance_root, 'sv.sock')
def _getSupervisordConfigurationFilePath(instance_root): def _getSupervisordConfigurationFilePath(instance_root):
return os.path.join(instance_root, 'etc', 'supervisord.conf') return os.path.join(instance_root, 'etc', 'supervisord.conf')
......
...@@ -63,6 +63,7 @@ from .slap import slap ...@@ -63,6 +63,7 @@ from .slap import slap
from ..util import dumps, rmtree from ..util import dumps, rmtree
from ..grid.svcbackend import getSupervisorRPC from ..grid.svcbackend import getSupervisorRPC
from ..grid.svcbackend import _getSupervisordSocketPath
@zope.interface.implementer(IException) @zope.interface.implementer(IException)
...@@ -355,7 +356,7 @@ class StandaloneSlapOS(object): ...@@ -355,7 +356,7 @@ class StandaloneSlapOS(object):
# https://github.com/torvalds/linux/blob/3848ec5/net/unix/af_unix.c#L234-L238 # https://github.com/torvalds/linux/blob/3848ec5/net/unix/af_unix.c#L234-L238
# Supervisord socket name contains the pid number, which is why we add # Supervisord socket name contains the pid number, which is why we add
# .xxxxxxx in this check. # .xxxxxxx in this check.
if len(os.path.join(base_directory, 'supervisord.socket.xxxxxxx')) > 108: if len(os.path.join(base_directory, 'sv.sock.xxxxxxx')) > 108:
raise PathTooDeepError( raise PathTooDeepError(
'working directory ( {base_directory} ) is too deep'.format( 'working directory ( {base_directory} ) is too deep'.format(
**locals())) **locals()))
...@@ -400,7 +401,7 @@ class StandaloneSlapOS(object): ...@@ -400,7 +401,7 @@ class StandaloneSlapOS(object):
self._instance_pid = os.path.join(run_directory, 'slapos-node-instance.pid') self._instance_pid = os.path.join(run_directory, 'slapos-node-instance.pid')
self._report_pid = os.path.join(run_directory, 'slapos-node-report.pid') self._report_pid = os.path.join(run_directory, 'slapos-node-report.pid')
self._supervisor_socket = os.path.join(run_directory, 'supervisord.sock') self._supervisor_socket = os.path.join(run_directory, 'sv.sock')
SupervisorConfigWriter(self).writeConfig(self._supervisor_config) SupervisorConfigWriter(self).writeConfig(self._supervisor_config)
SlapOSConfigWriter(self).writeConfig(self._slapos_config) SlapOSConfigWriter(self).writeConfig(self._slapos_config)
...@@ -454,9 +455,7 @@ class StandaloneSlapOS(object): ...@@ -454,9 +455,7 @@ class StandaloneSlapOS(object):
This should be used as a context manager. This should be used as a context manager.
""" """
return getSupervisorRPC( return getSupervisorRPC(_getSupervisordSocketPath(self._instance_root))
# this socket path is not configurable.
os.path.join(self._instance_root, "supervisord.socket"))
def format( def format(
self, self,
......
...@@ -151,7 +151,7 @@ class BasicMixin(object): ...@@ -151,7 +151,7 @@ class BasicMixin(object):
if getattr(self, 'master_url', None) is None: if getattr(self, 'master_url', None) is None:
self.master_url = 'http://127.0.0.1:80/' self.master_url = 'http://127.0.0.1:80/'
self.computer_id = 'computer' self.computer_id = 'computer'
self.supervisord_socket = os.path.join(self._tempdir, 'supervisord.sock') self.supervisord_socket = os.path.join(self._tempdir, 'sv.sock')
self.supervisord_configuration_path = os.path.join(self._tempdir, self.supervisord_configuration_path = os.path.join(self._tempdir,
'supervisord') 'supervisord')
self.usage_report_periodicity = 1 self.usage_report_periodicity = 1
...@@ -227,7 +227,7 @@ class BasicMixin(object): ...@@ -227,7 +227,7 @@ class BasicMixin(object):
def assertInstanceDirectoryListEqual(self, instance_list): def assertInstanceDirectoryListEqual(self, instance_list):
instance_list.append('etc') instance_list.append('etc')
instance_list.append('var') instance_list.append('var')
instance_list.append('supervisord.socket') instance_list.append('sv.sock')
six.assertCountEqual(self, os.listdir(self.instance_root), instance_list) six.assertCountEqual(self, os.listdir(self.instance_root), instance_list)
def tearDown(self): def tearDown(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment