def _start_ovsdb(self): """Start ``ovsdb-server`` instance. :returns: None """ ovsdb_tool_bin = settings.getValue('TOOLS')['ovsdb-tool'] tasks.run_task([ 'sudo', ovsdb_tool_bin, 'create', os.path.join(settings.getValue('TOOLS')['ovs_etc_tmp'], 'conf.db'), settings.getValue('TOOLS')['ovsschema'] ], self._logger, 'Creating ovsdb configuration database...') ovsdb_server_bin = settings.getValue('TOOLS')['ovsdb-server'] if settings.getValue('CLEAN_OUTPUT'): tasks.run_background_task([ 'sudo', ovsdb_server_bin, '--remote=punix:%s' % os.path.join( settings.getValue('TOOLS')['ovs_var_tmp'], 'db.sock'), '--remote=db:Open_vSwitch,Open_vSwitch,manager_options', '--pidfile=' + self._ovsdb_pidfile_path, '--overwrite-pidfile', '--verbose=off' ], self._logger, 'Starting ovsdb-server...') else: tasks.run_background_task([ 'sudo', ovsdb_server_bin, '--remote=punix:%s' % os.path.join( settings.getValue('TOOLS')['ovs_var_tmp'], 'db.sock'), '--remote=db:Open_vSwitch,Open_vSwitch,manager_options', '--pidfile=' + self._ovsdb_pidfile_path, '--overwrite-pidfile' ], self._logger, 'Starting ovsdb-server...')
def _start_ovsdb(self): """Start ``ovsdb-server`` instance. :returns: None """ tasks.run_task([ 'sudo', _OVSDB_TOOL_BIN, 'create', os.path.join(_OVS_ETC_DIR, 'conf.db'), os.path.join(settings.getValue('OVS_DIR'), 'vswitchd', 'vswitch.ovsschema') ], self._logger, 'Creating ovsdb configuration database...') tasks.run_background_task([ 'sudo', _OVSDB_SERVER_BIN, '--remote=punix:%s' % os.path.join(_OVS_VAR_DIR, 'db.sock'), '--remote=db:Open_vSwitch,Open_vSwitch,manager_options', '--pidfile=' + self._ovsdb_pidfile_path, '--overwrite-pidfile' ], self._logger, 'Starting ovsdb-server...')
def Exec_Shell_Background(command): """ Execute a shell `command' at the background and return its PID id """ try: pid = run_background_task(command.split(), _LOGGER, "Background task: {}".format(command)) return pid except OSError: return None
def start(self): # Command-1: Start Collectd self.collectd_pid = tasks.run_background_task( ['sudo', self.collectd_cmd], self.logger, 'Staring Collectd') # Command-2: Start PROX working_dir = os.getcwd() if os.path.exists(self.prox_home): os.chdir(self.prox_home) self.prox_pid = tasks.run_background_task( ['sudo', self.prox_cmd, '--test', 'irq', '--env', 'irq'], self.logger, 'Start PROX') os.chdir(working_dir) # Command-3: Start CROND tasks.run_task(['sudo', 'systemctl', 'start', 'crond'], self.logger, 'Staring CROND', True) # command-4: BEATS tasks.run_task(['sudo', 'systemctl', 'start', 'filebeat'], self.logger, 'Starting BEATS', True)
def __init__(self, results_dir, test_name): """ Initialize collection of statistics """ self.logger = logging.getLogger(__name__) self.resultsdir = results_dir self.testname = test_name self.results = {} self.sample_dict = multiprocessing.Manager().dict() self.control = multiprocessing.Value('b', False) self.receiver = Receiver(self.sample_dict, self.control) self.cleanup_metrics() # Assumption: collected is installed at /opt/collectd # And collected is configured to write to csv at /tmp/csv self.pid = tasks.run_background_task( ['sudo', '/opt/collectd/sbin/collectd'], self.logger, 'Staring Collectd')