Fix the conversion from instance to resource name
Change-Id: Iaca10eb5468bd7b64b6a66f87fc6f7066053cb27 Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
2d4d5529f9
commit
f0b75758f6
@ -25,7 +25,7 @@ from novaclient.exceptions import NotFound
|
||||
from heat.engine.resources import Resource
|
||||
from heat.common import exception
|
||||
|
||||
logger = logging.getLogger(__file__)
|
||||
logger = logging.getLogger('heat.engine.instance')
|
||||
# If ../heat/__init__.py exists, add ../ to Python search path, so that
|
||||
# it will override what happens to be installed in /usr/(local/)lib/python...
|
||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
@ -64,9 +64,21 @@ class Restarter(Resource):
|
||||
self.state_set(self.DELETE_COMPLETE)
|
||||
|
||||
def alarm(self):
|
||||
logger.notice('%s Alarm, restarting resource: %s' %
|
||||
(self.name, self.properties['InstanceId']))
|
||||
self.stack.restart_resource(self.properties['InstanceId'])
|
||||
self.calculate_properties()
|
||||
victim = None
|
||||
for rname, r in self.stack.resources.items():
|
||||
if r.instance_id == self.properties['InstanceId']:
|
||||
victim = r
|
||||
break
|
||||
|
||||
if victim is None:
|
||||
logger.info('%s Alarm, can not find instance %s' %
|
||||
(self.name, self.properties['InstanceId']))
|
||||
return
|
||||
|
||||
logger.info('%s Alarm, restarting resource: %s' %
|
||||
(self.name, victim.name))
|
||||
self.stack.restart_resource(victim.name)
|
||||
|
||||
|
||||
class Instance(Resource):
|
||||
|
Loading…
Reference in New Issue
Block a user