Commit Graph

133 Commits

Author SHA1 Message Date
Tyler Adams 6b15b97689 Remove executable permissions from files that don't need it
Many python files have their executable permissions flag set but they shouldn't Removed executable flag from files that did not need it

Closes-Bug: #2055736
Change-Id: Ic04051fdc597b2f915f76e4c4c47f392354ddfe1
2024-03-02 00:14:48 +00:00
Zuul 0c1525c64a Merge "Release locks when action is cancelled" 2020-12-16 20:09:17 +00:00
Zuul 6b60c7a87e Merge "Release cluster lock on failed policy check" 2020-12-16 19:44:50 +00:00
Duc Truong 8fc8ee6549 Release locks when action is cancelled
When an action is cancelled, it should release any associated cluster or
node locks so that new operations can be performed on the cluster or
node.
Remove action status check for action force operation.

Change-Id: I6a520a90feed7ab1e9c99a595863ca3ff90aef40
2020-11-10 01:30:15 +00:00
Duc Truong f0fbae7c11 Release cluster lock on failed policy check
When policy check fails, the cluster lock will not be released because
the the policy check status is incorrectly set to ok.  This patch fixes
it so the cluster lock is released on failed policy checks.

Change-Id: I6f964d16e243476730e1fd5a628fa6a4870a0c6f
Closes-Bug: #1903568
2020-11-09 17:27:27 +00:00
Duc Truong 6133e815e3 Load projects without restrictions in policy_check
The policy_check needs to load projects without project safe restriction
because it is possible for users to attach policies belonging to other
projects.

Change-Id: I019e7765bdce3f3338167ce11660f4eae70639fc
Closes-Bug: #1896099
2020-11-05 22:50:18 +00:00
Erik Olof Gunnar Andersson 5f955f2392 Remove six usage
We no longer need this as we no longer support Python 2.7.

Change-Id: Ifa7119215b0bf65f5ec7ffc30ac87de437428181
2020-01-13 14:22:55 -08:00
Bo Tran 8a5460c591 Add cluster_id to action filter in API
Current, an action was created haven't information of a cluster.
When a specific action is created, we do not know what action this action takes
in a cluster and when we execute the query API:

GET http://senlin_host:8777/actions

so many actions are returned even though we can limit using parameters
such as name, target, action, status combined with limit and marker.
But, we can't just get the actions executed in a particular cluster.
So, I want us to be able to do this by enabling the query with a cluster_id parameter.
To accomplish this, I need to modify the schema of
action models and action tables in the database of senlin service.

Change-Id: I49d172414eecf9158192cf0869abb91822ee2226
2019-10-29 10:35:22 +07:00
Jude Cross e37e347771 Allow cluster delete to detach policies & delete receivers
This patch allows the cluster delete actions to detach policies
and delete receivers for the cluster being deleted. This
simplifies deleting clusters by not having to detach or delete
all dependancies from it beforehand.

Depends-On: https://review.opendev.org/657713/

Change-Id: I9c723516a65a43533e0589bc85bd485a6387711b
2019-05-08 16:03:06 -07:00
Jude Cross 9f3e49412d Add node_operation to lock and conflict bypass
This patch adds node_operation to lock & conflict bypass. This
allows the node operation to be accepted even when a cluster is
locked.

This fixes an issue when a cluster stop_on_delete flag is set.

Change-Id: Ic92eda3964c0a90aac165b412243f62c2933e459
2019-01-28 09:58:29 -08:00
Duc Truong b9c9cfaac4 Miscellaneous fixes
- Remove unused code path for RES_LIFECYCLE_COMPLETE in set_status
- Wrap policy_check in try finally to always release cluster lock
- Change node lock failure log level to warning to match cluster lock
  failure log level.

Change-Id: Ic45c22ed9ae5136950a064cf651d85f39840f896
2019-01-17 00:09:58 +00:00
Jude Cross 44b5ae89f6 Add force to action_update
This patch adds the force query parameter to action_update.
When force is set to true on an action cancel request the
action status will be updated in the database to cancelled
rather than signaled to cancel. This will also update any
child actions to update their status in the database to
cancelled.

Change-Id: I45ab4a6ad57e3bfe791da1d2e70d3b2ed3ad9a21
2018-12-21 15:35:06 -08:00
Jude Cross ffbfa8042e Add action_update api to cancel actions
This patch implements the action_update API to allow the status
of an action to be updated. For now we are only accepting
'CANCELLED' as a valid status value.

Implements: blueprint action-update
Change-Id: I76402401cb67bc9a2aa1df43ec0f28fc446f04bd
2018-12-05 16:08:21 -08:00
Jude Cross af036cf716 Make CLUSTER_DELETE action ignore conflicts/locks
When cluster/node actions were updated to reject when there is a
conflict/lock we broke the way CLUSTER_DELETE could steal the
lock from a cluster. This changes makes CLUSTER_DELETE actions
able to steal locks and ignore conflicts. However a
CLUSTER_DELETE action can conflict with another CLUSTER_DELETE.

Change-Id: Ia771449c76d0d7bb07ffc0cc37317f47f900db48
Closes-Bug: 1800549
2018-10-29 17:35:32 -07:00
Jude Cross 364b1402a1 Update scaling policy logic to be applied before action acceptance
This patch alters the cluster_scale_in and cluster_scale_out actions to
no longer place the action into the actions table when a conflict is
detected. This behavior is an improvement on the old way actions are
processed as the requester will now receive immediate feedback from the API
when an action cannot be processed. This change  also honors the scaling
action cooldown in the same manner by erring via the API when a scaling
action cannot be processed due to cooldown.

Depends-On: https://review.openstack.org/#/c/602460/
Implements: blueprint scaling-action-acceptance
Change-Id: If0dcf5e427d3d6973d2c5e52fada8a6c925240d5
2018-10-15 14:30:01 -07:00
Duc Truong a34e45b696 Reject actions if target resource is locked
- If an action targets a cluster or node that is already locked, reject
  the action with 409 error.
- Added simulated wait time option to nova test driver to allow tempest
  to test resource locked exception.

Implements: blueprint fail-fast-locked-resource
Change-Id: I27b6996c65ffd1777dad5047f869596373e693c7
2018-10-10 16:46:10 +00:00
Duc Truong 86119a69d8 Fix cooldown check
- Move cooldown check inside pre-op of scaling policy.  Cooldown only
  applies to scaling policy so it doesn't make sense to check it for all
  the other policies.
- Move last_op update into post_op of scaling policy.
- Change policy_check for scaling policy to pass for AFTER if action is
  either scale out or scale in. This allows the post_op of the scaling
  policy to be called and the last_op to be updated for either scaling action.

Closes-Bug: 1795503
Change-Id: I043cb2b67648c5767d00aca05b8d0825a6a371dc
2018-10-09 18:04:43 -07:00
Erik Olof Gunnar Andersson 1592010246 Trivial code cleanups
* Consistently use """ instead of ''' for comments and multi-line text
* Wrap multi-line calls in round brackets, instead of backslashes

Change-Id: I51f6efef0a433ae425d28a821fd9131a02bd6699
2018-07-22 01:05:16 -07:00
Yuanbin.Chen bb2fe697cf fix base module describe typo error
This patch remove base module describe "check"
repeat error.

Change-Id: Ibb042a38eb5e88c60516945f39f0e509a139800d
Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
2018-02-11 08:55:39 +08:00
Zuul d39ff33ecc Merge "Further removal of localization to please py35" 2018-02-08 02:51:09 +00:00
tengqm 757bde1bde Further removal of localization to please py35
Change-Id: I5dad40e54b89c881984fa0c30f4748faabc4e4bd
2018-02-07 09:57:07 -05:00
tengqm 5841f9fa26 Misc improvements
- Add lockmode to some DB APIs
- Improve event module to handle entity not set case
- Improve action deserialize operation for better initialization

Change-Id: I3d636e9c73b8ebfae3112601b402a546877afaff
2018-02-07 01:42:00 -05:00
Duc Truong 3dd9f3ecde Lifecycle hook implementation
* Added lifecycle hook properties to deletion policy
* Check if deletion policy has lifecycle hook properties during
deletion and perform lifecycle specific actions if it does
* Added complete lifecycle API endpoint
* Bumped microversion to 1.9
* Added unit-test cases for lifecycle hooks
* Added lifecycle hook notification
* Added lifecycle hook properties to deletion policy
* Modified node_action to process policy preop if it was a
derived action with lifecycle hook properties
* Modified LB policy to defer deletion of node until node_deletion
action is executed if lifecycle hook properties are defined in
deletion policy
* Added zaqar test driver
* Added documentation for lifecycle hook

Depends-On: Id7804abc351c063563b58fb69a66074d0d854ecf

Change-Id: I888a01c4f26959649121d6f82430017858a4c481
2018-01-30 17:31:43 +00:00
TingtingYu 6139e733e3 Fix the bug that cannot create a cluster
It report the error with "Field `user' cannot be None" when
I create a cluster.
I found the RequestContext() code had changed from 'user' to
'user_id' in the commit 66e8486c27,
but in action/base.py, the params were not to changed. So cause
the 'user' is None and cannot create a cluster successfully.
I modify the 'user' to 'user_id' to match the RequestContext()
of context.py.

Closes-Bug: #1740377
Change-Id: Id0e12c31b4e107bb0c69c394e81d3e0ef10462f9
2017-12-29 11:27:01 +08:00
tengqm 66e8486c27 Remove tox unit test warnings
There have been changes to oslo_context which are producing a lot of
annoying warning messages. This patch is an attempt to silent them.

Change-Id: I7c47daebe093ca814a14c972d9d5d53e8103afc9
2017-12-18 05:05:02 -05:00
tengqm 77e460c412 Improve action logging for easier debugging
Change-Id: Id8f7a8cdfe249381496d554a9ac5dd52d9c8111b
2017-11-14 08:15:18 -05:00
ruijie f1322a3ef6 add retry times and interval when tring retry actions
this patch add retry times and retry interval which are configurable.

please help review this patch, I'm not comfotable with line 327,328.
Is that better that we add parameter to ao.Action.abandon() to pass
the data field?

Change-Id: I65d200ce43c33434b8b33187d9f97d800f0e0916
2017-08-10 04:57:11 -07:00
tengqm 9cdede6018 Change requirement assertion to 'must'
There are cases where we make assertions about the requirements upon a
request. We should use 'must' instead of 'should' because the latter
implies that the assertion is optional.

Change-Id: I14c5cf0a71cc27147f243316bfb04d53af6e59a5
2017-05-16 04:26:35 -04:00
jonnary 092e28330a Fix scheduing problem about abandon action
This patche fixes scheduing problem about abondon action. The action can't
get lock and setted to "READY" status, but may not be schedued util next action
come.

Change-Id: Id335b0095052206e62b2407bea57d67a4b9f9634
Closes-Bug: #1682002
2017-04-12 06:10:53 +00:00
liyi 1601c159b2 policy_check return when cooldown is inprogress.
if cooldown not in inprogress, policy_check continue working.

Change-Id: I1bb7c017f9c93d17e87e92b61748c9d793deaf0f
Closes-Bug: #1678053
2017-04-07 14:05:29 +08:00
liyi 3423667de0 Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I1c1c3fe4c3281014b0ed413c7b247b6223939a24
2017-03-21 18:34:35 +08:00
wlfightup b3504fe8bd use a more appropriate word
Elapse more appropriate, lapse change to elapse.

Change-Id: Ie9ca1f3fbb3a4bfcee176257f9729745d835bfd8
2017-03-06 17:02:26 +08:00
RUIJIE YUAN a17d0d351d revise dumping event notifications
To prevent dumping duplicated event notifications to rabbitMQ, we will only
dump it at the beginning of processing the action:
https://git.openstack.org/cgit/openstack/senlin/tree/senlin/engine/actions/base.py#n471

and at the end of processing the action:
https://git.openstack.org/cgit/openstack/senlin/tree/senlin/engine/actions/base.py#n492

Change-Id: I3ac9115f29cca40d3b16132a5e0afa76f502ec1a
2017-02-19 15:43:36 +08:00
tengqm 340a0d3b9e Fixed inappropriate event generation in action base
When policy check succeeds, we are not supposed to emit an event (either
to database or to message queue) because the success of such a check is
not interesting to users at all. They only care about the abnormal
behaviors, aka. errors or warnings.

Change-Id: I4cfbb8fb90aeefc3750365c9d3998bd3246c21d1
2017-02-17 00:44:19 -05:00
tengqm 25c356a8cc Remove 'load_all' from cluster_policy module
This removes the 'load_all' method from the cluster_policy module. We
are using the cluster_policy versioned object as an alternative.

Change-Id: I7f1df0441d808341dd50ffa6f20f36ccc1cb54ab
2017-02-04 04:57:38 -05:00
tengqm cc3e528822 Remove 'load_all' from receiver and action base
The 'load_all' class methods in both cases are no longer used anywhere
any more. This proposes a removal of them.

Change-Id: I55ac335bf18f7c5f77083697c71d7ff1e3469158
2017-01-30 04:15:18 -05:00
jonnary fa78792e75 Fix log issue in do cluster check action
This patch fixes log issue in do cluster check action.
Change-Id: If25485d0923ed96569ec46741d88ba22b94f7828
Closes-Bug: #1655518
2017-01-22 14:55:46 +08:00
miaohb 72297dce8b Replace the definition about action cause in action with it in consts
This patch replaces the definition about action cause in action base
class with the definition in consts module.

Change-Id: I262dc188fd62f764c2e293793992aa0f802f3dae
2017-01-06 17:19:17 +08:00
Jenkins 3480b8c66e Merge "Exclude derived actions by default in events" 2017-01-03 16:17:57 +00:00
lvdongbing 4d70b88d33 Enforce project_safe checking for admin users
Admin users are designed to retrieve objects from all projects even
take actions on them, this will cause a lot problems, for example:
1. name_unique checking issue:
https://bugs.launchpad.net/senlin/+bug/1652742
2. cluster-node-add, admin user can add projectB's node to projectA's
  cluster
Admin users should respect the project concepts as well, this patch
enforces project_safe checking fro admin users. And as for some actions
that admin users should be authorized to retrieve things from all projects,
will be added in following patches.

Change-Id: I7103efabccbb4d10c2572e2df51a38ade009df84
2017-01-03 02:12:20 -05:00
tengqm 62d9fe9150 Exclude derived actions by default in events
This adds a configuration option for excluding derived actions from
event dispatching.

Change-Id: I2596e66ffa7a194ef6dc5841a6677cd67e43aacb
2016-12-28 05:23:50 -05:00
jonnary 3322ab5f01 Add user and project support in action parse
action-show can't show user and project, this patch
adds in server side.
Other patches will follow up.

Change-Id: Iaef6c3a6dcb2ae688669d736f1850112d9916faa
Closes-Bug: #1652423
2016-12-24 16:24:12 +08:00
tengqm 7ccbc5345b Fix usage of NotImplementedError
'NotImplementedError' is the name of an exception, 'NotImplemented' is
the name of a constant. This patch fixes the usage.

Change-Id: If6293e1644a4c95d27114b2c28a2a264f65c330a
2016-12-18 22:34:49 -05:00
Ethan Lynn b6e8d758a0 Remove retry logic from lock_acquire
No need to retry, just wait for engine to pick action up again.

The workflow is:
ActionProc -> action.execute() -> return RES_RETRY
-> action.set_status -> ignore RES_RETRY and continue

Change-Id: Ic622a79b754131171cb940aa9f31ec5aef11ee47
Closes-Bug: #1648681
2016-12-13 22:03:21 +08:00
tengqm c93385c3c3 Further simplify event dispatch interface
This furter simplifies the event dispatch interface considering we are
unnecessarily complicating the interface specification.

partial-blueprint: generic-event
Change-Id: I623e472404bfdcc4d791779a2e0b99a8b334d611
2016-12-04 05:16:30 -05:00
yanyanhu c7f7a3ae27 Minor change on event code in action modules
This patch minor tweaks some code about event in action
modules to increase consistency.

Change-Id: Iba32af913eb177f799d999e2c9b40fe3a66a9b75
2016-11-30 03:41:51 -05:00
yanyanhu fad37c6874 Add consts definition for notification priority and phase
This patch adds consts definition for notification priority and
phase.

Change-Id: I9cac4f4465f74097cb2be4a4d73aaf3100e43f1d
2016-11-30 03:21:28 -05:00
tengqm 47184116d3 Fix event calls from action base
This patch fixes the event calls from the action base class. It is
effectively removing the situation where we pass Action class as entity
when logging, thus we don't need to check it later.

Change-Id: I08bcba4d6979644f8fa58d7bad1bb57619af4761
partial-blueprint: generic-event
2016-11-28 09:28:46 -05:00
tengqm 9a2d5b15a9 Remove event logging for action signal
When signaling an action for different reasons, these are mostly not
originated from users thus not suitable for event generation or
notification. In future when we add support to action-notify, we can
override the 'signal()' method in subclasses to resurrect this
functionality. This patch removes the call to EVENT module for ease of
handling notifications in a consistent manner.

partial-blueprint: generic-event
Change-Id: I4baa22227a48b8fd6d2122ebc223c0a392578982
2016-11-28 01:16:20 -05:00
zengjianfang b51a39c62f Remove redundant parameter comment
Remove redundant parameter comment in _from_object function.

Change-Id: I8e45c5f3eb552c9131c75d7743893221c81eefb2
2016-10-26 17:49:48 +08:00