From b084396bddd1e12a5e49ed4e9f1a2eafcbe8e01b Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Wed, 20 Mar 2013 15:25:10 -0700
Subject: [PATCH] client.py: throw error when reserved_space= is unparseable.
 Closes #1812.

This should now fail quickly (during "tahoe start"). Previously this
would silently treat an unparseable size as "0", and the only way to
discover that it had had a problem would be to look at the foolscap log,
or examine the storage-service web page for the unexpected "Reserved
Size" number.
---
 src/allmydata/client.py           | 2 +-
 src/allmydata/test/test_client.py | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/allmydata/client.py b/src/allmydata/client.py
index ad804248..23ca8b3d 100644
--- a/src/allmydata/client.py
+++ b/src/allmydata/client.py
@@ -257,12 +257,12 @@ class Client(node.Node, pollmixin.PollMixin):
         storedir = os.path.join(self.basedir, self.STOREDIR)
 
         data = self.get_config("storage", "reserved_space", None)
-        reserved = None
         try:
             reserved = parse_abbreviated_size(data)
         except ValueError:
             log.msg("[storage]reserved_space= contains unparseable value %s"
                     % data)
+            raise
         if reserved is None:
             reserved = 0
         discard = self.get_config("storage", "debug_discard", False,
diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py
index ec713abc..61d08603 100644
--- a/src/allmydata/test/test_client.py
+++ b/src/allmydata/test/test_client.py
@@ -132,8 +132,7 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase):
                            "[storage]\n" + \
                            "enabled = true\n" + \
                            "reserved_space = bogus\n")
-        c = client.Client(basedir)
-        self.failUnlessEqual(c.getServiceNamed("storage").reserved_space, 0)
+        self.failUnlessRaises(ValueError, client.Client, basedir)
 
     def _permute(self, sb, key):
         return [ s.get_longname() for s in sb.get_servers_for_psi(key) ]
-- 
2.45.2