Merge "Repair job-abort" into stable/mitaka
This commit is contained in:
commit
7082f39b6c
|
@ -18,7 +18,6 @@ Freezer main execution function
|
|||
"""
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
@ -208,8 +207,6 @@ def main():
|
|||
CONF.print_help()
|
||||
sys.exit(1)
|
||||
|
||||
signal.signal(signal.SIGUSR1, utils.abort_subprocess)
|
||||
|
||||
freezer_main(backup_args)
|
||||
except Exception as err:
|
||||
quiet = backup_args.quiet if backup_args else False
|
||||
|
@ -217,6 +214,7 @@ def main():
|
|||
LOG.critical("End freezer agent process unsuccessfully")
|
||||
return fail(1, err, quiet)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
sys.exit(main())
|
||||
|
|
|
@ -322,8 +322,11 @@ class Job(object):
|
|||
elif output:
|
||||
self.upload_metadata(output)
|
||||
|
||||
if self.process.returncode == 33:
|
||||
# This means the job action was aborted by the scheduler.
|
||||
if self.process.returncode == -15:
|
||||
# This means the job action was aborted by the scheduler
|
||||
LOG.warning('Freezer-agent was killed by the scheduler. '
|
||||
'Cleanup should be done manually: container, '
|
||||
'mountpoint and lvm snapshots.')
|
||||
return Job.ABORTED_RESULT
|
||||
|
||||
elif self.process.returncode:
|
||||
|
|
|
@ -114,7 +114,7 @@ def terminate_subprocess(pid, name):
|
|||
try:
|
||||
process = psutil.Process(pid)
|
||||
if process.name.startswith(name):
|
||||
os.kill(pid, signal.SIGUSR1)
|
||||
os.kill(pid, signal.SIGTERM)
|
||||
else:
|
||||
LOG.warning('The name {} does not match the pid {}'.format(
|
||||
name, pid))
|
||||
|
|
|
@ -23,7 +23,6 @@ import re
|
|||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from distutils import spawn as distspawn
|
||||
from functools import wraps
|
||||
|
@ -459,17 +458,6 @@ def set_max_process_priority():
|
|||
LOG.warning('Priority: {0}'.format(priority_error))
|
||||
|
||||
|
||||
def abort_subprocess(signum, frame):
|
||||
try:
|
||||
LOG.warning('Process {} has been aborted by the scheduler'.format(
|
||||
os.getpid()))
|
||||
raise Exception('Aborting process')
|
||||
except Exception:
|
||||
LOG.error(traceback.print_exc())
|
||||
finally:
|
||||
sys.exit(33)
|
||||
|
||||
|
||||
def days_to_seconds(n):
|
||||
"""
|
||||
86400 seconds in a day
|
||||
|
|
Loading…
Reference in New Issue