From 8767f8c7bd592f4556b29e2816971714acf44110 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 28 May 2024 12:05:28 +0200 Subject: [PATCH 1/4] Add error msg --- IM/connectors/Kubernetes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/IM/connectors/Kubernetes.py b/IM/connectors/Kubernetes.py index b55e908a..fa1512ed 100644 --- a/IM/connectors/Kubernetes.py +++ b/IM/connectors/Kubernetes.py @@ -269,6 +269,7 @@ def _create_volumes(self, namespace, system, pod_name, auth_data): res.append((name, disk_size, disk_mount_path)) else: self.log_error("Error creating PersistentVolumeClaim:" + name) + self.error_messages += "Error creating PersistentVolumeClaim for pod %s" % name cont += 1 From 80ebf91d772024b0cdf803e64c9934f70c223875 Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 28 May 2024 12:05:43 +0200 Subject: [PATCH 2/4] Set own endpoint last --- IM/tosca/Tosca.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/IM/tosca/Tosca.py b/IM/tosca/Tosca.py index e3dcf6bd..1a01449c 100644 --- a/IM/tosca/Tosca.py +++ b/IM/tosca/Tosca.py @@ -468,13 +468,7 @@ def _get_node_endpoints(self, node, nodetemplates): """ Get all endpoint associated with a node """ endpoints = [] - # First add its own endpoints - node_caps = node.get_capabilities() - if node_caps: - if "endpoint" in node_caps and node_caps["endpoint"]: - endpoints.append(node_caps["endpoint"]) - - # Now other hosted nodes ones + # First add hosted nodes ones for other_node in nodetemplates: root_type = Tosca._get_root_parent_type(other_node).type compute = None @@ -489,6 +483,12 @@ def _get_node_endpoints(self, node, nodetemplates): if root_type == "tosca.capabilities.Endpoint": endpoints.append(cap) + # Then add its own endpoints + node_caps = node.get_capabilities() + if node_caps: + if "endpoint" in node_caps and node_caps["endpoint"]: + endpoints.append(node_caps["endpoint"]) + return endpoints def _add_node_nets(self, node, radl, system, nodetemplates): From e8cff1047138915fbbbb981ffc9ca0db94b7d7da Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 28 May 2024 15:42:20 +0200 Subject: [PATCH 3/4] Fix ipv6 management in ost --- IM/connectors/OpenStack.py | 5 ++++- test/unit/connectors/OpenStack.py | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/IM/connectors/OpenStack.py b/IM/connectors/OpenStack.py index 1b62c311..c015acda 100644 --- a/IM/connectors/OpenStack.py +++ b/IM/connectors/OpenStack.py @@ -727,7 +727,10 @@ def setIPsFromInstance(self, vm, node): for net_name, ips in node.extra['addresses'].items(): for ipo in ips: ip = ipo['addr'] - is_private = any([IPAddress(ip) in IPNetwork(mask) for mask in Config.PRIVATE_NET_MASKS]) + if IPAddress(ip).version == 4: + is_private = any([IPAddress(ip) in IPNetwork(mask) for mask in Config.PRIVATE_NET_MASKS]) + else: + is_private = IPAddress(ip).is_private() if 'OS-EXT-IPS:type' in ipo and ipo['OS-EXT-IPS:type'] == 'floating': ip_net_map[ip] = (None, not is_private) diff --git a/test/unit/connectors/OpenStack.py b/test/unit/connectors/OpenStack.py index 9228edee..70c693ff 100644 --- a/test/unit/connectors/OpenStack.py +++ b/test/unit/connectors/OpenStack.py @@ -404,9 +404,10 @@ def test_30_updateVMInfo(self, request, get_driver): node.id = "1" node.state = "running" node.extra = {'flavorId': 'small', 'volumes_attached': [{'id': 'vol0'}, {'id': 'vol1'}], - 'addresses': {'os-lan': [{'addr': '10.0.0.1', 'OS-EXT-IPS:type': 'fixed'}], + 'addresses': {'os-lan': [{'addr': '10.0.0.1', 'OS-EXT-IPS:type': 'fixed'}, + {'addr': 'fd8c:8d88:f133:71::24d', 'OS-EXT-IPS:type': 'fixed'}], 'public': [{'version': '4', 'addr': '8.8.8.8'}, - {'version': '6', 'addr': 'fec0:4801:7808:52:16:3eff:fe6e:b7e2'}]}} + {'version': '6', 'addr': '::ffff:808:808'}]}} node.public_ips = [] node.private_ips = ['10.0.0.1'] node.driver = driver @@ -466,8 +467,9 @@ def test_30_updateVMInfo(self, request, get_driver): self.assertTrue(success, msg="ERROR: updating VM info.") self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ip"), "8.8.8.8") - self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ipv6"), "fec0:4801:7808:52:16:3eff:fe6e:b7e2") + self.assertEqual(vm.info.systems[0].getValue("net_interface.0.ipv6"), "::ffff:808:808") self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ip"), "10.0.0.1") + self.assertEqual(vm.info.systems[0].getValue("net_interface.1.ipv6"), "fd8c:8d88:f133:71::24d") self.assertEqual(driver.ex_update_subnet.call_args_list[0][0][0].id, "subnet1") self.assertEqual(driver.ex_update_subnet.call_args_list[0][1], {'host_routes': [{'nexthop': '10.0.0.1', 'destination': '10.0.0.0/16'}]}) From 1505e6074453f63208225c820a058d85d291dbae Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 28 May 2024 15:55:36 +0200 Subject: [PATCH 4/4] Fix ipv6 management in ost --- IM/connectors/OpenStack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IM/connectors/OpenStack.py b/IM/connectors/OpenStack.py index c015acda..67982cfe 100644 --- a/IM/connectors/OpenStack.py +++ b/IM/connectors/OpenStack.py @@ -730,7 +730,7 @@ def setIPsFromInstance(self, vm, node): if IPAddress(ip).version == 4: is_private = any([IPAddress(ip) in IPNetwork(mask) for mask in Config.PRIVATE_NET_MASKS]) else: - is_private = IPAddress(ip).is_private() + is_private = IPAddress(ip).is_ipv6_unique_local() if 'OS-EXT-IPS:type' in ipo and ipo['OS-EXT-IPS:type'] == 'floating': ip_net_map[ip] = (None, not is_private)