Skip to content

Commit

Permalink
Merge pull request #1560 from grycap/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
micafer authored May 27, 2024
2 parents dfb1b7d + b445c12 commit edec4b8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion IM/InfrastructureInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def Contextualize(self, auth, vm_list=None):
ctxt_task.append((-2, 0, self, ['check_vm_ips']))
ctxt_task.append((-1, 0, self, ['wait_all_vm_ips']))

self.cont_out = "Contextualization disabled by the RADL.\n\n"
self.cont_out = "Contextualization disabled by the RADL/TOSCA template.\n\n"
for vm in self.get_vm_list():
vm.configured = True
else:
Expand Down
2 changes: 1 addition & 1 deletion IM/connectors/Kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def create_request(self, method, url, auth_data, headers=None, body=None):
data = json.dumps(body)
else:
data = body
url = "%s://%s:%d%s%s" % (self.cloud.protocol, self.cloud.server, self.cloud.port, self.cloud.path, url)
url = "%s://%s:%d%s%s" % (self.cloud.protocol, self.cloud.server, self.cloud.get_port(), self.cloud.path, url)
resp = requests.request(method, url, verify=self.verify_ssl, headers=headers, data=data)

return resp
Expand Down
29 changes: 29 additions & 0 deletions IM/connectors/OpenStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,10 @@ def launch(self, inf, radl, requested_radl, num_vm, auth_data):

blockdevicemappings = self.get_volumes(driver, image, volume, radl)

if not self.get_private_nets(driver):
self.log_info("No private networks found. Force the creation.")
self.set_nets_to_create(radl)

with inf._lock:
self.create_networks(driver, radl, inf)

Expand Down Expand Up @@ -1382,6 +1386,31 @@ def launch(self, inf, radl, requested_radl, num_vm, auth_data):

return res

def get_private_nets(self, driver):
"""
Return the list of private networks
"""
res = []
pool_names = [pool.name for pool in driver.ex_list_floating_ip_pools()]
_, ost_nets = self.get_ost_network_info(driver, pool_names)
for net in ost_nets:
if net.name not in pool_names:
res.append(net)
return res

@staticmethod
def set_nets_to_create(radl):
"""
Set the private networks to be created
"""
i = 0
while radl.systems[0].getValue("net_interface." + str(i) + ".connection"):
net_name = radl.systems[0].getValue("net_interface." + str(i) + ".connection")
network = radl.get_network_by_id(net_name)
if not network.isPublic():
network.setValue('create', 'yes')
i += 1

@staticmethod
def get_ip_pool(driver, pool_name=None):
"""
Expand Down

0 comments on commit edec4b8

Please sign in to comment.