Commit 04033e0a authored by David Johnson's avatar David Johnson

Have the wfagent launcher pass a PYTHONPATH with Capnet Proto module path.

(And configure it in the cloudlab setup scripts relative to where we're
installing the capnet controller and the protocol bindings.)
parent 6a1946ea
Pipeline #1144 skipped
......@@ -52,6 +52,9 @@ crudini --set /etc/neutron/plugins/ml2/ml2_conf_capnet.ini DEFAULT interface_dri
crudini --set /etc/neutron/neutron.conf DEFAULT api_extensions_path \
/usr/lib/python2.7/dist-packages/networking_capnet/extensions
crudini --set /etc/neutron/plugins/ml2/ml2_conf_capnet.ini capnet pythonpath \
/opt/tcloud/capnet/lib/python2.7/site-packages
##
## Setup our physical Capnet connections
##
......
......@@ -57,6 +57,9 @@ else
ml2 extension_drivers "capnet"
fi
crudini --set /etc/neutron/plugins/ml2/ml2_conf_capnet.ini capnet pythonpath \
/opt/tcloud/capnet/lib/python2.7/site-packages
crudini --set /etc/neutron/neutron.conf DEFAULT verbose True
crudini --set /etc/neutron/neutron.conf DEFAULT debug True
......
......@@ -60,6 +60,9 @@ crudini --set /etc/neutron/l3_agent.ini DEFAULT interface_driver \
crudini --set /etc/neutron/metering_agent.ini DEFAULT interface_driver \
networking_capnet.agent.linux.interface.CapnetOVSInterfaceDriver
crudini --set /etc/neutron/plugins/ml2/ml2_conf_capnet.ini capnet pythonpath \
/opt/tcloud/capnet/lib/python2.7/site-packages
##
## Setup our physical Capnet connections
##
......
......@@ -57,6 +57,11 @@
# (StrOpt) Specify whether the WA is in a 'netns' or on a 'node'.
#default_wfapp_env = netns
# (ListOpt) Specify the path where the Capnet controller client python
# bindings are installed (and any other paths you need, as a
# comma-separated list).
#pythonpath =
# (StrOpt) Specify the filter name of the path to the MUL core binary.
# This is a rootwrap-based command, so you add a new command by adding
# a new filter in /etc/neutron/rootwrap.d/capnet.filters. In that
......
......@@ -76,6 +76,10 @@ capnet_opts = [
cfg.StrOpt('default_wfapp_env',default='netns',
help="Specify whether the WA is in a 'netns' or on a 'node'."),
cfg.ListOpt('pythonpath',
default="/opt/tcloud/capnet/lib/python2.7/site-packages",
help="Specify the path where the Capnet controller client python bindings are installed (and any other paths you need, as a comma-separated list)"),
cfg.StrOpt('mul_core_path',default="mul",
help="Specify the filter name of the path to the MUL core binary. This is a rootwrap-based command, so you add a new command by adding a new filter in /etc/neutron/rootwrap.d/capnet.filters. In that file, you'll see a 'mul' filter; add another one just like it, but that points to the binary you want to execute instead. Give it a custom name that's not already in the file, and set this value to that name. BUT -- NB -- if you specify a full path, rootwrap will not be used to run this command, and your binary will run with regular neutron privileges! That is probably not what you want."),
cfg.StrOpt('mul_core_args',default="-d -l 0 -n",
......
......@@ -2,6 +2,24 @@
import sys
import os
import socket
import traceback
##
## Ok, we want the user to be able to specify where the Capnet Protocol
## bindings are installed, so we can set an appropriate PYTHONPATH
## before launching their agent. We put this into the Neutron config
## files... so we have to load them up. I don't understand oslo_config,
## so I'm just doing what neutron-server does... ugh!
##
from oslo_config import cfg
from neutron.common import config
config_file_args = [ '--config-file','/etc/neutron/plugins/ml2/ml2_conf.ini',
'--config-file','/etc/neutron/neutron.conf',
'--config-file','/etc/neutron/plugins/ml2/ml2_conf_capnet.ini' ]
config.init(config_file_args)
cfg.CONF.import_group('CAPNET','networking_capnet.common.config')
##
## A simple script that execs its args. Eventually, this script will
......@@ -22,12 +40,28 @@ def main():
os.dup2(lf.fileno(),1)
os.dup2(lf.fileno(),2)
extrapaths = []
newenviron = dict(os.environ)
try:
for path in cfg.CONF.CAPNET.pythonpath:
extrapaths.append(path)
if len(extrapaths) > 0:
newenviron['PYTHONPATH'] = ':'.join(extrapaths)
pass
except:
traceback.print_exc()
pass
pid = os.fork()
if pid == 0:
pf.write("%d" % (os.getpid(),))
pf.close()
print "DEBUG: running %s" % (str(args),)
os.execl(sys.argv[4],*args)
if len(extrapaths) > 0:
print "DEBUG: running %s (with PYTHONPATH=%s)" % (str(args),newenviron['PYTHONPATH'])
else:
print "DEBUG: running %s" % (str(args))
pass
os.execve(sys.argv[4],args,newenviron)
return -1
else:
return 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment