Skip to content

Commit 4815692

Browse files
committed
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
1 parent ef88f4d commit 4815692

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

troveclient/v1/shell.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,14 @@ def _parse_instance_options(cs, instance_options, for_grow=False):
827827

828828
nics, instance_opts = _get_networks(instance_opts)
829829
if nics:
830+
for nic in nics:
831+
# replaces net-id with network_id
832+
if 'net-id' in nic:
833+
nic['network_id'] = nic.pop('net-id')
834+
if 'subnet-id' in nic:
835+
nic['subnet_id'] = nic.pop('subnet-id')
836+
if 'ip-address' in nic:
837+
nic['ip_address'] = nic.pop('ip-address')
830838
instance_info["nics"] = nics
831839

832840
availability_zone, instance_opts = _get_availability_zone(

0 commit comments

Comments
 (0)