Skip to content

Commit b979c3a

Browse files
committed
rsc-grp-spawn: support external name
1 parent a604688 commit b979c3a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

linstor/linstorapi.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,14 @@ def resource_group_list_raise(self, filter_by_resource_groups=None):
12851285
raise LinstorApiCallError(list_res[0])
12861286
raise LinstorError("No list response received.")
12871287

1288-
def resource_group_spawn(self, rsc_grp_name, rsc_dfn_name, vlm_sizes, partial=False, definitions_only=False):
1288+
def resource_group_spawn(
1289+
self,
1290+
rsc_grp_name,
1291+
rsc_dfn_name,
1292+
vlm_sizes,
1293+
partial=False,
1294+
definitions_only=False,
1295+
external_name=None):
12891296
"""
12901297
Spawns resource for the given resource group.
12911298
@@ -1295,6 +1302,8 @@ def resource_group_spawn(self, rsc_grp_name, rsc_dfn_name, vlm_sizes, partial=Fa
12951302
:param bool partial: If false, the length of the vlm_sizes has to match the number of volume-groups or an
12961303
error is returned.
12971304
:param bool definitions_only: Do not auto place resource, just create the definitions
1305+
:param Optional[str] external_name: External name to set for the resource definition, if this is specified
1306+
the resource definition name will be ignored
12981307
:return: A list containing ApiCallResponses from the controller.
12991308
:rtype: list[ApiCallResponse]
13001309
"""
@@ -1314,6 +1323,12 @@ def resource_group_spawn(self, rsc_grp_name, rsc_dfn_name, vlm_sizes, partial=Fa
13141323
"partial": partial,
13151324
"definitions_only": definitions_only
13161325
}
1326+
1327+
if external_name:
1328+
self._require_version("1.0.16", msg="Spawn with external name not supported by server")
1329+
body["resource_definition_name"] = ""
1330+
body["resource_definition_external_name"] = external_name
1331+
13171332
return self._rest_request(
13181333
apiconsts.API_SPAWN_RSC_DFN,
13191334
"POST",

0 commit comments

Comments
 (0)