From f053ba034efef11d4435feebdc84c8022a9e76b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Wed, 29 Apr 2009 14:39:04 +0000 Subject: [PATCH] guard RefreshPeer():sync() not to insert the same record twice. The problem is sync() inserts duplicated records, but when we try to insert into peer_* tables it fails for the second one. That creates strange problems like federated objects appear as local objects. We still need to find why sync is called with duplicated records but this patch should prevent the db problems. --- PLC/Methods/RefreshPeer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PLC/Methods/RefreshPeer.py b/PLC/Methods/RefreshPeer.py index 4d66a05..3d48cf2 100644 --- a/PLC/Methods/RefreshPeer.py +++ b/PLC/Methods/RefreshPeer.py @@ -124,6 +124,10 @@ class RefreshPeer(Method): for peer_object_id, peer_object in peer_objects.iteritems(): message_verbose ('DBG %s peer_object_id=%d (%d/%d)'%(classname,peer_object_id,count,total)) count += 1 + if peer_object_id in synced: + message("Warning: %s Skipping already added %s: %r"%( + peer['peername'], classname, peer_object)) + continue if classname == 'Node': message_verbose ('DBG>> hostname=%s'%peer_object['hostname']) elif classname == "Slice": -- 2.43.0