Port is removed in instance delete and causes instance start failure with HARestarter

Asked by Samuli Silvius

Using grizzly version from heta/opensatck.

Ports on template also removed when instance is deleted, is that normal? I have HARestarter policy and few alarms for instances in the template and when I issue heat-wacth command from command line:

    heat-watch set-state teststack.Test_Instance_1_killed ALARM

Related instance is deleted ok, but it will also delete Port from with instance is dependent on. That will cause Instance start to fail as Port is not found.

See below my template and heat-engine.log and nova-api.log.

Template:
{
   "AWSTemplateFormatVersion" : "2010-09-09",

   "Description" : "Test template.",

   "Parameters" : {

     "KeyName" : {
       "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
       "Type" : "String"
     },

     "InstanceType" : {
       "Description" : "test instance type",
       "Type" : "String",
       "Default" : "m1.small",
       "AllowedValues" : [ "m1.small" ],
       "ConstraintDescription" : "must be a valid EC2 instance type."
     },

     "DemoDistribution": {
       "Default": "DemoV1",
       "Description" : "Demo distribution of choice",
       "Type": "String",
       "AllowedValues" : [ "DemoV1" ]
     }
   },

   "Mappings" : {
     "AWSInstanceType2Arch" : {
       "m1.small" : { "Arch" : "64" }
     },
     "DistroArch2AMI": {
       "DemoV1" : { "64" : "ubuntu1304-v5-amd64" }
     }
   },

   "Resources" : {

    "private-network": {
      "Type": "OS::Quantum::Net"
    },

    "public-network": {
      "Type": "OS::Quantum::Net",
      "Properties": {
 "value_specs": {"router:external" : true}
      }
    },

   "private-subnet": {
      "Type": "OS::Quantum::Subnet",
      "DependsOn" : "private-network",
      "Properties": {
        "network_id": { "Ref" : "private-network" },
        "ip_version": 4,
        "cidr": "10.0.0.0/24",
 "gateway_ip": "10.0.0.1",
 "allocation_pools": [{"start": "10.0.0.2", "end": "10.0.0.20"}]
      }
    },

   "public-subnet": {
      "Type": "OS::Quantum::Subnet",
      "DependsOn" : "public-network",
      "Properties": {
        "network_id": { "Ref" : "public-network" },
        "ip_version": 4,
        "cidr": "192.168.0.0/24",
 "gateway_ip": "192.168.0.1",
 "allocation_pools": [{"start": "192.168.0.2", "end": "192.168.0.20"}]
      }
    },

    "private-port": {
      "Type": "OS::Quantum::Port",
      "DependsOn" : "private-subnet",
      "Properties": {
        "network_id": { "Ref" : "private-network" }
      }
    },

    "private-port2": {
      "Type": "OS::Quantum::Port",
      "DependsOn" : "private-subnet",
      "Properties": {
        "network_id": { "Ref" : "private-network" }
      }
    },

    "router": {
 "Type": "OS::Quantum::Router",
        "DependsOn" : "public-subnet"
    },

     "router_interface": {
       "Type": "OS::Quantum::RouterInterface",
       "DependsOn" : "router",
       "Properties": {
         "router_id": { "Ref" : "router" },
         "subnet_id": { "Ref" : "private-subnet" }
       }
     },

    "router_gateway_external": {
      "Type": "OS::Quantum::RouterGateway",
      "DependsOn" : "router_interface",
      "Properties": {
        "router_id": { "Ref" : "router" },
        "network_id": { "Ref" : "public-network" }
      }
    },

     "testInst1": {
       "Type": "AWS::EC2::Instance",
       "Metadata" : {
         "AWS::CloudFormation::Init" : {
         }
       },
       "Properties": {

         "ImageId" : { "Fn::FindInMap" : [ "DistroArch2AMI", { "Ref" : "DemoDistribution" },
                           { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] },
         "InstanceType" : { "Ref" : "InstanceType" },
         "KeyName" : { "Ref" : "KeyName" },
  "NetworkInterfaces" : [ { "Ref" : "private-port" } ]
       }
     },

    "testInst2": {
       "Type": "AWS::EC2::Instance",
       "Metadata" : {
         "AWS::CloudFormation::Init" : {
         }
       },
       "Properties": {

         "ImageId" : { "Fn::FindInMap" : [ "DistroArch2AMI", { "Ref" : "DemoDistribution" },
                           { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] },
         "InstanceType" : { "Ref" : "InstanceType" },
         "KeyName" : { "Ref" : "KeyName" },
  "NetworkInterfaces" : [ { "Ref" : "private-port2" } ]
       }
     },

    "Test_Instance_1_RestartPolicy" : {
      "Type" : "OS::Heat::HARestarter",
      "Properties" : {
        "InstanceId" : { "Ref" : "testInst1" }
      }
    },
    "Test_Instance_2_RestartPolicy" : {
      "Type" : "OS::Heat::HARestarter",
      "Properties" : {
        "InstanceId" : { "Ref" : "testInst2" }
      }
    },

    "AllFailureAlarm": {
     "Type": "AWS::CloudWatch::Alarm",
     "Properties": {
        "AlarmDescription": "Restart all instances",
        "MetricName": "VmInstanceFailure",
        "Namespace": "CGC/Vm",
        "Statistic": "SampleCount",
        "Period": "300",
        "EvaluationPeriods": "1",
        "Threshold": "2",
        "ComparisonOperator": "GreaterThanThreshold",
        "AlarmActions": [ { "Ref": "Test_Instance_1_RestartPolicy" }, { "Ref": "Test_Instance_2_RestartPolicy" } ]
      }
    },

    "Test_Instance_1_killed": {
     "Type": "AWS::CloudWatch::Alarm",
     "Properties": {
        "AlarmDescription": "Restart the specific instance",
        "MetricName": "VmInstanceFailure",
        "Namespace": "CGC/Vm",
        "Statistic": "SampleCount",
        "Period": "300",
        "EvaluationPeriods": "1",
        "Threshold": "2",
        "ComparisonOperator": "GreaterThanThreshold",
        "AlarmActions": [ { "Ref": "Test_Instance_1_RestartPolicy" } ]
      }
    },

    "Test_Instance_2_killed": {
     "Type": "AWS::CloudWatch::Alarm",
     "Properties": {
        "AlarmDescription": "Restart the specific instance",
        "MetricName": "VmInstanceFailure",
        "Namespace": "CGC/Vm",
        "Statistic": "SampleCount",
        "Period": "300",
        "EvaluationPeriods": "1",
        "Threshold": "2",
        "ComparisonOperator": "GreaterThanThreshold",
        "AlarmActions": [ { "Ref": "Test_Instance_2_RestartPolicy" } ]
      }
    }
  }
}

heat-engine.log:
2013-07-01 19:57:14.279 12829 INFO heat.engine.watchrule [-] WATCH: stack:0d2f4fe7-c4f8-4c31-91d8-c92b0c83cba3, watch_name:teststack.Test_Instance_1_killed ALARM
2013-07-01 19:57:14.360 12829 DEBUG heat.engine.watchrule [-] Overriding state NODATA for watch teststack.Test_Instance_1_killed with ALARM set_watch_state /usr/local/lib/python2.7/dist-packages/heat-2013.1.1.a8.g4b48b0e-py2.7.egg/heat/engine/watchrule.py:280
2013-07-01 19:57:14.365 12829 INFO heat.engine.resources.instance [-] Test_Instance_1_RestartPolicy Alarm, restarting resource: testInst1
2013-07-01 19:57:14.365 12829 INFO heat.engine.resource [-] deleting CloudWatchAlarm "AllFailureAlarm" (inst:None db_id:624)
2013-07-01 19:57:14.701 12829 INFO heat.engine.resource [-] deleting CloudWatchAlarm "Test_Instance_1_killed" (inst:None db_id:625)
2013-07-01 19:57:15.035 12829 INFO heat.engine.resource [-] deleting Restarter "Test_Instance_1_RestartPolicy" (inst:None db_id:623)
2013-07-01 19:57:15.370 12829 INFO heat.engine.resource [-] deleting Instance "testInst1" (inst:97aa0b4e-0200-4254-8e8e-bb74e0980d2c db_id:620)
2013-07-01 19:57:17.515 12829 DEBUG heat.engine.service [-] Periodic watcher task for stack 0d2f4fe7-c4f8-4c31-91d8-c92b0c83cba3 _periodic_watcher_task /usr/local/lib/python2.7/dist-packages/heat-2013.1.1.a8.g4b48b0e-py2.7.egg/heat/engine/service.py:515
2013-07-01 19:57:20.002 12829 INFO heat.engine.resource [-] creating Instance "testInst1"
2013-07-01 19:57:20.484 12829 ERROR heat.engine.resource [-] create Instance "testInst1"
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource Traceback (most recent call last):
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/heat-2013.1.1.a8.g4b48b0e-py2.7.egg/heat/engine/resource.py", line 320, in create
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource self.handle_create()
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/heat-2013.1.1.a8.g4b48b0e-py2.7.egg/heat/engine/resources/instance.py", line 307, in handle_create
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource availability_zone=availability_zone)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/novaclient/v1_1/servers.py", line 600, in create
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource **boot_kwargs)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/novaclient/v1_1/base.py", line 163, in _boot
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource return_raw=return_raw, **kwargs)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/novaclient/base.py", line 145, in _create
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource _resp, body = self.api.client.post(url, body=body)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 233, in post
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource return self._cs_request(url, 'POST', **kwargs)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 217, in _cs_request
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource **kwargs)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 199, in _time_request
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource resp, body = self.request(url, method, **kwargs)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 193, in request
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource raise exceptions.from_response(resp, body, url, method)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource ClientException: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-624845c9-9d73-4800-8694-80a524065d2c)
2013-07-01 19:57:20.484 12829 TRACE heat.engine.resource
2013-07-01 19:57:20.646 12829 INFO heat.engine.resource [-] creating Restarter "Test_Instance_1_RestartPolicy"
2013-07-01 19:57:20.896 12829 INFO heat.engine.resource [-] creating CloudWatchAlarm "AllFailureAlarm"
2013-07-01 19:57:21.189 12829 INFO heat.engine.resource [-] creating CloudWatchAlarm "Test_Instance_1_killed"
2013-07-01 19:58:17.544 12829 DEBUG heat.engine.service [-] Periodic watcher task for stack 0d2f4fe7-c4f8-4c31-91d8-c92b0c83cba3 _periodic_watcher_task /usr/local/lib/python2.7/dist-packages/heat-2013.1.1.a8.g4b48b0e-py2.7.egg/heat/engine/service.py:515

nova-api.log:
2013-07-01 19:57:20.479 ERROR nova.api.openstack [req-624845c9-9d73-4800-8694-80a524065d2c 1319010bf51a454a83cb1f3eb0470a4b 31f6875a21b2408c9140e729e56334a1] Caught error: Port e4d7099c-bf9b-4611-8b0a-89f84cda4bbe could not be found on n
etwork None
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack Traceback (most recent call last):
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/__init__.py", line 81, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return req.get_response(self.application)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack application, catch_exc_info=False)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/keystoneclient/middleware/auth_token.py", line 450, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return self.app(env, start_response)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/Routes-1.12.3-py2.7.egg/routes/middleware.py", line 131, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack response = self.app(environ, start_response)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 890, in __call__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack content_type, body, accept)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 942, in _process_stack
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 1022, in dispatch
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return method(req=request, **action_args)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/servers.py", line 898, in create
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack scheduler_hints=scheduler_hints)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/hooks.py", line 85, in inner
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack rv = f(*args, **kwargs)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 962, in create
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack scheduler_hints=scheduler_hints)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 676, in _create_instance
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack reservation_id, scheduler_hints)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 634, in _validate_and_provision_instance
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack QUOTAS.rollback(context, quota_reservations)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack self.gen.next()
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 522, in _validate_and_provision_instance
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack self._check_requested_networks(context, requested_networks)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/compute/api.py", line 358, in _check_requested_networks
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack self.network_api.validate_networks(context, requested_networks)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/network/quantumv2/api.py", line 447, in validate_networks
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack port = quantumv2.get_client(context).show_port(port_id).get('port')
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 107, in with_params
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack ret = self.function(instance, *args, **kwargs)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 262, in show_port
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack return self.get(self.port_path % (port), params=_params)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 982, in get
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack headers=headers, params=params)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 967, in retry_request
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack headers=headers, params=params)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 912, in do_request
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack self._handle_fault_response(status_code, replybody)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 893, in _handle_fault_response
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack exception_handler_v20(status_code, des_error_body)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 80, in exception_handler_v20
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack message=error_dict)
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack QuantumClientException: Port e4d7099c-bf9b-4611-8b0a-89f84cda4bbe could not be found on network None
2013-07-01 19:57:20.479 7044 TRACE nova.api.openstack
2013-07-01 19:57:20.482 INFO nova.api.openstack [req-624845c9-9d73-4800-8694-80a524065d2c 1319010bf51a454a83cb1f3eb0470a4b 31f6875a21b2408c9140e729e56334a1] http://192.168.40.1:8774/v2/31f6875a21b2408c9140e729e56334a1/servers returned with HTTP 500

Question information

Language:
English Edit question
Status:
Answered
For:
OpenStack Heat Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Steven Hardy (shardy) said :
#1

This looks like it's probably a bug, raised 1196479

Can you help with this problem?

Provide an answer of your own, or ask Samuli Silvius for more information if necessary.

To post a message you must log in.