← Back to team overview

openstack team mailing list archive

heat engine: list index out of range

 

hello world

I've got a template which gives list index out of range occasionally from
heat (grizzly). Any ideas why? sometimes it works ok. Some kind of race
situation? I'm just trying to learn quantum usage here..

2013-06-18 18:52:02.585 27948 ERROR heat.engine.resource [-] create
Instance "inst1"
2013-06-18 18:52:02.585 27948 TRACE heat.engine.resource Traceback (most
recent call last):
2013-06-18 18:52:02.585 27948 TRACE heat.engine.resource   File
"/usr/local/lib/python2.7/dist-packages/heat-2013.1.1.a1.g6ed78c2-py2.7.egg/heat/engine/resource.py",
line 321, in create
2013-06-18 18:52:02.585 27948 TRACE heat.engine.resource     while not
self.check_active():
2013-06-18 18:52:02.585 27948 TRACE heat.engine.resource   File
"/usr/local/lib/python2.7/dist-packages/heat-2013.1.1.a1.g6ed78c2-py2.7.egg/heat/engine/resources/instance.py",
line 325, in check_active
2013-06-18 18:52:02.585 27948 TRACE heat.engine.resource
self._set_ipaddress(server.networks)
2013-06-18 18:52:02.585 27948 TRACE heat.engine.resource   File
"/usr/local/lib/python2.7/dist-packages/heat-2013.1.1.a1.g6ed78c2-py2.7.egg/heat/engine/resources/instance.py",
line 125, in _set_ipaddress
2013-06-18 18:52:02.585 27948 TRACE heat.engine.resource     self.ipaddress
= networks[n][0]
2013-06-18 18:52:02.585 27948 TRACE heat.engine.resource IndexError: list
index out of range


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

   "Description" : "tbd",

   "Parameters" : {

     "KeyName" : {
       "Description" : "Keydescription",
       "Type" : "String"
     },

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

     "MyDistribution": {
       "Default": "MyDistro",
       "Description" : "Distribution of mine",
       "Type": "String",
       "AllowedValues" : [ "MyDistro" ]
     }

   },

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

   "Resources" : {

    "network1": {
      "Type": "OS::Quantum::Net"
    },

    "network2": {
      "Type": "OS::Quantum::Net"
    },

    "mgmt-subnet": {
      "Type": "OS::Quantum::Subnet",
      "Properties": {
        "network_id": { "Ref" : "network1" },
        "ip_version": 4,
        "cidr": "30.0.1.0/24",
"gateway_ip": "30.0.1.1",
"allocation_pools": [{"start": "30.0.1.2", "end": "30.0.1.20"}]
      }
    },

    "traffic-subnet": {
      "Type": "OS::Quantum::Subnet",
      "Properties": {
        "network_id": { "Ref" : "network2" },
        "ip_version": 4,
        "cidr": "40.0.1.0/24",
"gateway_ip": "40.0.1.1",
"allocation_pools": [{"start": "40.0.1.2", "end": "40.0.1.20"}]
      }
    },

    "network1port1": {
      "Type": "OS::Quantum::Port",
      "Properties": {
        "network_id": { "Ref" : "network1" }
      }
    },

    "network1port2": {
      "Type": "OS::Quantum::Port",
      "Properties": {
        "network_id": { "Ref" : "network1" }
      }
    },

    "network2port1": {
      "Type": "OS::Quantum::Port",
      "Properties": {
        "network_id": { "Ref" : "network2" }
      }
    },

    "network2port2": {
      "Type": "OS::Quantum::Port",
      "Properties": {
        "network_id": { "Ref" : "network2" }
      }
    },

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

         "ImageId" : { "Fn::FindInMap" : [ "DistroArch2AMI", { "Ref" :
"MyDistribution" },
                           { "Fn::FindInMap" : [ "AWSInstanceType2Arch", {
"Ref" : "InstanceType" }, "Arch" ] } ] },
         "InstanceType"   : { "Ref" : "InstanceType" },
         "KeyName"        : { "Ref" : "KeyName" },

    "NetworkInterfaces" : [
      { "NetworkInterfaceId" : { "Ref" : "network1port1" }, "DeviceIndex" :
"0" },
      { "NetworkInterfaceId" : { "Ref" : "network2port1" }, "DeviceIndex" :
"1" }
    ]

       }
     },

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

         "ImageId" : { "Fn::FindInMap" : [ "DistroArch2AMI", { "Ref" :
"MyDistribution" },
                           { "Fn::FindInMap" : [ "AWSInstanceType2Arch", {
"Ref" : "InstanceType" }, "Arch" ] } ] },
         "InstanceType"   : { "Ref" : "InstanceType" },
         "KeyName"        : { "Ref" : "KeyName" },
    "NetworkInterfaces" : [
      { "NetworkInterfaceId" : { "Ref" : "network1port2" }, "DeviceIndex" :
"0" },
      { "NetworkInterfaceId" : { "Ref" : "network2port2" }, "DeviceIndex" :
"1" }
    ]
       }
     }
  }
}

br,
Pekka

Follow ups