Revision 99667854 snf-cyclades-app/synnefo/quotas/__init__.py

b/snf-cyclades-app/synnefo/quotas/__init__.py
131 131
    source = resource.project
132 132

  
133 133
    qh = Quotaholder.get()
134
    if True:  # placeholder
134
    if action == "REASSIGN":
135
        try:
136
            from_project = action_fields["from_project"]
137
            to_project = action_fields["to_project"]
138
        except KeyError:
139
            raise Exception("Missing project attribute.")
140

  
141
        projects = [from_project, to_project]
142
        with AstakosClientExceptionHandler(user=user, projects=projects):
143
            serial = qh.issue_resource_reassignment(user,
144
                                                    from_project, to_project,
145
                                                    provisions, name=name,
146
                                                    force=force,
147
                                                    auto_accept=auto_accept)
148
    else:
135 149
        with AstakosClientExceptionHandler(user=user, projects=[source]):
136 150
            serial = qh.issue_one_commission(user, source,
137 151
                                             provisions, name=name,
......
352 366
            ram = beparams.get("maxmem", flavor.ram)
353 367
            return {"cyclades.total_cpu": cpu - flavor.cpu,
354 368
                    "cyclades.total_ram": 1048576 * (ram - flavor.ram)}
369
        elif action == "REASSIGN":
370
            if resource.operstate in ["STARTED", "BUILD", "ERROR"]:
371
                resources.update(online_resources)
372
            return resources
355 373
        else:
356 374
            #["CONNECT", "DISCONNECT", "SET_FIREWALL_PROFILE"]:
357 375
            return None
......
361 379
            return resources
362 380
        elif action == "DESTROY":
363 381
            return reverse_quantities(resources)
382
        elif action == "REASSIGN":
383
            return resources
364 384
    elif isinstance(resource, IPAddress):
365 385
        if resource.floating_ip:
366 386
            resources = {"cyclades.floating_ip": 1}
......
368 388
                return resources
369 389
            elif action == "DESTROY":
370 390
                return reverse_quantities(resources)
391
            elif action == "REASSIGN":
392
                return resources
371 393
        else:
372 394
            return None
373 395

  

Also available in: Unified diff