-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Non isolation between running FDUs as option deployment of the Plugin…
… + Environment variable as parameters in run/start (#7) * Implementing non isolation as configurable parameter for the Native Plugin (#1) * added callback function for blocking run Signed-off-by: gabrik <[email protected]> * Added templates for blocking run fdus and implemented blocking run eval Signed-off-by: gabrik <[email protected]> * added evals for log, ls and file Signed-off-by: gabrik <[email protected]> * fix typo in get_log_fdu Signed-off-by: gabrik <[email protected]> * added start_fdu function for eval starting with env vars, updated run_blocking_fdu with env var parameter Signed-off-by: gabrik <[email protected]> * fix return of start_fdu Signed-off-by: gabrik <[email protected]> * fix return type of start_fdu Signed-off-by: gabrik <[email protected]> * fix in the implementation of start/run/log/ls/get_file evals Signed-off-by: gabrik <[email protected]> * reorganisation to merge with native plugin (with isolation) Signed-off-by: gabrik <[email protected]> * recopied old files into the rigth path Signed-off-by: gabrik <[email protected]> * moved current isolated Native inside isolation.py and updated the native_plugin to start the correct one depending on the configuration, updated copyright years Signed-off-by: gabrik <[email protected]> * added start/run/log/ls/get_file eval to isolated native plugin Signed-off-by: gabrik <[email protected]> * added utility function for parsing the environment Signed-off-by: gabrik <[email protected]> * updated makefile Signed-off-by: gabrik <[email protected]> * added missing files Signed-off-by: gabrik <[email protected]> * Adding missing service file Signed-off-by: gabrik <[email protected]> * typo fixes Signed-off-by: gabrik <[email protected]> * Added +x to to_uuid.sh Signed-off-by: gabrik <[email protected]> * added missing functions Signed-off-by: gabrik <[email protected]> * fixing missing namespace parameter in run and start FDU, in isolation Signed-off-by: gabrik <[email protected]> * fixing missing parameters in isolation.py Signed-off-by: gabrik <[email protected]> * using -E before to keep same environment variables in isolated binary Signed-off-by: gabrik <[email protected]> * updated fos_containerize usage Signed-off-by: gabrik <[email protected]>
- Loading branch information
Showing
24 changed files
with
1,995 additions
and
653 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Copyright (c) 2014,2020 ADLINK Technology Inc. | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Eclipse Public License 2.0 which is available at | ||
# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
# which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
# | ||
# Contributors: Gabriele Baldoni, ADLINK Technology Inc. - Base plugins set | ||
|
||
import sys | ||
import os | ||
from fog05_sdk.interfaces.States import State | ||
from fog05_sdk.interfaces.InfraFDU import InfraFDU | ||
|
||
class NativeNoIsolationFDU(InfraFDU): | ||
def __init__(self, data): | ||
super(NativeNoIsolationFDU, self).__init__(data) | ||
|
||
self.name = 'n{}'.format(self.uuid) | ||
self.cmd = None | ||
self.args = None | ||
|
||
if self.command is not None: | ||
self.cmd = self.command.get('binary') | ||
self.args = self.command.get('args') | ||
|
||
self.outfile = None | ||
self.pid = -1 | ||
self.process = None | ||
self.source = '' | ||
# self.outfile = '' | ||
|
||
def set_cmd(self, command): | ||
self.command = command | ||
if command is not None: | ||
self.cmd = command.get('binary') | ||
self.args = command.get('args') | ||
|
||
def on_defined(self): | ||
self.set_status(State.DEFINED) | ||
|
||
def on_configured(self, configuration): | ||
self.conf = configuration | ||
self.set_status(State.CONFIGURED) | ||
|
||
def on_clean(self): | ||
self.set_status(State.DEFINED) | ||
|
||
def on_start(self, pid, process): | ||
self.pid = pid | ||
self.process = process | ||
self.set_status(State.RUNNING) | ||
|
||
def on_stop(self): | ||
self.pid = -1 | ||
self.process = None | ||
self.set_status(State.CONFIGURED) | ||
|
||
def on_pause(self): | ||
self.set_status(State.PAUSED) | ||
|
||
def on_resume(self): | ||
self.set_status(State.RUNNING) | ||
|
||
def before_migrate(self): | ||
pass | ||
|
||
def after_migrate(self): | ||
pass | ||
|
||
def __str__(self): | ||
s = 'UUID {} Name {} Command {} ARGS {} OUTFILE {} PID {}' \ | ||
' SOURCE {}'.format(self.uuid, self.name, self.command, | ||
self.args, self.outfile, self.pid, self.image) | ||
return s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.