From 88af6377a1f128ed77821579eed45abe15865523 Mon Sep 17 00:00:00 2001 From: Hannes Hansen Date: Tue, 16 Oct 2018 14:39:42 +0200 Subject: [PATCH] Core & Internals: Added properties to add_rse; Fix #1646 --- lib/rucio/api/rse.py | 8 ++++++-- lib/rucio/client/rseclient.py | 3 +++ lib/rucio/core/rse.py | 11 +++++++++-- lib/rucio/web/rest/flaskapi/v1/rse.py | 6 +++++- lib/rucio/web/rest/webpy/v1/rse.py | 3 ++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/rucio/api/rse.py b/lib/rucio/api/rse.py index 6906159523..c59afc6edf 100644 --- a/lib/rucio/api/rse.py +++ b/lib/rucio/api/rse.py @@ -25,7 +25,7 @@ def add_rse(rse, issuer, deterministic=True, volatile=False, city=None, region_code=None, country_name=None, continent=None, time_zone=None, ISP=None, - staging_area=False): + staging_area=False, type=None, latitude=None, longitude=None): """ Creates a new Rucio Storage Element(RSE). @@ -40,6 +40,9 @@ def add_rse(rse, issuer, deterministic=True, volatile=False, city=None, region_c :param time_zone: Timezone. :param staging_area: staging area. :param ISP: Internet service provider. + :param type: RSE type. + :param latitude: GPS latitude. + :param longitude: GPS longitude. """ validate_schema(name='rse', obj=rse) kwargs = {'rse': rse} @@ -48,7 +51,8 @@ def add_rse(rse, issuer, deterministic=True, volatile=False, city=None, region_c return rse_module.add_rse(rse, deterministic=deterministic, volatile=volatile, city=city, region_code=region_code, country_name=country_name, staging_area=staging_area, - continent=continent, time_zone=time_zone, ISP=ISP) + continent=continent, time_zone=time_zone, ISP=ISP, type=type, latitude=latitude, + longitude=longitude) def get_rse(rse): diff --git a/lib/rucio/client/rseclient.py b/lib/rucio/client/rseclient.py index dffbbdee86..038d69bdba 100644 --- a/lib/rucio/client/rseclient.py +++ b/lib/rucio/client/rseclient.py @@ -78,6 +78,9 @@ def add_rse(self, rse, **kwargs): :param time_zone: Timezone. :param staging_area: Staging area. :param ISP: Internet service provider. + :param type: RSE type. + :param latitude: GPS latitude. + :param longitude: GPS longitude. :return: True if location was created successfully else False. :raises Duplicate: if rse already exists. diff --git a/lib/rucio/core/rse.py b/lib/rucio/core/rse.py index 0e0012a53b..41daa6da26 100644 --- a/lib/rucio/core/rse.py +++ b/lib/rucio/core/rse.py @@ -59,7 +59,7 @@ @transactional_session -def add_rse(rse, deterministic=True, volatile=False, city=None, region_code=None, country_name=None, continent=None, time_zone=None, ISP=None, staging_area=False, session=None): +def add_rse(rse, deterministic=True, volatile=False, city=None, region_code=None, country_name=None, continent=None, time_zone=None, ISP=None, staging_area=False, type=None, longitude=None, latitude=None, session=None): """ Add a rse with the given location name. @@ -73,11 +73,18 @@ def add_rse(rse, deterministic=True, volatile=False, city=None, region_code=None :param time_zone: Timezone. :param ISP: Internet service provider. :param staging_area: Staging area. + :param type: RSE type. + :param latitude: GPS latitude. + :param longitude: GPS longitude. :param session: The database session in use. """ + if isinstance(type, str) or isinstance(type, unicode): + type = RSEType.from_sym(type) + new_rse = models.RSE(rse=rse, deterministic=deterministic, volatile=volatile, city=city, region_code=region_code, country_name=country_name, - continent=continent, time_zone=time_zone, staging_area=staging_area, ISP=ISP, availability=7) + continent=continent, time_zone=time_zone, staging_area=staging_area, ISP=ISP, availability=7, + rse_type=type, latitude=latitude, longitude=longitude) try: new_rse.save(session=session) except IntegrityError: diff --git a/lib/rucio/web/rest/flaskapi/v1/rse.py b/lib/rucio/web/rest/flaskapi/v1/rse.py index 14b1c86f02..d1ab4491d8 100755 --- a/lib/rucio/web/rest/flaskapi/v1/rse.py +++ b/lib/rucio/web/rest/flaskapi/v1/rse.py @@ -101,6 +101,9 @@ def post(self, rse): :