Revision 3af1fb4b
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 |
b/snf-cyclades-app/synnefo/logic/utils.py | ||
---|---|---|
152 | 152 |
|
153 | 153 |
OPCODE_TO_ACTION = { |
154 | 154 |
"OP_INSTANCE_CREATE": "BUILD", |
155 |
"OP_INSTANCE_START": "START", |
|
156 |
"OP_INSTANCE_STOP": "STOP",
|
|
155 |
"OP_INSTANCE_STARTUP": "START",
|
|
156 |
"OP_INSTANCE_SHUTDOWN": "STOP",
|
|
157 | 157 |
"OP_INSTANCE_REBOOT": "REBOOT", |
158 | 158 |
"OP_INSTANCE_REMOVE": "DESTROY"} |
159 | 159 |
|
b/snf-cyclades-app/synnefo/quotas/__init__.py | ||
---|---|---|
164 | 164 |
with AstakosClientExceptionHandler(): |
165 | 165 |
response = qh.resolve_commissions(accept, reject) |
166 | 166 |
|
167 |
# Update correspodning entries in DB |
|
168 |
QuotaHolderSerial.objects.filter(serial__in=accept).update(accept=True, |
|
169 |
pending=False, |
|
170 |
resolved=True) |
|
171 |
QuotaHolderSerial.objects.filter(serial__in=reject).update(accept=False, |
|
172 |
pending=False, |
|
173 |
resolved=True) |
|
174 |
|
|
167 | 175 |
if strict: |
168 | 176 |
failed = response["failed"] |
169 | 177 |
if failed: |
Also available in: Unified diff