Skip to content

Commit

Permalink
Merge branch 'devel' of github.com:grycap/im into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed May 29, 2024
2 parents 998bacd + 1505e60 commit 529e011
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions IM/connectors/Kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion IM/connectors/OpenStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_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)
Expand Down
14 changes: 7 additions & 7 deletions IM/tosca/Tosca.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
8 changes: 5 additions & 3 deletions test/unit/connectors/OpenStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'}]})
Expand Down

0 comments on commit 529e011

Please sign in to comment.