Skip to content

Add third party plugins #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: chameleoncloud/xena
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
276ab48
Add third party plugin support
Mark-Powers Nov 2, 2021
34f7da3
Merge branch 'chameleoncloud/train' of https://github.com/chameleoncl…
Mark-Powers Nov 15, 2021
7db8a66
Continue adding third party plugin support
Mark-Powers Nov 18, 2021
54ceb91
Add resources endpoint
Mark-Powers Nov 18, 2021
dfa7da4
Fix host plugin typos
Mark-Powers Nov 23, 2021
cc6016f
Fix third party host plugin
Mark-Powers Nov 24, 2021
aeb9e59
Fix formatting
Mark-Powers Nov 24, 2021
853574d
Update third party host plugin
Mark-Powers Nov 30, 2021
e754baa
Refactor host plugin
Mark-Powers Dec 1, 2021
35e2a2e
Clean up DummyPlugin
Mark-Powers Dec 2, 2021
97f91eb
Revert "[backport] Prevent failed lease update from setting lease sta…
Mark-Powers Jan 12, 2022
b98e8ef
Restore lease status after non fatal update exception
Mark-Powers Jan 13, 2022
29d3f4b
Merge branch 'chameleoncloud/train' into third_party_plugins
Mark-Powers Jan 18, 2022
3d1c210
Update third party plugins with docs, tests
Mark-Powers Jan 21, 2022
2e4b883
Add third party plugin support
Mark-Powers Nov 2, 2021
1c208f1
Continue adding third party plugin support
Mark-Powers Nov 18, 2021
cc43b3e
Add resources endpoint
Mark-Powers Nov 18, 2021
5d740ab
Fix host plugin typos
Mark-Powers Nov 23, 2021
b671d4a
Fix third party host plugin
Mark-Powers Nov 24, 2021
b11f78d
Fix formatting
Mark-Powers Nov 24, 2021
ef50627
Update third party host plugin
Mark-Powers Nov 30, 2021
844b0c6
Refactor host plugin
Mark-Powers Dec 1, 2021
cc52958
Clean up DummyPlugin
Mark-Powers Dec 2, 2021
19b897b
Update third party plugins with docs, tests
Mark-Powers Jan 21, 2022
f21a5ee
Fix migrations and resource queries
Mark-Powers Jan 25, 2022
972b2db
Fix broken checkouts
Mark-Powers Jan 25, 2022
1138230
Add project_id as stitchport tag
Mark-Powers Jan 27, 2022
d3480ab
Fix pep8
Mark-Powers Jan 27, 2022
bb34404
Update stitchport plugin to use binding:profile
Mark-Powers May 4, 2022
fd65787
Merge branch 'chameleoncloud/xena' into third_party_plugins
Mark-Powers Jun 1, 2023
9bdf28b
Merge branch 'chameleoncloud/xena' into third_party_plugins
Mark-Powers Jun 1, 2023
8e6acf7
Fix git issues
Mark-Powers Jun 6, 2023
9e5b632
Merge branch 'third_party_plugins' of https://github.com/chameleonclo…
Mark-Powers Jun 6, 2023
ea556b5
Fix git conflicts
Mark-Powers Jun 7, 2023
7503f18
Get third party plugins to work
Mark-Powers Jun 12, 2023
83d6bdd
Finish TODOs
Mark-Powers Jun 12, 2023
216b203
Update code based on review
Mark-Powers Jul 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "[backport] Prevent failed lease update from setting lease sta…
…tus to ERROR"

This reverts commit d78c38a.

Change-Id: Ia80e00a1aac3ad0c02a5062e997447fe243bacc6
  • Loading branch information
Mark-Powers committed Jan 12, 2022
commit 97f91eb4cb4fb4d4f15b3992e4742fe8df2b30ec
1 change: 0 additions & 1 deletion blazar/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class Timeout(BlazarException):

class InvalidInput(BlazarException):
code = 400
restore_lease_status = True
msg_fmt = _("Expected a %(cls)s type but received %(value)s.")


Expand Down
7 changes: 1 addition & 6 deletions blazar/manager/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class EventError(exceptions.BlazarException):

class InvalidDate(exceptions.BlazarException):
code = 400
restore_lease_status = True
msg_fmt = _(
'%(date)s is an invalid date. Required format: %(date_format)s')

Expand Down Expand Up @@ -145,7 +144,7 @@ class HypervisorNotFound(exceptions.BlazarException):


class NotEnoughResourcesAvailable(exceptions.BlazarException):
restore_lease_status = True
pass


class NotEnoughHostsAvailable(NotEnoughResourcesAvailable):
Expand All @@ -159,19 +158,16 @@ class NotEnoughResourcesDefaultProperties(exceptions.BlazarException):

class MalformedParameter(exceptions.BlazarException):
code = 400
restore_lease_status = True
msg_fmt = _("Malformed parameter %(param)s")


class MalformedRequirements(exceptions.BlazarException):
code = 400
restore_lease_status = True
msg_fmt = _("Malformed requirements %(rqrms)s")


class MissingParameter(exceptions.BlazarException):
code = 400
restore_lease_status = True
msg_fmt = _("Missing parameter %(param)s")


Expand All @@ -195,7 +191,6 @@ class ProjectIdNotFound(exceptions.BlazarException):

class InvalidRange(exceptions.BlazarException):
code = 400
restore_lease_status = True
msg_fmt = _('Invalid values for min/max of hosts. '
'Max must be equal to or larger than min.')

Expand Down
58 changes: 23 additions & 35 deletions blazar/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,58 +202,46 @@ def wrapper(*args, **kwargs):
else:
lease_id = args[1]
lease = db_api.lease_get(lease_id)
original_status = lease['status']
if cls.is_valid_transition(original_status,
if cls.is_valid_transition(lease['status'],
transition,
lease_id=lease_id):
db_api.lease_update(lease_id,
{'status': transition})
LOG.debug('Status of lease %s changed from %s to %s.',
lease_id, original_status, transition)
lease_id, lease['status'], transition)
else:
LOG.warn('Aborting %s. '
'Invalid lease status transition from %s to %s.',
func.__name__, original_status,
func.__name__, lease['status'],
transition)
raise exceptions.InvalidStatus

# Executing the wrapped function
try:
result = func(*args, **kwargs)
except Exception as e:
with save_and_reraise_exception():
restore_lease_status = getattr(
e, 'restore_lease_status', False)
if restore_lease_status:
LOG.debug('Non-fatal exception occured during '
'status transition, reverting status of '
'lease %s to %s.', lease_id,
original_status)
db_api.lease_update(lease_id,
{'status': original_status})
else:
LOG.exception('Lease %s went into ERROR status.',
lease_id)
db_api.lease_update(lease_id,
{'status': cls.ERROR})
else:
# Update a lease status if it exists
if db_api.lease_get(lease_id):
next_status = cls.derive_stable_status(lease_id)
if (next_status in result_in and
cls.is_valid_transition(transition,
LOG.exception('Lease %s went into ERROR status. %s',
lease_id, str(e))
db_api.lease_update(lease_id,
{'status': cls.ERROR})
raise e

# Update a lease status if it exists
if db_api.lease_get(lease_id):
next_status = cls.derive_stable_status(lease_id)
if (next_status in result_in
and cls.is_valid_transition(transition,
next_status,
lease_id=lease_id)):
db_api.lease_update(lease_id,
{'status': next_status})
LOG.debug('Status of lease %s changed from %s to '
'%s.', lease_id, transition, next_status)
else:
LOG.error('Lease %s went into ERROR status.',
lease_id)
db_api.lease_update(lease_id,
{'status': cls.ERROR})
raise exceptions.InvalidStatus
db_api.lease_update(lease_id,
{'status': next_status})
LOG.debug('Status of lease %s changed from %s to %s.',
lease_id, transition, next_status)
else:
LOG.error('Lease %s went into ERROR status.',
lease_id)
db_api.lease_update(lease_id, {'status': cls.ERROR})
raise exceptions.InvalidStatus

return result
return wrapper
Expand Down