Jacob Colleran d3f77fd0c5 Add usage enforcement framework
Implements filter-based architecture for usage enforcement.

One filter is initially included: MaxLeaseDurationFilter allows
operators to define the maximum duration of a lease in seconds. All
filters must be enabled and configured in the [enforcement] group of
blazar.conf.

When ending a lease, the allocations currently associated with the
reservations of the lease are sent to the enforcement layer for
processing. This works fine when deleting a lease, but when a lease
naturally ends, that is, when the current time is greater than the
lease's recorded end time, the allocation lookup returns 0 results
because we have a filter on the time of the lease/reservation by
default, which starts from datetime.now. This is really not what we want
to do when explicitly filtering on a lease/reservation, so this updates
the generic query function to not apply this filtering in this case.

It turns out, it was possible for usage enforcement's on_end hook to run
multiple times if the first reservation teardown failed. In this
circumstance, the end_lease event would be IN_PROGRESS but the
reservations would be in an error state. The code only checks if any
reservation is DELETED before trying to run on_end again.

To fix this, only try to run on_end if we detected that there was an
UNDONE end_lease event; that's the only time in which we'll actually be
responsible for running this logic.

This also updates the delete logic to be a bit more consistent with the
internal way we track states. It is not enough to check dates, because
it could be that Blazar never got around to actually starting the
leases; we should be checking events. This also makes the logic a bit
easier to understand.

Change-Id: Ic106bee4fc3f5c401c4f8d8ecb1c4e735560bcc2
Co-Authored-By: Jason Anderson <jasonanderson@uchicago.edu>
Co-Authored-By: Pierre Riteau <pierre@stackhpc.com>
Implements: blueprint flexible-reservation-usage-enforcement
2021-03-24 16:57:13 +01:00
2021-01-13 09:26:38 +08:00
2021-03-24 16:57:13 +01:00
2020-06-26 12:12:41 +02:00
2021-03-24 16:57:13 +01:00
2019-09-26 15:30:56 +02:00
2019-04-19 19:47:59 +00:00
2019-07-02 10:32:10 +01:00
2017-10-09 07:18:19 +00:00
2014-02-04 23:02:01 +04:00
2014-02-17 15:03:21 +04:00
2019-09-05 14:20:47 +00:00
2020-04-13 18:18:44 +02:00
2021-01-05 16:20:37 +01:00
2021-01-05 16:20:37 +01:00

Team and repository tags

image

Blazar

Blazar is a resource reservation service for OpenStack. Blazar enables users to reserve a specific type/amount of resources for a specific time period and it leases these resources to users based on their reservations.

The following two resource types are currently supported:

  • Compute host: reserve and lease with a unit of a whole host
  • Instance: reserve and lease with a unit of a flavor

Please see the following resources to learn more.

API

See Blazar API reference.

Operators

To learn how to deploy and configure Blazar, see the installation guide and the configuration reference.

Developers

To learn how to contribute to Blazar, see the contributor guide.

Other Resources

Description
Reservation Service for OpenStack
Readme 18 MiB
Languages
Python 99.1%
Shell 0.8%