summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHirotaka Wakabayashi <hiwkby@yahoo.com>2022-04-07 01:07:08 +0900
committerHirotaka Wakabayashi <hiwkby@yahoo.com>2022-04-09 18:07:58 +0000
commit4815692d8cc452f7a1250db5ab7034346a201ac2 (patch)
treefd425956b14aa6550d6c74fd7c146c960f61bbf4
parentef88f4d6c0f67c3689b27347b5fd11fbc9e7e995 (diff)
downloadpython-troveclient-4815692d8cc452f7a1250db5ab7034346a201ac2.tar.gz
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
-rw-r--r--troveclient/v1/shell.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py
index 4c6ffd7..f4447c6 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(