cloudify-cosmo / cloudify-openstack-plugin

Cloudify OpenStack Plugin
20 stars 66 forks source link

Port statement does not allow port ranges. #36

Closed ryancurrah closed 9 years ago

ryancurrah commented 9 years ago

I declared a port range in my blueprint...

node_templates:
  # SECURITY
  node_security_group:
    type: cloudify.openstack.nodes.SecurityGroup
    properties:
      security_group:
        name: websphere_security_group
      rules:
        - remote_ip_prefix: 0.0.0.0/0
          port: 19000 19999

but the 'neutron_plugin.security_group.create' task failed with a 'Invalid value for port 19000 19999'... is there a specific way to set the port range for this plugin?

I know in openstack's nova client it is possible to declare a range. http://docs.openstack.org/openstack-ops/content/security_groups.html

$ nova secgroup-add-rule <secgroup> <ip-proto> <from-port> <to-port> <cidr>
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range  | Source Group |
+-------------+-----------+---------+-----------+--------------+
| tcp         | 80        | 80      | 0.0.0.0/0 |              |
+-------------+-----------+---------+-----------+--------------+

cfy command execution and error output...

(env)[root@ryansaltdev blueprints]# cfy executions start -w deploy -d websphere_test_deploy -l
Executing workflow 'deploy' on deployment 'websphere_test_deploy' at management server 10.155.255.181 [timeout=900 seconds]
2014-12-04T09:18:22 CFY <websphere_test_deploy> Starting 'deploy' workflow execution
2014-12-04T09:18:23 CFY <websphere_test_deploy> [node_security_group_5b414] Creating node
2014-12-04T09:18:23 CFY <websphere_test_deploy> [floatingip_22f57] Creating node
2014-12-04T09:18:23 CFY <websphere_test_deploy> [node_security_group_5b414.create] Sending task 'neutron_plugin.security_group.create'
2014-12-04T09:18:23 CFY <websphere_test_deploy> [floatingip_22f57.create] Sending task 'neutron_plugin.floatingip.create'
2014-12-04T09:18:23 CFY <websphere_test_deploy> [node_security_group_5b414.create] Task started 'neutron_plugin.security_group.create'
2014-12-04T09:18:23 CFY <websphere_test_deploy> [floatingip_22f57.create] Task started 'neutron_plugin.floatingip.create'
2014-12-04T09:18:23 LOG <websphere_test_deploy> [node_security_group_5b414.create] INFO: deleting security_group
2014-12-04T09:18:23 CFY <websphere_test_deploy> [floatingip_22f57.create] Task succeeded 'neutron_plugin.floatingip.create'
2014-12-04T09:18:23 LOG <websphere_test_deploy> [node_security_group_5b414.create] ERROR: Exception raised on operation [neutron_plugin.security_group.create] invocation
Traceback (most recent call last):
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/cloudify/decorators.py", line 114, in wrapper
    result = func(*args, **kwargs)
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/openstack_plugin_common/__init__.py", line 458, in wrapper
    _re_raise(e, recoverable=False, status_code=e.status_code)
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/openstack_plugin_common/__init__.py", line 455, in wrapper
    return f(*args, **kw)
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutron_plugin/security_group.py", line 118, in create
    {'security_group_rule': sgr})
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 98, in with_params
    ret = self.function(instance, *args, **kwargs)
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 496, in create_security_group_rule
    return self.post(self.security_group_rules_path, body=body)
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 1325, in post
    headers=headers, params=params)
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 1251, in do_request
    self._handle_fault_response(status_code, replybody)
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 1216, in _handle_fault_response
    exception_handler_v20(status_code, des_error_body)
  File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 66, in exception_handler_v20
    status_code=status_code)
NonRecoverableError: Invalid value for port 19000 19999 [status_code=400]
2014-12-04T09:18:23 CFY <websphere_test_deploy> [node_security_group_5b414.create] Task failed 'neutron_plugin.security_group.create' -> NonRecoverableError('Invalid value for port 19000 19999 [status_code=400]',) [attempt 1]
2014-12-04T09:18:23 CFY <websphere_test_deploy> 'deploy' workflow execution failed: RuntimeError: Workflow failed: Task failed 'neutron_plugin.security_group.create' -> NonRecoverableError('Invalid value for port 19000 19999 [status_code=400]',)
Execution of workflow 'deploy' for deployment 'websphere_test_deploy' failed. [error=Traceback (most recent call last):
  File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/cloudify/decorators.py", line 200, in child_wrapper
    ctx, func, args, kwargs)
  File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/cloudify/decorators.py", line 303, in _execute_workflow_function
    result = func(*args, **kwargs)
  File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/td_workflow_plugin/workflows.py", line 464, in install
    InstallationTasksGraphFinisher
  File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/td_workflow_plugin/workflows.py", line 176, in _install_node_instances
    return graph.execute()
  File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/cloudify/workflows/tasks_graph.py", line 120, in execute
    self._handle_terminated_task(task)
  File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/cloudify/workflows/tasks_graph.py", line 188, in _handle_terminated_task
    task.error))
RuntimeError: Workflow failed: Task failed 'neutron_plugin.security_group.create' -> NonRecoverableError('Invalid value for port 19000 19999 [status_code=400]',)
]
ran-z commented 9 years ago

Hi,

The "port" property is merely​ a syntactic sugar, meant to help users who want to define a rule for a specific port.

To define a port range, one should use the standard Openstack parameters - in the case of a Neutron security-group, the relevant ones are "port_range_min" and "port_range_max", while if you're using Nova security groups the parameters are "from_port" and "to_port".

These properties should go in the rule definition, instead of the "port" property which you've used.

It's important to note that the type you're currently using is a Neutron security-group, while the example you gave was using Nova. If you wish to use a Nova security-group, check out the "cloudify.openstack.nova_net.nodes.SecurityGroup" type, instead of the non-nova-net one.

Thanks,

Ran.


From: Ryan Currah notifications@github.com Sent: Thursday, December 04, 2014 4:43 PM To: cloudify-cosmo/cloudify-openstack-plugin Subject: [cloudify-openstack-plugin] Port statement does not allow port ranges. (#36)

I declared a port range in my blueprint...

node_templates:

SECURITY

node_security_group: type: cloudify.openstack.nodes.SecurityGroup properties: security_group: name: websphere_security_group rules:

but the 'neutron_plugin.security_group.create' task failed with a 'Invalid value for port 19000 19999'... is there a specific way to set the port range for this plugin?

I know in openstack's nova client it is possible to declare a range. http://docs.openstack.org/openstack-ops/content/security_groups.html

$ nova secgroup-add-rule

+-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | tcp | 80 | 80 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+

cfy command execution and error output...

(env)[root@ryansaltdev blueprints]# cfy executions start -w deploy -d websphere_test_deploy -l Executing workflow 'deploy' on deployment 'websphere_test_deploy' at management server 10.155.255.181 [timeout=900 seconds] 2014-12-04T09:18:22 CFY Starting 'deploy' workflow execution 2014-12-04T09:18:23 CFY [node_security_group_5b414] Creating node 2014-12-04T09:18:23 CFY [floatingip_22f57] Creating node 2014-12-04T09:18:23 CFY [node_security_group_5b414.create] Sending task 'neutron_plugin.security_group.create' 2014-12-04T09:18:23 CFY [floatingip_22f57.create] Sending task 'neutron_plugin.floatingip.create' 2014-12-04T09:18:23 CFY [node_security_group_5b414.create] Task started 'neutron_plugin.security_group.create' 2014-12-04T09:18:23 CFY [floatingip_22f57.create] Task started 'neutron_plugin.floatingip.create' 2014-12-04T09:18:23 LOG [node_security_group_5b414.create] INFO: deleting security_group 2014-12-04T09:18:23 CFY [floatingip_22f57.create] Task succeeded 'neutron_plugin.floatingip.create' 2014-12-04T09:18:23 LOG [node_security_group_5b414.create] ERROR: Exception raised on operation [neutron_plugin.security_group.create] invocation Traceback (most recent call last): File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/cloudify/decorators.py", line 114, in wrapper result = func(_args, _kwargs) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/openstack_plugin_common/init.py", line 458, in wrapper _re_raise(e, recoverable=False, status_code=e.status_code) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/openstack_plugin_common/init.py", line 455, in wrapper return f(_args, _kw) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutron_plugin/security_group.py", line 118, in create {'security_group_rule': sgr}) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 98, in with_params ret = self.function(instance, _args, _kwargs) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 496, in create_security_group_rule return self.post(self.security_group_rules_path, body=body) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 1325, in post headers=headers, params=params) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 1251, in do_request self._handle_fault_response(status_code, replybody) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 1216, in _handle_fault_response exception_handler_v20(status_code, des_error_body) File "/home/cloudify/cloudify.websphere_test_deploy/env/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 66, in exception_handler_v20 status_code=status_code) NonRecoverableError: Invalid value for port 19000 19999 [status_code=400] 2014-12-04T09:18:23 CFY [node_security_group_5b414.create] Task failed 'neutron_plugin.security_group.create' -> NonRecoverableError('Invalid value for port 19000 19999 [status_code=400]',) [attempt 1] 2014-12-04T09:18:23 CFY 'deploy' workflow execution failed: RuntimeError: Workflow failed: Task failed 'neutron_plugin.security_group.create' -> NonRecoverableError('Invalid value for port 19000 19999 [status_code=400]',) Execution of workflow 'deploy' for deployment 'websphere_test_deploy' failed. [error=Traceback (most recent call last): File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/cloudify/decorators.py", line 200, in child_wrapper ctx, func, args, kwargs) File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/cloudify/decorators.py", line 303, in _execute_workflow_function result = func(_args, _kwargs) File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/td_workflow_plugin/workflows.py", line 464, in install InstallationTasksGraphFinisher File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/td_workflow_plugin/workflows.py", line 176, in _install_node_instances return graph.execute() File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/cloudify/workflows/tasks_graph.py", line 120, in execute self._handle_terminated_task(task) File "/home/cloudify/cloudify.websphere_test_deploy_workflows/env/local/lib/python2.7/site-packages/cloudify/workflows/tasks_graph.py", line 188, in _handle_terminated_task task.error)) RuntimeError: Workflow failed: Task failed 'neutron_plugin.security_group.create' -> NonRecoverableError('Invalid value for port 19000 19999 [status_code=400]',) ]

— Reply to this email directly or view it on GitHubhttps://github.com/cloudify-cosmo/cloudify-openstack-plugin/issues/36.

ran-z commented 9 years ago

In the future, please ask questions on the relevant Cloudify google group, which can be found here:

Users group: https://groups.google.com/forum/#!forum/cloudify-users Developers group: https://groups.google.com/forum/#!forum/cloudify-developers

Thank you.