diff --git a/IM/connectors/EGI.py b/IM/connectors/EGI.py index d6d1213f1..d871311b5 100644 --- a/IM/connectors/EGI.py +++ b/IM/connectors/EGI.py @@ -114,6 +114,7 @@ def concrete_system(self, radl_system, str_url, auth_data): url = urlparse(str_url) protocol = url[0] src_host = url[1].split(':')[0] + vo = url[4] if protocol in ["ost", "appdb"] and self.cloud.server and not self.cloud.protocol: site_host = "" @@ -130,6 +131,16 @@ def concrete_system(self, radl_system, str_url, auth_data): (protocol == "appdb" and src_host == self.cloud.server)): driver = self.get_driver(auth_data) + # In AppDB case also check the vo name, if set in the url + if protocol == "appdb" and vo: + auths = auth_data.getAuthInfo(self.type, self.cloud.server) + if not auths: + raise Exception("No auth data has been specified to EGI.") + else: + auth = self.get_egi_auth(auths) + if auth['vo'] != vo: + return None + res_system = radl_system.clone() instance_type = self.get_instance_type(driver, res_system) self.update_system_info_from_instance(res_system, instance_type) diff --git a/test/unit/connectors/EGI.py b/test/unit/connectors/EGI.py index c672470b2..5cd097ad8 100644 --- a/test/unit/connectors/EGI.py +++ b/test/unit/connectors/EGI.py @@ -109,6 +109,16 @@ def test_10_concrete(self, appdb, get_driver): self.assertEqual(concrete[0].getValue("instance_type"), "small") self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) + radl_system.setValue('disk.0.image.url', 'appdb://CESGA/image_apc_name?vo_name') + concrete = egi_cloud.concreteSystem(radl_system, auth) + self.assertEqual(len(concrete), 0) + self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) + + radl_system.setValue('disk.0.image.url', 'appdb://CESGA/image_apc_name?vo.access.egi.eu') + concrete = egi_cloud.concreteSystem(radl_system, auth) + self.assertEqual(len(concrete), 1) + self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue()) + def create_node(self, **kwargs): """ Create VMs returning error only first time