Revision 3af1fb4b snf-cyclades-app/synnefo/logic/backend.py

b/snf-cyclades-app/synnefo/logic/backend.py
145 145
        job_fields = {}
146 146

  
147 147
    new_operstate = None
148
    new_flavor = None
148 149
    state_for_success = VirtualMachine.OPER_STATE_FROM_OPCODE.get(opcode)
149 150

  
150 151
    if status == rapi.JOB_STATUS_SUCCESS:
......
155 156
        beparams = job_fields.get("beparams", None)
156 157
        if beparams:
157 158
            # Change the flavor of the VM
158
            _process_resize(vm, beparams)
159
            new_flavor = _process_resize(vm, beparams)
159 160

  
160 161
        # Update backendtime only for jobs that have been successfully
161 162
        # completed, since only these jobs update the state of the VM. Else a
......
203 204

  
204 205
    if new_operstate is not None:
205 206
        vm.operstate = new_operstate
207
    if new_flavor is not None:
208
        vm.flavor = new_flavor
206 209

  
207 210
    vm.save()
208 211

  
......
220 223
                                        disk_template=old_flavor.disk_template)
221 224
    except Flavor.DoesNotExist:
222 225
        raise Exception("Cannot find flavor for VM")
223
    vm.flavor = new_flavor
224
    vm.save()
226
    return new_flavor
225 227

  
226 228

  
227 229
@transaction.commit_on_success

Also available in: Unified diff