From 10c8efa8217ba42dea14cd82441a7d733c0a86c9 Mon Sep 17 00:00:00 2001 From: Anil-Kumar Vengalil Date: Wed, 23 Dec 2009 14:13:59 +0000 Subject: [PATCH] if the slice is renewed in the local aggregate, we have to make corresponding change in the remote aggregate too --- sfa/plc/slices.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sfa/plc/slices.py b/sfa/plc/slices.py index c001c3c9..e6164442 100644 --- a/sfa/plc/slices.py +++ b/sfa/plc/slices.py @@ -373,7 +373,7 @@ class Slices(SimpleStorage): slicename = hrn_to_pl_slicename(slice_hrn) parts = slicename.split("_") login_base = parts[0] - slices = self.api.plshell.GetSlices(self.api.plauth, [slicename], ['slice_id', 'node_ids', 'site_id']) + slices = self.api.plshell.GetSlices(self.api.plauth, [slicename]) if not slices: slice_fields = {} slice_keys = ['name', 'url', 'description'] @@ -404,6 +404,8 @@ class Slices(SimpleStorage): slice = slices[0] slice_id = slice['slice_id'] site_id = slice['site_id'] + #the slice is alredy on the remote agg. Let us update(e.g. expires field) it with the latest info. + self.sync_slice(slice, slice_record, peer) slice['peer_slice_id'] = slice_record['pointer'] self.verify_persons(registry, credential, slice_record, site_id, remote_site_id, peer, sfa_peer) @@ -701,3 +703,11 @@ class Slices(SimpleStorage): except: aggregates[aggregate].stop_slice(credential, hrn, request_hash) + def sync_slice(self, old_record, new_record, peer): + if old_record['expires'] != new_record['expires']: + if peer: + self.api.plshell.UnBindObjectFromPeer(self.api.plauth, 'slice', old_record['slice_id'], peer) + self.api.plshell.UpdateSlice(self.api.plauth, old_record['slice_id'], {'expires' : new_record['expires']}) + if peer: + self.api.plshell.BindObjectToPeer(self.api.plauth, 'slice', old_record['slice_id'], peer, old_record['peer_slice_id']) + return 1 -- 2.43.0