Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
slapos.core
Commits
aedc5b55
Commit
aedc5b55
authored
Jan 22, 2015
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.grid.svcbackend: check if watchdog is started before restarting.
Also do not autorestart.
parent
961419ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
slapos/grid/svcbackend.py
slapos/grid/svcbackend.py
+18
-14
slapos/grid/templates/supervisord.conf.in
slapos/grid/templates/supervisord.conf.in
+0
-1
No files found.
slapos/grid/svcbackend.py
View file @
aedc5b55
...
@@ -39,7 +39,7 @@ import xmlrpclib
...
@@ -39,7 +39,7 @@ import xmlrpclib
from
slapos.grid.utils
import
(
createPrivateDirectory
,
SlapPopen
,
updateFile
)
from
slapos.grid.utils
import
(
createPrivateDirectory
,
SlapPopen
,
updateFile
)
from
supervisor
import
xmlrpc
from
supervisor
import
xmlrpc
,
states
def
getSupervisorRPC
(
socket
):
def
getSupervisorRPC
(
socket
):
...
@@ -59,7 +59,7 @@ def _getSupervisordConfigurationFilePath(instance_root):
...
@@ -59,7 +59,7 @@ def _getSupervisordConfigurationFilePath(instance_root):
def
_getSupervisordConfigurationDirectory
(
instance_root
):
def
_getSupervisordConfigurationDirectory
(
instance_root
):
return
os
.
path
.
join
(
instance_root
,
'etc'
,
'supervisord.conf.d'
)
return
os
.
path
.
join
(
instance_root
,
'etc'
,
'supervisord.conf.d'
)
def
createSupervisordConfiguration
(
instance_root
,
watchdog_command
=
'
sleep 10
'
):
def
createSupervisordConfiguration
(
instance_root
,
watchdog_command
=
''
):
"""
"""
Create supervisord related files and directories.
Create supervisord related files and directories.
"""
"""
...
@@ -105,6 +105,21 @@ def createSupervisordConfiguration(instance_root, watchdog_command='sleep 10'):
...
@@ -105,6 +105,21 @@ def createSupervisordConfiguration(instance_root, watchdog_command='sleep 10'):
}
}
)
)
def
_updateWatchdog
(
socket
):
"""
In special cases, supervisord can be started using configuration
with empty watchdog parameter.
Then, when running slapgrid, the real watchdog configuration is generated.
We thus need to reload watchdog configuration if needed and start it.
"""
supervisor
=
getSupervisorRPC
(
socket
)
if
supervisor
.
getProcessInfo
(
'watchdog'
)[
'state'
]
not
in
states
.
RUNNING_STATES
:
# XXX workaround for https://github.com/Supervisor/supervisor/issues/339
# In theory, only reloadConfig is needed.
supervisor
.
removeProcessGroup
(
'watchdog'
)
supervisor
.
reloadConfig
()
supervisor
.
addProcessGroup
(
'watchdog'
)
def
launchSupervisord
(
instance_root
,
logger
,
def
launchSupervisord
(
instance_root
,
logger
,
supervisord_additional_argument_list
=
None
):
supervisord_additional_argument_list
=
None
):
configuration_file
=
_getSupervisordConfigurationFilePath
(
instance_root
)
configuration_file
=
_getSupervisordConfigurationFilePath
(
instance_root
)
...
@@ -127,18 +142,7 @@ def launchSupervisord(instance_root, logger,
...
@@ -127,18 +142,7 @@ def launchSupervisord(instance_root, logger,
else
:
else
:
if
status
[
'statename'
]
==
'RUNNING'
and
status
[
'statecode'
]
==
1
:
if
status
[
'statename'
]
==
'RUNNING'
and
status
[
'statecode'
]
==
1
:
logger
.
debug
(
'Supervisord already running.'
)
logger
.
debug
(
'Supervisord already running.'
)
_updateWatchdog
(
socket
)
# Update watchdog
supervisor
=
getSupervisorRPC
(
socket
)
try
:
# XXX workaround for https://github.com/Supervisor/supervisor/issues/339
# In theory, only reloadConfig is needed.
supervisor
.
stopProcess
(
'watchdog'
)
supervisor
.
removeProcessGroup
(
'watchdog'
)
except
:
pass
supervisor
.
reloadConfig
()
supervisor
.
addProcessGroup
(
'watchdog'
)
return
return
elif
status
[
'statename'
]
==
'SHUTDOWN_STATE'
and
status
[
'statecode'
]
==
6
:
elif
status
[
'statename'
]
==
'SHUTDOWN_STATE'
and
status
[
'statecode'
]
==
6
:
logger
.
info
(
'Supervisor in shutdown procedure, will check again later.'
)
logger
.
info
(
'Supervisor in shutdown procedure, will check again later.'
)
...
...
slapos/grid/templates/supervisord.conf.in
View file @
aedc5b55
...
@@ -22,4 +22,3 @@ chmod=0700
...
@@ -22,4 +22,3 @@ chmod=0700
[eventlistener:watchdog]
[eventlistener:watchdog]
command=%(watchdog_command)s
command=%(watchdog_command)s
events=PROCESS_STATE_EXITED, PROCESS_STATE_FATAL
events=PROCESS_STATE_EXITED, PROCESS_STATE_FATAL
autorestart=true
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment