From 982d46a52053c8050b885833267e8e6289995575 Mon Sep 17 00:00:00 2001 From: Gabor Hernadi Date: Mon, 8 Jul 2024 15:52:48 +0200 Subject: [PATCH] resource_delete: Add keep_tiebreaker parameter --- CHANGELOG.md | 1 + linstor/linstorapi.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2637de0..9e24e01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/linstor/linstorapi.py b/linstor/linstorapi.py index c41ba9c..77630ec 100644 --- a/linstor/linstorapi.py +++ b/linstor/linstorapi.py @@ -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):