commit 7ed99da8da65ef3016ae241132fa909e89b423a6
Author: root <root@dev84.dev.grnet.gr>
Date:   Thu Sep 13 16:37:15 2012 +0300

    wip issue_commision(). no accept or reject yet

diff --git a/snf-pithos-backend/pithos/backends/modular.py b/snf-pithos-backend/pithos/backends/modular.py
index 6ca9ee7..7b48c8a 100644
--- a/snf-pithos-backend/pithos/backends/modular.py
+++ b/snf-pithos-backend/pithos/backends/modular.py
@@ -186,7 +186,9 @@ class ModularBackend(BaseBackend):
 
             self.queue = NoQueue()
 
-        self.quotaholder = QuotaholderHTTP('http://127.0.0.1/api/quotaholder/v')
+        self.quotaholder_url = quotaholder_url
+        self.quotaholder = QuotaholderHTTP(quotaholder_url)
+        self.serials = []
 
     def close(self):
         self.wrapper.close()
@@ -493,8 +495,8 @@ class ModularBackend(BaseBackend):
                 self.store.map_delete(h)
             self.node.node_purge_children(node, until, CLUSTER_DELETED)
             self._report_size_change(user, account, -size,
-            						 {'action':'container purge', 'path': path,
-            						  'versions': ','.join(str(i) for i in serials)})
+                                     {'action':'container purge', 'path': path,
+                                      'versions': serials})
             return
 
         if not delimiter:
@@ -507,9 +509,9 @@ class ModularBackend(BaseBackend):
             self.node.node_purge_children(node, inf, CLUSTER_DELETED)
             self.node.node_remove(node)
             self._report_size_change(user, account, -size,
-            						 {'action': 'container delete',
-            						  'path': path,
-            						  'versions': ','.join(str(i) for i in serials)})
+                                     {'action': 'container delete',
+                                      'path': path,
+                                      'versions': serials})
         else:
                 # remove only contents
             src_names = self._list_objects_no_limit(user, account, container, prefix='', delimiter=None, virtual=False, domain=None, keys=[], shared=False, until=None, size_range=None, all_props=True, public=False)
@@ -522,9 +524,8 @@ class ModularBackend(BaseBackend):
                     account, container, src_version_id)
                 if del_size:
                     self._report_size_change(user, account, -del_size,
-                    						 {'action': 'object delete',
-                    						  'path': path,
-                    						  'versions': ','.join([str(dest_version_id)])})
+                                             {'action': 'object delete',
+                                              'path': path, 'versions': [dest_version_id]})
                 self._report_object_change(
                     user, account, path, details={'action': 'object delete'})
                 paths.append(path)
@@ -815,8 +816,8 @@ class ModularBackend(BaseBackend):
                 # This must be executed in a transaction, so the version is never created if it fails.
                 raise QuotaError
         self._report_size_change(user, account, size_delta,
-        						 {'action': 'object update', 'path': path,
-        						  'versions': ','.join([str(dest_version_id)])})
+                                 {'action': 'object update', 'path': path,
+                                  'versions': [dest_version_id]})
 
         if permissions is not None:
             self.permissions.access_set(path, permissions)
@@ -947,8 +948,8 @@ class ModularBackend(BaseBackend):
             except NameError:
                 self.permissions.access_clear(path)
             self._report_size_change(user, account, -size,
-            						{'action': 'object purge', 'path': path,
-            						 'versions': ','.join(str(i) for i in serials)})
+                                    {'action': 'object purge', 'path': path,
+                                     'versions': serials})
             return
 
         path, node = self._lookup_object(account, container, name)
@@ -956,8 +957,8 @@ class ModularBackend(BaseBackend):
         del_size = self._apply_versioning(account, container, src_version_id)
         if del_size:
             self._report_size_change(user, account, -del_size,
-            						 {'action': 'object delete', 'path': path,
-            						  'versions': ','.join([str(dest_version_id)])})
+                                     {'action': 'object delete', 'path': path,
+                                      'versions': [dest_version_id]})
         self._report_object_change(
             user, account, path, details={'action': 'object delete'})
         self.permissions.access_clear(path)
@@ -974,9 +975,9 @@ class ModularBackend(BaseBackend):
                     account, container, src_version_id)
                 if del_size:
                     self._report_size_change(user, account, -del_size,
-                    						 {'action': 'object delete',
-                    						  'path': path,
-                    						  'versions': ','.join([str(dest_version_id)])})
+                                             {'action': 'object delete',
+                                              'path': path,
+                                              'versions': [dest_version_id]})
                 self._report_object_change(
                     user, account, path, details={'action': 'object delete'})
                 paths.append(path)
@@ -1234,11 +1235,18 @@ class ModularBackend(BaseBackend):
         logger.debug(
             "_report_size_change: %s %s %s %s", user, account, size, details)
         self.messages.append((QUEUE_MESSAGE_KEY_PREFIX % ('resource.diskspace',), 
-        					  account, QUEUE_INSTANCE_ID, 'diskspace',
-        					  float(size), details))
-
-        serial = self.quotaholder.issue_provision()
-        self.serial.append(serial)
+                              account, QUEUE_INSTANCE_ID, 'diskspace',
+                              float(size), details))
+
+        serial = self.quotaholder.issue_commission(
+                context     =   {},
+                target      =   account,
+                key         =   '1',
+                clientkey   =   'pithos',
+                ownerkey    =   '',
+                provisions  =   ()
+        )
+        self.serials.append(serial)
 
     def _report_object_change(self, user, account, path, details={}):
         details.update({'user': user})
