Commit 8fb6ef3e authored by David Johnson's avatar David Johnson

Add ability to pass an args list to wfagents, from capnet-wfagent-create.

parent 85a0edab
Pipeline #1356 skipped
......@@ -47,6 +47,7 @@ CREATE TABLE capnet_workflow_agents (
port_id VARCHAR(36),
master BOOLEAN NOT NULL default FALSE,
wfapp_path VARCHAR(255),
wfapp_args TEXT,
wfapp_env enum('netns'),
status VARCHAR(16) NOT NULL,
UNIQUE KEY (`id`,`port_id`),
......
......@@ -93,6 +93,7 @@ class CapnetWorkflowAgent(model_base.BASEV2):
sa.ForeignKey('ports.id',ondelete='CASCADE'))
master = sa.Column(sa.Boolean(),default=False,nullable=False)
wfapp_path = sa.Column(sa.String(255))
wfapp_args = sa.Column(sa.Text(65536))
wfapp_env = sa.Column(sa.Enum('netns'))
status = sa.Column(sa.String(16),nullable=False,default='initializing')
......
......@@ -18,7 +18,7 @@ class CapnetPolicyExt(extension.NeutronClientExtension):
class CapnetPolicyList(extension.ClientExtensionList,CapnetPolicyExt):
shell_command = 'capnet-policy-list'
list_columns = ['id','network_id','subnet_id','tenant_id',
'wfapp_policy','wfapp_path','wfapp_env']
'wfapp_policy','wfapp_path','wfapp_args','wfapp_env']
pagination_support = True
sorting_support = True
......@@ -54,7 +54,7 @@ class CapnetPolicyList(extension.ClientExtensionList,CapnetPolicyExt):
class CapnetPolicyCreate(extension.ClientExtensionCreate,CapnetPolicyExt):
shell_command = 'capnet-policy-create'
list_columns = ['id','network_id','subnet_id','tenant_id',
'wfapp_policy','wfapp_path','wfapp_env']
'wfapp_policy','wfapp_path','wfapp_args','wfapp_env']
def add_known_arguments(self, parser):
parser.add_argument(
......@@ -66,6 +66,9 @@ class CapnetPolicyCreate(extension.ClientExtensionCreate,CapnetPolicyExt):
parser.add_argument(
'--wfapp-path',dest='wfapp_path',
help=_('Specify the primary workflow app.'))
parser.add_argument(
'--wfapp-args',dest='wfapp_args',
help=_('Specify arguments to the primary workflow app.'))
parser.add_argument(
'--wfapp-env',dest='wfapp_env',
help=_('Specify the workflow app\'s environment (\'netns\' is currently the only option).'))
......@@ -90,6 +93,8 @@ class CapnetPolicyCreate(extension.ClientExtensionCreate,CapnetPolicyExt):
body['wfapp_policy'] = parsed_args.wfapp_policy
if parsed_args.wfapp_path:
body['wfapp_path'] = parsed_args.wfapp_path
if parsed_args.wfapp_args:
body['wfapp_args'] = parsed_args.wfapp_args
if parsed_args.wfapp_env:
body['wfapp_env'] = parsed_args.wfapp_env
......@@ -126,7 +131,7 @@ class CapnetWorkflowAgentList(extension.ClientExtensionList,
CapnetWorkflowAgentExt):
shell_command = 'capnet-wfagent-list'
list_columns = ['id','name','network_id','subnet_id','tenant_id','port_id',
'master','wfapp_path','wfapp_env','status']
'master','wfapp_path','wfapp_args','wfapp_env','status']
pagination_support = True
sorting_support = True
allow_names = True
......@@ -171,7 +176,7 @@ class CapnetWorkflowAgentCreate(extension.ClientExtensionCreate,
CapnetWorkflowAgentExt):
shell_command = 'capnet-wfagent-create'
list_columns = ['id','network_id','subnet_id','tenant_id','port_id',
'master','wfapp_path','wfapp_env','status']
'master','wfapp_path','wfapp_args','wfapp_env','status']
def add_known_arguments(self, parser):
parser.add_argument(
......@@ -189,6 +194,9 @@ class CapnetWorkflowAgentCreate(extension.ClientExtensionCreate,
parser.add_argument(
'--wfapp-path',dest='wfapp_path',
help=_('Specify the primary workflow app.'))
parser.add_argument(
'--wfapp-args',dest='wfapp_args',
help=_('Specify arguments to the primary workflow app.'))
parser.add_argument(
'--wfapp-env',dest='wfapp_env',
help=_('Specify the workflow app\'s environment (\'netns\' is currently the only option).'))
......@@ -225,6 +233,8 @@ class CapnetWorkflowAgentCreate(extension.ClientExtensionCreate,
body['master'] = parsed_args.master
if parsed_args.wfapp_path:
body['wfapp_path'] = parsed_args.wfapp_path
if parsed_args.wfapp_args:
body['wfapp_args'] = parsed_args.wfapp_args
if parsed_args.wfapp_env:
body['wfapp_env'] = parsed_args.wfapp_env
......
......@@ -135,7 +135,7 @@ class ExtOVSBridge(ovs_lib.OVSBridge):
class CapnetSegment(object):
def __init__(self, network_type, physical_network, segmentation_id,
arp_responder=None,auto_dhcp_flows=None,auto_metadata_flows=None,
wfapp_path=None,wfapp_env=None):
wfapp_path=None,wfapp_args=None,wfapp_env=None):
self.network_type = network_type
self.physical_network = physical_network
self.segmentation_id = segmentation_id
......@@ -161,6 +161,7 @@ class CapnetSegment(object):
self.wfapp_path = wfapp_path
else:
self.wfapp_path = cfg.CONF.CAPNET.default_wfapp_path
self.wfapp_args = wfapp_args
if wfapp_env is not None:
self.wfapp_env = wfapp_env
else:
......@@ -1125,6 +1126,9 @@ class CapnetWorkflowAgentManager(object):
cmd = [ 'ip','netns','exec',str(wfagent.namespace),
self.wfapp_launcher,pidfile,logfile,interface_name,
wfagent.wfapp_path ]
if 'wfapp_args' in wfagent and len(wfagent.wfapp_args) > 0:
cmd.extend(wfagent.wfapp_args.split(' '))
pass
agent_utils.execute(cmd,run_as_root=True)
# Call wfagent_update(wfagent) to update wfagent status, and
......
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