Skip to content

Commit

Permalink
resource_delete: Add keep_tiebreaker parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ghernadi committed Jul 8, 2024
1 parent 4843981 commit 982d46a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Autoplacer: Add --x-replicas-on-different option
- Resource delete: Add keep_tiebreaker parameter

## [1.22.0] - 2024-04-02

Expand Down
15 changes: 13 additions & 2 deletions linstor/linstorapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2689,19 +2689,30 @@ def resource_modify(self, node_name, rsc_name, property_dict, delete_props=None)
body
)

def resource_delete(self, node_name, rsc_name, async_msg=False):
def resource_delete(self, node_name, rsc_name, async_msg=False, keep_tiebreaker=False):
"""
Deletes a given resource on the given node.
:param str node_name: Name of the node where the resource is deployed.
:param str rsc_name: Name of the resource.
:param bool async_msg: True to return without waiting for the action to complete on the satellites.
:param bool keep_tiebreaker: Controller will ensure to keep a tiebreaker, even if that means to not
properly delete the resource of this request
:return: A list containing ApiCallResponses from the controller.
:rtype: list[ApiCallResponse]
"""

query_params = []
if keep_tiebreaker:
query_params.append("keep_tiebreaker=True")

query = ""
if query_params:
query = "?" + ("&".join(query_params))

return self._rest_request(
apiconsts.API_DEL_RSC,
"DELETE", "/v1/resource-definitions/" + rsc_name + "/resources/" + node_name
"DELETE", "/v1/resource-definitions/" + rsc_name + "/resources/" + node_name + query
)

def resource_delete_if_diskless(self, node_name, rsc_name):
Expand Down

0 comments on commit 982d46a

Please sign in to comment.