in _build_instance UnexpectedTaskStateError does not deallocate the network

Bug #1173413 reported by Joshua Harlow
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Alexei Kornienko

Bug Description

It appears that when a build & spawn fails with a UnexpectedTaskStateError there is no attempt to deallocate the network, this might be a feature or flaw (not entirely clear). If its a flaw, its likely leaving the allocated network orphaned.

Revision history for this message
Dan Smith (danms) wrote :

Please provide a way to actually reproduce this so I can take a look.

Changed in nova:
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Joshua Harlow (harlowja) wrote :

Will see if I can get a way to reproduce that isn't by just looking at the code.

Here is the snippet that I was talking about. Comments about what might not be right marked with <<<<

         instance = self._spawn(context, instance, image_meta,
                                       network_info, block_device_info,
                                       injected_files, admin_password,
        except exception.InstanceNotFound:
            # the instance got deleted during the spawn
            with excutils.save_and_reraise_exception():
                   <<<< Deallocated network if somehow the instance went poof before we could finish spawn()
                    self._deallocate_network(context, instance)
                except Exception:
                    msg = _('Failed to dealloc network '
                            'for deleted instance')
                    LOG.exception(msg, instance=instance)
        except exception.UnexpectedTaskStateError as e:
            <<<< No deallocation of network here :(
            actual_task_state = e.kwargs.get('actual', None)
            if actual_task_state == 'deleting':
                msg = _('Instance was deleted during spawn.')
                LOG.debug(msg, instance=instance)
                raise exception.BuildAbortException(
                        instance_uuid=instance['uuid'], reason=msg)
        except Exception:

Revision history for this message
Chris Behrens (cbehrens) wrote :

That is hit when you do a quick boot/delete.. ie, delete while instance is being scheduled.

Changed in nova:
status: Incomplete → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master

Changed in nova:
assignee: nobody → Alexei Kornienko (alexei-kornienko)
status: Triaged → In Progress
Revision history for this message
Andrew Laski (alaski) wrote :

The code in question here is no longer in use. So without further confirmation that this issue is still occuring I'm marking this incomplete for now.

Changed in nova:
status: In Progress → Incomplete
Sean Dague (sdague)
Changed in nova:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers