From 70a14e4f7178655da40764657415d6ff8df2d8d1 Mon Sep 17 00:00:00 2001 From: Anil-Kumar Vengalil Date: Mon, 18 Jan 2010 14:30:42 +0000 Subject: [PATCH] if the site configuation (e.g. max_slices) is changed in the local aggregate, we update the site on the federated aggreages accordingly --- sfa/plc/slices.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sfa/plc/slices.py b/sfa/plc/slices.py index 18c75840..2918dc3b 100644 --- a/sfa/plc/slices.py +++ b/sfa/plc/slices.py @@ -252,6 +252,8 @@ class Slices(SimpleStorage): def verify_site(self, registry, credential, slice_hrn, peer, sfa_peer): + import pdb + pdb.set_trace() authority = get_authority(slice_hrn) authority_urn = hrn_to_urn(authority, 'authority') site_records = registry.resolve(credential, authority_urn) @@ -277,6 +279,9 @@ class Slices(SimpleStorage): else: site_id = sites[0]['site_id'] remote_site_id = sites[0]['peer_site_id'] + old_site = sites[0] + #the site is alredy on the remote agg. Let us update(e.g. max_slices field) it with the latest info. + self.sync_site(old_site, site, peer) return (site_id, remote_site_id) @@ -484,6 +489,15 @@ class Slices(SimpleStorage): return 1 + def sync_site(self, old_record, new_record, peer): + if old_record['max_slices'] != new_record['max_slices']: + if peer: + self.api.plshell.UnBindObjectFromPeer(self.api.plauth, 'site', old_record['site_id'], peer) + self.api.plshell.UpdateSite(self.api.plauth, old_record['site_id'], {'max_slices' : new_record['max_slices']}) + if peer: + self.api.plshell.BindObjectToPeer(self.api.plauth, 'site', old_record['site_id'], peer, old_record['peer_site_id']) + return 1 + def sync_slice(self, old_record, new_record, peer): if old_record['expires'] != new_record['expires']: if peer: -- 2.43.0