def shutdown_baadal(): logger.info('Starting Baadal Shutdown') update_constant('baadal_status', BAADAL_STATUS_DOWN_IN_PROGRESS) current.db.commit() vms = current.db( current.db.vm_data.status.belongs( current.VM_STATUS_RUNNING, current.VM_STATUS_SUSPENDED)).select() # pool = ThreadPool(THREAD_POOL_COUNT) for vm_detail in vms: snapshot_and_destroy(vm_detail.id, vm_detail.vm_identity, vm_detail.status) current.db.vm_event_log.insert(vm_id=vm_detail.id, attribute='VM Status', requester_id=-1, old_value=vm_detail.status, new_value='System Shutdown') current.db.commit() # pool.add_task(snapshot_and_suspend, vm_detail.id, vm_detail.vm_identity) # pool.wait_completion() update_constant('baadal_status', BAADAL_STATUS_DOWN) current.db.commit()
def bootup_baadal(): logger.info('Starting Baadal Bootup') update_constant('baadal_status', BAADAL_STATUS_UP_IN_PROGRESS) current.db.commit() # pool = ThreadPool(THREAD_POOL_COUNT) vms = current.db(~current.db.vm_data.status.belongs(current.VM_STATUS_UNKNOWN, current.VM_STATUS_IN_QUEUE)).select() for vm_detail in vms: revert_and_resume(vm_detail.id, vm_detail.vm_identity) # pool.add_task(revert_and_delete_snapshot, vm_detail.id, vm_detail.vm_identity, sys_snapshot.id, sys_snapshot.snapshot_name) # pool.wait_completion() update_constant('baadal_status', BAADAL_STATUS_UP) current.db.commit()
def bootup_baadal(): logger.info('Starting Baadal Bootup') update_constant('baadal_status', BAADAL_STATUS_UP_IN_PROGRESS) current.db.commit() # pool = ThreadPool(THREAD_POOL_COUNT) vms = current.db(~current.db.vm_data.status.belongs( current.VM_STATUS_UNKNOWN, current.VM_STATUS_IN_QUEUE)).select() for vm_detail in vms: revert_and_resume(vm_detail.id, vm_detail.vm_identity) # pool.add_task(revert_and_delete_snapshot, vm_detail.id, vm_detail.vm_identity, sys_snapshot.id, sys_snapshot.snapshot_name) # pool.wait_completion() update_constant('baadal_status', BAADAL_STATUS_UP) current.db.commit()
def shutdown_baadal(): logger.info('Starting Baadal Shutdown') update_constant('baadal_status', BAADAL_STATUS_DOWN_IN_PROGRESS) current.db.commit() vms = current.db(current.db.vm_data.status.belongs(current.VM_STATUS_RUNNING, current.VM_STATUS_SUSPENDED)).select() # pool = ThreadPool(THREAD_POOL_COUNT) for vm_detail in vms: snapshot_and_destroy(vm_detail.id, vm_detail.vm_identity, vm_detail.status) current.db.vm_event_log.insert(vm_id = vm_detail.id, attribute = 'VM Status', requester_id = -1, old_value = vm_detail.status, new_value = 'System Shutdown') current.db.commit() # pool.add_task(snapshot_and_suspend, vm_detail.id, vm_detail.vm_identity) # pool.wait_completion() update_constant('baadal_status', BAADAL_STATUS_DOWN) current.db.commit()