Use resource_id_set to clear resource ID's

self.resource_id = None is used in several resources, which is wrong,
we should be explicitly updating the resource_id in the DB via the
resource_id_set function.

Change-Id: I41e1326fe7e1da364c8e6dd68f572df484beffb3
This commit is contained in:
Steven Hardy 2013-10-24 10:47:58 +01:00
parent f384a58ae2
commit a8af2fd844
4 changed files with 6 additions and 6 deletions

View File

@ -484,7 +484,7 @@ class Instance(resource.Resource):
try:
server.get()
except clients.novaclient.exceptions.NotFound:
self.resource_id = None
self.resource_id_set(None)
break
def _detach_volumes_task(self):
@ -507,7 +507,7 @@ class Instance(resource.Resource):
try:
server = self.nova().servers.get(self.resource_id)
except clients.novaclient.exceptions.NotFound:
self.resource_id = None
self.resource_id_set(None)
return
server_delete_task = scheduler.TaskRunner(self._delete_server,

View File

@ -189,7 +189,7 @@ class SecurityGroup(resource.Resource):
pass
self.nova().security_groups.delete(self.resource_id)
self.resource_id = None
self.resource_id_set(None)
def _handle_delete_neutron(self):
from neutronclient.common.exceptions import NeutronClientException
@ -215,7 +215,7 @@ class SecurityGroup(resource.Resource):
except NeutronClientException as ex:
if ex.status_code != 404:
raise
self.resource_id = None
self.resource_id_set(None)
def FnGetRefId(self):
if self.properties['VpcId']:

View File

@ -472,7 +472,7 @@ class Server(resource.Resource):
delete = scheduler.TaskRunner(nova_utils.delete_server, server)
delete(wait_time=0.2)
self.resource_id = None
self.resource_id_set(None)
def handle_suspend(self):
'''

View File

@ -124,7 +124,7 @@ class Volume(resource.Resource):
yield
vol.get()
except clients.cinderclient.exceptions.NotFound:
self.resource_id = None
self.resource_id_set(None)
if volume_backups is not None:
def handle_snapshot_delete(self, state):