Skip to content

Commit

Permalink
fix removing network
Browse files Browse the repository at this point in the history
  • Loading branch information
saklar13 committed Aug 17, 2023
1 parent b089efb commit d2066c8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cloudshell/cp/vcenter/flows/connectivity_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
from cloudshell.shell.flows.connectivity.models.connectivity_model import (
ConnectionModeEnum,
is_set_action,
)

from cloudshell.cp.vcenter.exceptions import BaseVCenterException
Expand Down Expand Up @@ -100,7 +101,7 @@ def pre_connectivity(
existed_pg_names = set()
net_to_create = {} # {(pg_name, host_name): action}

for action in actions:
for action in filter(is_set_action, actions):
if pg_name := get_existed_port_group_name(action):
existed_pg_names.add(pg_name)
else:
Expand Down Expand Up @@ -306,12 +307,13 @@ def _remove_pg(self, action: VcenterConnectivityActionModel) -> set[str]:

if isinstance(network, DVPortGroupHandler):
network.destroy()
del network
else:
vm = self.get_target(action)
# remove from the host where the VM is located
vm.host.remove_port_group(network.name)
logger.info(f"{network} was removed")

del network
logger.info(f"Network {pg_name} was removed")
return tags

def _get_network_tags(
Expand Down

0 comments on commit d2066c8

Please sign in to comment.