Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # If there is an instance.host the instance has been scheduled and
- # sent to a cell/compute which means it was pulled from the cell db.
- # Normal delete should be attempted.
- if not instance.host:
- try:
- if self._delete_while_booting(context, instance):
- return
- # If instance.host was not set it's possible that the Instance
- # object here was pulled from a BuildRequest object and is not
- # fully populated. Notably it will be missing an 'id' field
- # which will prevent instance.destroy from functioning
- # properly. A lookup is attempted which will either return a
- # full Instance or None if not found. If not found then it's
- # acceptable to skip the rest of the delete processing.
- cell, instance = self._lookup_instance(context, instance.uuid)
- if cell and instance:
- with nova_context.target_cell(context, cell):
- instance.destroy()
- return
- if not instance:
- # Instance is already deleted.
- return
- except exception.ObjectActionError:
- # NOTE(melwitt): This means the instance.host changed
- # under us indicating the instance became scheduled
- # during the destroy(). Refresh the instance from the DB and
- # continue on with the delete logic for a scheduled instance.
- # NOTE(danms): If instance.host is set, we should be able to
- # do the following lookup. If not, there's not much we can
- # do to recover.
- cell, instance = self._lookup_instance(context, instance.uuid)
- if not instance:
- # Instance is already deleted
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement