Revision 368d879e

b/snf-cyclades-app/synnefo/logic/backend.py
524 524

  
525 525
        # Issue commission
526 526
        if network.userid:
527
            quotas.issue_and_accept_commission(network, delete=True)
527
            quotas.issue_and_accept_commission(network, action="DESTROY")
528 528
            # the above has already saved the object and committed;
529 529
            # a second save would override others' changes, since the
530 530
            # object is now unlocked
b/snf-cyclades-app/synnefo/logic/ips.py
176 176
    floating_ip.deleted = True
177 177
    floating_ip.save()
178 178
    # Release quota for floating IP
179
    quotas.issue_and_accept_commission(floating_ip, delete=True)
179
    quotas.issue_and_accept_commission(floating_ip, action="DESTROY")
180 180
    transaction.commit()
181 181
    # Delete the floating IP from DB
182 182
    log.info("Deleted floating IP '%s' of user '%s", floating_ip,
b/snf-cyclades-app/synnefo/quotas/__init__.py
237 237

  
238 238

  
239 239
@transaction.commit_on_success
240
def issue_and_accept_commission(resource, delete=False):
240
def issue_and_accept_commission(resource, action="BUILD", action_fields=None):
241 241
    """Issue and accept a commission to Quotaholder.
242 242

  
243 243
    This function implements the Commission workflow, and must be called
......
250 250
    4) Accept commission to QH
251 251

  
252 252
    """
253
    action = "DESTROY" if delete else "BUILD"
254
    commission_reason = ("client: api, resource: %s, delete: %s"
255
                         % (resource, delete))
253
    commission_reason = ("client: api, resource: %s, action: %s"
254
                         % (resource, action))
256 255
    serial = handle_resource_commission(resource=resource, action=action,
256
                                        action_fields=action_fields,
257 257
                                        commission_name=commission_reason)
258 258

  
259 259
    # Mark the serial as one to accept and associate it with the resource

Also available in: Unified diff