Skip to content

Add ex_get_network to openstack driver#1474

Merged
Kami merged 2 commits intoapache:trunkfrom
SanderRoosingh:add-ex-get-network-to-openstack
Jul 16, 2020
Merged

Add ex_get_network to openstack driver#1474
Kami merged 2 commits intoapache:trunkfrom
SanderRoosingh:add-ex-get-network-to-openstack

Conversation

@SanderRoosingh
Copy link
Copy Markdown
Contributor

@SanderRoosingh SanderRoosingh commented Jul 16, 2020

Description

Currently to retrieve a network from the OpenStack all networks need to be received. Then these can be filtered by ID. If the ID of the network is known it is not needed to retrieve all networks from the OpenStack.

By creating a function called ex_get_network and passing an ID we could retrieve a single network, this would increase performance for some systems. This function works similar to ex_get_volume.

fixes #1473

Status

  • done, ready for review

Checklist (tick everything that applies)

  • Code linting (required, can be done after the PR checks)
  • Documentation
  • Tests
  • ICLA (required for bigger changes)

@vdloo
Copy link
Copy Markdown
Member

vdloo commented Jul 16, 2020

Tested both the v1 and v2 driver, both work fine:

The OpenStack_1_1_NodeDriver:

In [12]: conn.__class__.__bases__
Out[12]: (libcloud.compute.drivers.openstack.OpenStack_1_1_NodeDriver,)

In [13]: network_id = conn.ex_list_networks()[0].id

In [14]: conn.ex_get_network(network_id)
Out[14]: <OpenStackNetwork id="123c6b6a-1234-3a1f-b404-1234365f4b22" name="L2_NETWORK" cidr="None">

The OpenStack_2_NodeDriver:

In [3]: conn.__class__.__bases__
Out[3]: (libcloud.compute.drivers.openstack.OpenStack_2_NodeDriver,)

In [4]: network_id = conn.ex_list_networks()[0].id

In [5]: conn.ex_get_network(network_id)
Out[5]: <OpenStackNetwork id="123c6b6a-1234-3a1f-b404-1234365f4b22" name="L2_NETWORK" cidr="None">

The failing tests (scrape-and-publish-provider-prices) are unrelated.

lgtm 👍

@SanderRoosingh SanderRoosingh force-pushed the add-ex-get-network-to-openstack branch from daeaa76 to 3a6d898 Compare July 16, 2020 14:03
@Kami
Copy link
Copy Markdown
Member

Kami commented Jul 16, 2020

LGTM, thanks for the contribution and thanks to @vdloo for testing the changes.

I pushed 9807ded which should fix the failing Travis CI job.

@Kami Kami merged commit 6a95f10 into apache:trunk Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get a single network by ID for OpenStack

3 participants