[Rdo-list] [heat] assign securitu group to an autoscaling group

Fox, Kevin M Kevin.Fox at pnnl.gov
Mon Jul 27 13:16:30 UTC 2015


I dont think you can share one port across multiple servers.

Usually its easiest to make the group a nested stack and pass things like security groups to it.

Thanks,
Kevin

________________________________
From: rdo-list-bounces at redhat.com on behalf of ICHIBA Sara
Sent: Monday, July 27, 2015 5:14:16 AM
To: rdo-list at redhat.com
Subject: [Rdo-list] [heat] assign securitu group to an autoscaling group

Hey there. When trying to assign a security group to an autoscaling groups i get some errors. I would really appreciate if you can help me.
please find below the part of the template which describes the security groups and its usage + the associated logs.


=======cassandra_scaling_up_down2.yaml
resources:
  security_groups:
    type: OS::Neutron::SecurityGroup
    properties:
      name: security_groups
      rules:
        - protocol: tcp
          port_range_min: 8888
          port_range_max: 8888
        - protocol: tcp
          port_range_min: 7000
          port_range_max: 7000
        - protocol: tcp
          port_range_min: 7001
          port_range_max: 7001
        - protocol: icmp
        - protocol: tcp
          port_range_min: 22
          port_range_max: 22
        - protocol: tcp
          port_range_min: 7199
          port_range_max: 7199
        - protocol: tcp
          port_range_min: 9042
          port_range_max: 9042
        - protocol: tcp
          port_range_min: 9160
          port_range_max: 9160
  db_port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_param: network }
      fixed_ips:
        - subnet_id: { get_param: subnet_id }
      security_groups:
        - {get_resource: security_groups}

  group:
    type: OS::Heat::AutoScalingGroup
    properties:
      cooldown: 60
      desired_capacity: 1
      max_size: 5
      min_size: 1
      resource:
        type: OS::Nova::Server::Cassandra
        properties:
          flavor: {get_param: flavor}
          image: {get_param: image}
          key_name: {get_param: key_name}
          networks:
            - port: {get_resource: db_port}





===========environment.cassandra.yaml
resource_registry:
    "OS::Nova::Server::Cassandra": "cassandra_envir.yaml"


==========cassandra_envir.yaml
resources:
  server:
    type: OS::Nova::Server
    properties:
      image: {get_param: image}
      flavor: {get_param: flavor}
      key_name: {get_param: key_name}
      networks:
        - port: { get_param: db_port }
      metadata: {get_param: metadata}
      user_data: {get_param: user_data}
      user_data_format: RAW


========/var/log/heat/heat-
engine.log
2015-07-27 13:59:08.423 4665 INFO heat.engine.environment [req-ca831d72-de65-459e-b330-8d89646f522a None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:08.449 4665 INFO heat.engine.environment [req-f6dfcf2b-1936-4be1-b93f-c5cd151207e5 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:10.678 4665 INFO heat.engine.service [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Creating stack cassandra_up_down_lb2
2015-07-27 13:59:10.695 4665 INFO heat.engine.environment [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:10.710 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating HealthMonitor "monitor"
2015-07-27 13:59:10.711 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating SecurityGroup "security_groups"
2015-07-27 13:59:10.714 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating Port "lb_vip_port"
2015-07-27 13:59:10.715 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating FloatingIP "lb_vip_floating_ip"
2015-07-27 13:59:10.715 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating Port "db_port"
2015-07-27 13:59:10.716 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating Pool "pool"
2015-07-27 13:59:10.717 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating LoadBalancer "lb"
2015-07-27 13:59:10.718 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating AutoScalingResourceGroup "group"
2015-07-27 13:59:10.719 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating AutoScalingPolicy "scaledown_policy"
2015-07-27 13:59:10.719 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating AutoScalingPolicy "scaleup_policy"
2015-07-27 13:59:10.720 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating CeilometerAlarm "cpu_alarm_high"
2015-07-27 13:59:10.721 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating CeilometerAlarm "cpu_alarm_low"
2015-07-27 13:59:10.722 4665 INFO heat.engine.resource [req-d240c68d-3be5-4254-b6bf-fc9dbca09bb6 None] Validating FloatingIPAssociation "lb_pool_vip"
2015-07-27 13:59:10.909 4665 INFO heat.engine.environment [req-7417820d-085c-4e8f-b135-3ce1242b2c94 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:10.913 4665 INFO heat.engine.environment [req-7417820d-085c-4e8f-b135-3ce1242b2c94 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra2.yaml
2015-07-27 13:59:10.916 4665 INFO heat.engine.environment [req-7417820d-085c-4e8f-b135-3ce1242b2c94 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/single_instance.yaml
2015-07-27 13:59:11.014 4665 INFO heat.engine.stack [-] Stack CREATE IN_PROGRESS (cassandra_up_down_lb2): Stack CREATE started
2015-07-27 13:59:11.015 4665 INFO heat.engine.resource [-] creating HealthMonitor "monitor" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:11.129 4665 INFO heat.engine.resource [-] creating SecurityGroup "security_groups" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:11.645 4665 INFO heat.engine.resource [-] creating Port "lb_vip_port" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:12.831 4665 INFO heat.engine.environment [req-fcb6678c-bd7f-4edc-b257-234f1dd3d7b1 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:12.835 4665 INFO heat.engine.environment [req-fcb6678c-bd7f-4edc-b257-234f1dd3d7b1 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra2.yaml
2015-07-27 13:59:12.838 4665 INFO heat.engine.environment [req-fcb6678c-bd7f-4edc-b257-234f1dd3d7b1 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/single_instance.yaml
2015-07-27 13:59:13.024 4665 INFO heat.engine.resource [-] creating FloatingIP "lb_vip_floating_ip" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:13.225 4665 INFO heat.engine.resource [-] creating Port "db_port" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:13.480 4665 INFO heat.engine.resource [-] creating Pool "pool" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:13.619 4665 INFO heat.engine.environment [req-263836d3-bdd3-4bc8-a990-af7dca34fbea None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:13.646 4665 INFO heat.engine.environment [req-d6dd8afd-e6a5-4224-8fea-993bdbc14609 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:16.243 4665 INFO heat.engine.environment [req-43937ec1-9155-4c67-b511-0426efa89d2a None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:16.269 4665 INFO heat.engine.environment [req-e2fc1337-86a7-4b45-b6c1-f6a2f8265462 None] Registering OS::Nova::Server::Cassandra -> file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:18.318 4665 INFO heat.engine.resource [-] creating LoadBalancer "lb" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:18.331 4665 INFO heat.engine.resource [-] creating AutoScalingResourceGroup "group" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:18.345 4665 INFO heat.engine.environment [-] Registering OS::Heat::ScaledResource -> AWS::EC2::Instance
2015-07-27 13:59:18.347 4665 INFO heat.common.urlfetch [-] Fetching data from file:///etc/heat/templates/cassandra_envir.yaml
2015-07-27 13:59:18.351 4665 INFO heat.engine.resource [-] Validating OS::Nova::Server::Cassandra "fespxephgvg2"
2015-07-27 13:59:18.352 4665 INFO heat.engine.stack [-] Property error : fespxephgvg2: Property db_port not assigned
2015-07-27 13:59:18.352 4665 INFO heat.engine.resource [-] CREATE: AutoScalingResourceGroup "group" Stack "cassandra_up_down_lb2" [fe2a4224-a82d-4da1-8b97-a0bf02a9bffd]
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource Traceback (most recent call last):
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 439, in _action_recorder
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource     yield
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 509, in _do_action
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource     yield self.action_handler_task(action, args=handler_args)
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/heat/engine/scheduler.py", line 286, in wrapper
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource     step = next(subtask)
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/heat/engine/resource.py", line 480, in action_handler_task
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource     handler_data = handler(*args)
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/heat/engine/resources/autoscaling.py", line 573, in handle_create
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource     self._environment())
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/heat/engine/stack_resource.py", line 203, in create_with_template
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource     adopt_data)
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/heat/engine/stack_resource.py", line 165, in _parse_nested_stack
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource     nested.validate()
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/heat/engine/stack.py", line 461, in validate
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource     raise ex
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource StackValidationFailed: Property error : fespxephgvg2: Property db_port not assigned
2015-07-27 13:59:18.352 4665 TRACE heat.engine.resource
2015-07-27 13:59:19.389 4665 INFO heat.engine.stack [-] Stack CREATE FAILED (cassandra_up_down_lb2): Resource CREATE failed: StackValidationFailed: Property error : fespxephgvg2: Property db_port not assigned
2015-07-27 13:59:19.389 4665 INFO heat.engine.service [-] Stack create failed, status FAILED

b.regards,
Sara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rdoproject.org/pipermail/dev/attachments/20150727/a24bdec0/attachment.html>


More information about the dev mailing list