[Checkins] SVN: gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py Using the right options when reading the zeo.conf file

Dirceu Pereira Tiegs dirceutiegs at gmail.com
Thu Aug 7 20:43:30 EDT 2008


Log message for revision 89530:
  Using the right options when reading the zeo.conf file

Changed:
  U   gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py

-=-
Modified: gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py
===================================================================
--- gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py	2008-08-08 00:04:52 UTC (rev 89529)
+++ gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py	2008-08-08 00:43:30 UTC (rev 89530)
@@ -33,6 +33,7 @@
 import transaction.interfaces
 import ZODB.blob
 import ZODB.config
+from ZEO.runzeo import ZEOOptions
 
 import gocept.zeoraid.interfaces
 import gocept.zeoraid.recovery
@@ -585,13 +586,14 @@
 
     def raid_reload(self, path):
         s = ""
-        zeoconf = open(path, 'r').read()
-        temp_storage = ZODB.config.storageFromString(zeoconf)
-        storages_to_remove = [o for o in self.openers.items() if o[0] not in temp_storage.openers]
+        options = ZEOOptions()
+        options.realize(['-C',path])
+        new_storages = dict([(o.name,o) for o in options.storages[0].config.storages])
+        storages_to_remove = [o for o in self.openers.items() if o[0] not in new_storages]
         for storage in storages_to_remove:
             self.raid_disable(storage[0])
             s += "removed %s\n" % storage[0]
-        storages_to_add = [o for o in temp_storage.openers.items() if o[0] not in self.openers]
+        storages_to_add = [o for o in new_storages if o[0] not in self.openers]
         for storage in storages_to_add:
             name = storage[0]
             self.openers[name] = storage[1]
@@ -599,7 +601,6 @@
             self.storages_degraded.append(name)
             self.raid_recover(name)
             s += "added %s\n" % name
-        del temp_storage
         return s
 
     # internal



More information about the Checkins mailing list