Ask Your Question
0

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

asked 2013-07-01 09:31:13 -0500

samuli-silvius gravatar image

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 ... (more)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-07-01 09:56:02 -0500

shardy gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-07-01 09:31:13 -0500

Seen: 139 times

Last updated: Jul 01 '13