Implemented a wrapper over every function from daemon_unix. This will help on porting daemon to Windows.
Signed-off-by: Paul-Daniel Boca <pb...@cloudbasesolutions.com> --- V2: No changes. --- python/automake.mk | 1 + python/ovs/daemon.py | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 python/ovs/daemon.py diff --git a/python/automake.mk b/python/automake.mk index 157604d..1bbe390 100644 --- a/python/automake.mk +++ b/python/automake.mk @@ -10,6 +10,7 @@ ovstest_pyfiles = \ ovs_pyfiles = \ python/ovs/__init__.py \ + python/ovs/daemon.py \ python/ovs/daemon_unix.py \ python/ovs/fcntl_win.py \ python/ovs/db/__init__.py \ diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py new file mode 100644 index 0000000..b1d6c36 --- /dev/null +++ b/python/ovs/daemon.py @@ -0,0 +1,77 @@ +# Copyright (c) 2016 Cloudbase Solutions Srl +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys + +# This is only a wrapper over Linux implementations +if sys.platform != "win32": + import ovs.daemon_unix as daemon_util + +RESTART_EXIT_CODE = daemon_util.RESTART_EXIT_CODE + + +def make_pidfile_name(name): + return daemon_util.make_pidfile_name(name) + + +def set_pidfile(name): + daemon_util.set_pidfile(name) + + +def set_no_chdir(): + daemon_util.set_no_chdir() + + +def ignore_existing_pidfile(): + daemon_util.ignore_existing_pidfile() + + +def set_detach(): + daemon_util.set_detach() + + +def get_detach(): + return daemon_util.get_detach() + + +def set_monitor(): + daemon_util.set_monitor() + + +def daemonize(): + daemon_util.daemonize() + + +def daemonize_start(): + daemon_util.daemonize_start() + + +def daemonize_complete(): + daemon_util.daemonize_complete() + + +def usage(): + daemon_util.usage() + + +def read_pidfile(pidfile_name): + return daemon_util.read_pidfile(pidfile_name) + + +def add_args(parser): + daemon_util.add_args(parser) + + +def handle_args(args): + daemon_util.handle_args(args) -- 2.7.2.windows.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev