pyvcloud icon indicating copy to clipboard operation
pyvcloud copied to clipboard

Create external network fails.

Open jpvrenen opened this issue 3 years ago • 2 comments

Create external network fails under following condition:

  • multiple vcenters
  • same portgroup name is used on different vcenters

possible issue/bug is found in --> pyvcloud/vcd/platform.py

From function def create_external_network(

Only takes into account the portgroup name not the specified vcenter. (vim_server_name) line 125 -> pg_morefs = self.get_port_group_morefs(port_group_names)

possible solution

Add vcenter (vim_server_name) as parameter to function pg_morefs = self.get_port_group_morefs(port_group_names, vim_server_name)

From function def get_port_group_morefs(self, port_group_names):

Modify into def get_port_group_morefs(self, port_group_names, vim_server_name):

Add vcenter filter to existing query vcfilter = 'vcName==%s' % urllib.parse.quote(vim_server_name) query = self.client.get_typed_query( ResourceType.PORT_GROUP.value, qfilter=vcfilter, query_result_format=QueryResultFormat.RECORDS)

jpvrenen avatar Sep 01 '21 13:09 jpvrenen

Can confirm that this solution worked for me, would it be possible for you to provide a PR with these changes?

scubar avatar Jan 27 '23 16:01 scubar

query

Thanks for confirming, I will apply for a PR.

jpvrenen avatar Feb 01 '23 10:02 jpvrenen