Revision 686
Added by Borja Sotomayor over 14 years ago
lease_scheduler.py | ||
---|---|---|
331 | 331 |
# If a lease is active, that means we have to shut down its VMs to cancel it. |
332 | 332 |
self.logger.info("Lease %i is active. Stopping active reservation..." % lease.id) |
333 | 333 |
vmrr = lease.get_active_vmrrs(time)[0] |
334 |
self._handle_end_rr(vmrr) |
|
334 | 335 |
self.vm_scheduler._handle_unscheduled_end_vm(lease, vmrr) |
336 |
|
|
337 |
# Force machines to shut down |
|
338 |
try: |
|
339 |
self.vm_scheduler.resourcepool.stop_vms(lease, vmrr) |
|
340 |
except EnactmentError, exc: |
|
341 |
self.logger.error("Enactment error when shutting down VMs.") |
|
342 |
# Right now, this is a non-recoverable error, so we just |
|
343 |
# propagate it upwards. |
|
344 |
# In the future, it may be possible to react to these |
|
345 |
# kind of errors. |
|
346 |
raise |
|
335 | 347 |
|
336 | 348 |
elif lease_state in [Lease.STATE_SCHEDULED, Lease.STATE_SUSPENDED_SCHEDULED, Lease.STATE_READY, Lease.STATE_RESUMED_READY]: |
337 | 349 |
# If a lease is scheduled or ready, we just need to cancel all future reservations |
Also available in: Unified diff
Fixed bug where VM RRs in a cancelled lease were not being properly finalized (they were not being removed from the slot table, which caused trouble).
Also, Haizea was not sending shutdown commands to OpenNebula after a cancelled lease.