Revision 9a0a8eca

b/snf-pithos-app/pithos/api/management/commands/pithos-set-quota.py
91 91
            cluster=cluster))
92 92
    return statistics
93 93

  
94
def _get_verified_quota(statistics, default_quota=0):
94
def _get_verified_quota(statistics):
95 95
    """ Verify statistics and set quotaholder account quota """
96 96
    add_quota = []
97 97
    append = add_quota.append
......
110 110
            print e
111 111
            continue
112 112
        else:
113
            s = select([table['policy'].c.value])
114
            s = s.where(table['policy'].c.node == item.node)
115
            s = s.where(table['policy'].c.key == 'quota')
116
            policy = conn.execute(s).fetchone()
117
            capacity = policy.value if policy else 0
118
            if capacity:
119
                capacity -= default_quota
120 113
            append(AddQuotaPayload(
121 114
                holder=item.path,
122 115
                resource='pithos+.diskspace',
123 116
                key=ENTITY_KEY,
124 117
                quantity=db_item.size,
125
                capacity=capacity,
118
                capacity=0,
126 119
                import_limit=0,
127 120
                export_limit=0))
128 121
    return add_quota
......
146 139
            account_nodes = conn.execute(s).fetchall()
147 140
            
148 141
            # compute account statistics
149
            statistics = _compute_statistics(
150
                account_nodes, default_quota=backend.DEFAULT_QUOTA)
142
            statistics = _compute_statistics(account_nodes)
151 143

  
152 144
            # verify and send quota
153 145
            add_quota = _get_verified_quota(statistics)
146

  
154 147
            result = backend.quotaholder.add_quota(
155 148
                context={},
156 149
                clientkey='pithos',

Also available in: Unified diff