[Checkins] SVN: gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/ Getting rid of raid_add

Dirceu Pereira Tiegs dirceutiegs at gmail.com
Mon Aug 11 20:06:10 EDT 2008


Log message for revision 89684:
  Getting rid of raid_add

Changed:
  U   gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/scripts/controller.py
  U   gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py
  U   gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/tests/test_basics.py

-=-
Modified: gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/scripts/controller.py
===================================================================
--- gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/scripts/controller.py	2008-08-11 20:29:05 UTC (rev 89683)
+++ gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/scripts/controller.py	2008-08-12 00:06:08 UTC (rev 89684)
@@ -33,8 +33,6 @@
 
     disable <storage> -- Disable a storage
 
-    add <ip:port:storage> -- Add a storage
-
     reload </path/to/zeo.conf> -- Reload a specified zeo.conf file
 
 """
@@ -75,13 +73,6 @@
     def cmd_disable(self, storage):
         print self.raid.raid_disable(storage)
 
-    def cmd_add(self, storage):
-        try:
-            ip, port, storage = storage.split(':')
-            print self.raid.raid_add_storage(ip, port, storage)
-        except ValueError:
-            sys.exit("Usage: IP:PORT:STORAGE")
-
     def cmd_reload(self, path):
         print self.raid.raid_reload(path)
 
@@ -89,8 +80,7 @@
     usage = "usage: %prog [options] command [command-options]"
     description = ("Connect to a RAIDStorage on a ZEO server and perform "
                    "maintenance tasks. Available commands: status, details, "
-                   "recover <STORAGE>, disable <STORAGE>, add <IP:PORT:STORAGE>"
-                   "reload </PATH/TO/ZEO.CONF>")
+                   "recover <STORAGE>, disable <STORAGE>, reload </PATH/TO/ZEO.CONF>")
 
     parser = optparse.OptionParser(usage=usage, description=description)
     parser.add_option("-S", "--storage", default=storage,

Modified: gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py
===================================================================
--- gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py	2008-08-11 20:29:05 UTC (rev 89683)
+++ gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/storage.py	2008-08-12 00:06:08 UTC (rev 89684)
@@ -32,7 +32,6 @@
 import transaction
 import transaction.interfaces
 import ZODB.blob
-import ZODB.config
 from ZEO.runzeo import ZEOOptions
 
 import gocept.zeoraid.interfaces
@@ -57,20 +56,6 @@
     return check_writable
 
 
-class ZEOOpener(object):
-
-    def __init__(self, ip, port, name):
-        self.ip = ip
-        self.name = name
-        self.port = port
-
-    def open(self, **kwargs):
-        return ZODB.config.storageFromString("""<zeoclient>
-            server %s:%s
-            storage %s
-        </zeoclient>""" % (self.ip, self.port, self.name))
-
-
 class RAIDStorage(object):
     """The RAID storage is a drop-in replacement for the client storages that
     are configured.
@@ -541,7 +526,7 @@
         # This method isn't officially part of the interface but it is supported.
         methods = dict.fromkeys(
             ['raid_recover', 'raid_status', 'raid_disable', 'raid_details',
-            'raid_add_storage', 'raid_reload'])
+            'raid_reload'])
         return methods
 
     # IRAIDStorage
@@ -577,13 +562,7 @@
         t.start()
         return 'recovering %r' % (name,)
 
-    def raid_add_storage(self, ip, port, name):
-        self.openers[name] = ZEOOpener(ip, port, name)
-        self._open_storage(name)
-        self.storages_degraded.append(name)
-        self.raid_recover(name)
-        return 'added %s:%s:%s' % (ip, port, name)
-
+    @ensure_open_storage
     def raid_reload(self, path):
         s = ""
         options = ZEOOptions()

Modified: gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/tests/test_basics.py
===================================================================
--- gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/tests/test_basics.py	2008-08-11 20:29:05 UTC (rev 89683)
+++ gocept.zeoraid/branches/dirceu-addstoragetool/src/gocept/zeoraid/tests/test_basics.py	2008-08-12 00:06:08 UTC (rev 89684)
@@ -1187,7 +1187,6 @@
                                raid_disable=None,
                                raid_recover=None,
                                raid_status=None,
-                               raid_add_storage=None,
                                raid_reload=None),
                           methods)
 



More information about the Checkins mailing list