Remove error instance fail when enable serial_consol

Bug #1480514 reported by Chung Chih, Hung
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Chung Chih, Hung

Bug Description

When I fixed https://bugs.launchpad.net/nova/+bug/1478607
I found I can't remove those error instances which was failed when config xml.

This is because of following block:
https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L894

When nova try to destroy instance, it will cleanup relative resources.
if we enable serial console, nova will try to find ports, which was assigned to it, and release them.
But the instance was created failed, therefore nova will throw nova instance not found.
Yes, the block looks like it had handle instance not found exception.
But the function of "_get_serial_ports_from_instance" has yield keyword.
It will not raise exception immediately instead of raise exception when program try to iterator yielded items.
Therefore instance not found exception will been raised at L894 instead of L889.
You can checkout following sample code.
http://www.tutorialspoint.com/execute_python_online.php?PID=0Bw_CjBb95KQMU05ycERQdUFfcms

Changed in nova:
assignee: nobody → lyanchih (lyanchih)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/208268

Changed in nova:
status: New → In Progress
Changed in nova:
assignee: Chung Chih, Hung (lyanchih) → Tony Breeds (o-tony)
Revision history for this message
Tony Breeds (o-tony) wrote :
Changed in nova:
assignee: Tony Breeds (o-tony) → Chung Chih, Hung (lyanchih)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/208268
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d365c087aee56af2617700f55f4ff7a01c116da6
Submitter: Jenkins
Branch: master

commit d365c087aee56af2617700f55f4ff7a01c116da6
Author: lyanchih <email address hidden>
Date: Mon Aug 3 02:16:38 2015 +0000

    libvirt: cleanup() serial_consoles after instance failure

    When nova cleanup() is called to release all resources related to an instance
    it can thow InstanceNotFound. Which is not caught and therefore returned to
    the user.

    This is because the generator function (_get_serial_ports_from_instance)
    is not *executed* under try/except. While that is clearly the intent of the
    code.

    Change-Id: I9e9410ab7eec5fa667c0c3de4548c49df050c167
    Closes-Bug: 1480514

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-rc1 → 12.0.0
Changed in nova:
importance: Undecided → Medium
tags: added: liberty-backport-potential
tags: added: kilo-backport-potential
removed: liberty-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/253373

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/kilo)

Change abandoned by sahid (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/253373
Reason: Hum weird to miss fix for stable like that...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.