Cannot delete a lease which failed to start until after end_date

Bug #1713768 reported by Pierre Riteau
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Blazar
Fix Released
High
Hiroaki Kobayashi

Bug Description

If a lease has failed to start (e.g. because the host had been accidentally removed from the freepool), it cannot be deleted until after its end date: the error "Invalid event status" is returned instead. This is because of the following code in delete_lease():

if (datetime.datetime.utcnow() >= lease['start_date'] and
        datetime.datetime.utcnow() <= lease['end_date']):
    start_event = db_api.event_get_first_sorted_by_filters(
        'lease_id',
        'asc',
        {
            'lease_id': lease_id,
            'event_type': 'start_lease',
            'status': 'DONE'
        }
    )
    if not start_event:
        raise common_ex.BlazarException('Invalid event status')

Pierre Riteau (priteau)
Changed in blazar:
importance: Undecided → High
Changed in blazar:
assignee: nobody → Hiroaki Kobayashi (hiro-kobayashi)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to blazar (master)

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

Changed in blazar:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to blazar (master)

Reviewed: https://review.openstack.org/499411
Committed: https://git.openstack.org/cgit/openstack/blazar/commit/?id=3c1143085fa38a4e31b06d3c798586caf47dc27c
Submitter: Jenkins
Branch: master

commit 3c1143085fa38a4e31b06d3c798586caf47dc27c
Author: Hiroaki Kobayashi <email address hidden>
Date: Thu Aug 31 10:31:26 2017 +0900

    Allow deleting leases which failed to start at any time

    Leases which failed to start could not be deleted until their end date.
    This patch enables deletion of such leases at any time.

    Change-Id: I8a4764fdcf4750a0dd89e787ee96d930245e8cf7
    Closes-Bug: #1713768

Changed in blazar:
status: In Progress → Fix Released
Changed in blazar:
milestone: none → 0.4.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to blazar (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/519637

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to blazar (stable/pike)

Reviewed: https://review.openstack.org/519637
Committed: https://git.openstack.org/cgit/openstack/blazar/commit/?id=8a1b2703c067b35db920ce839144a99da29dce3a
Submitter: Zuul
Branch: stable/pike

commit 8a1b2703c067b35db920ce839144a99da29dce3a
Author: Hiroaki Kobayashi <email address hidden>
Date: Thu Aug 31 10:31:26 2017 +0900

    Allow deleting leases which failed to start at any time

    Leases which failed to start could not be deleted until their end date.
    This patch enables deletion of such leases at any time.

    Change-Id: I8a4764fdcf4750a0dd89e787ee96d930245e8cf7
    Closes-Bug: #1713768
    (cherry picked from commit 3c1143085fa38a4e31b06d3c798586caf47dc27c)

tags: added: in-stable-pike
Changed in blazar:
milestone: 0.4.0 → queens-1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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