From 5b680c866746d2a4422bbc95ca7746c1b990f5a7 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 27 May 2024 09:46:52 +0200 Subject: [PATCH 1/3] Minor change in ctxt log --- IM/InfrastructureInfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IM/InfrastructureInfo.py b/IM/InfrastructureInfo.py index 45f594c9..2ebe2204 100644 --- a/IM/InfrastructureInfo.py +++ b/IM/InfrastructureInfo.py @@ -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: From 31dd76b550708b81a0504342f43c89078631ae2c Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 27 May 2024 11:48:05 +0200 Subject: [PATCH 2/3] Fix error getting port --- IM/connectors/Kubernetes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IM/connectors/Kubernetes.py b/IM/connectors/Kubernetes.py index 0c95915d..59faa74c 100644 --- a/IM/connectors/Kubernetes.py +++ b/IM/connectors/Kubernetes.py @@ -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 From b445c1208500a1b97354caff9f7d7eb1b51c413c Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 27 May 2024 12:38:38 +0200 Subject: [PATCH 3/3] Force net creation if not found --- IM/connectors/OpenStack.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/IM/connectors/OpenStack.py b/IM/connectors/OpenStack.py index c2e73882..1b62c311 100644 --- a/IM/connectors/OpenStack.py +++ b/IM/connectors/OpenStack.py @@ -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) @@ -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): """