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]: 5354172407

Task: 44925
Story: 2009958
Change-Id: Ia3d1d6f451296eba34f2389da184c41a7ee9e84e
This commit is contained in:
Hirotaka Wakabayashi
2022-04-07 01:07:08 +09:00
parent ef88f4d6c0
commit 4815692d8c

View File

@@ -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(