From 4815692d8cc452f7a1250db5ab7034346a201ac2 Mon Sep 17 00:00:00 2001 From: Hirotaka Wakabayashi Date: Thu, 7 Apr 2022 01:07:08 +0900 Subject: [PATCH] Uses the "network_id" param creating a cluster This PR replaces a request parameter name "net-id" with "network_id" creating a cluster. When creating a cluster, Clusters API internally calls Instaces API to create a instance. A request parameter name to create instances has changed[1] but python-troveclient still uses old parameter name when creating a cluster. The original problem is instance creation error when creating a instance that belongs to a cluster. Troves's Instances API has changed a parameter name from "net-id" to "network_id", but Clusters API and python-troveclient still uses the "net-id" parameter name. We need to fix it. [1]: https://opendev.org/openstack/trove/commit/535417240709694080255c064c9d84a5ab1d5372 Task: 44925 Story: 2009958 Change-Id: Ia3d1d6f451296eba34f2389da184c41a7ee9e84e --- troveclient/v1/shell.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py index 4c6ffd7b..f4447c66 100644 --- a/troveclient/v1/shell.py +++ b/troveclient/v1/shell.py @@ -827,6 +827,14 @@ def _parse_instance_options(cs, instance_options, for_grow=False): nics, instance_opts = _get_networks(instance_opts) if nics: + for nic in nics: + # replaces net-id with network_id + if 'net-id' in nic: + nic['network_id'] = nic.pop('net-id') + if 'subnet-id' in nic: + nic['subnet_id'] = nic.pop('subnet-id') + if 'ip-address' in nic: + nic['ip_address'] = nic.pop('ip-address') instance_info["nics"] = nics availability_zone, instance_opts = _get_availability_zone(