def _all_domains_running(cif): doms = _get_vdsm_domains() + containersconnection.recovery() num_doms = len(doms) for idx, v in enumerate(doms): vm_id = v.UUIDString() vm_state = File(vm_id) if vm_state.load(cif): cif.log.info('recovery [1:%d/%d]: recovered domain %s', idx + 1, num_doms, vm_id) else: cif.log.info( 'recovery [1:%d/%d]: loose domain %s found, killing it.', idx + 1, num_doms, vm_id) try: v.destroy() except libvirt.libvirtError: cif.log.exception( 'recovery [1:%d/%d]: failed to kill loose domain %s', idx + 1, num_doms, vm_id)
def _all_domains_running(cif): doms = _get_vdsm_domains() + containersconnection.recovery() num_doms = len(doms) for idx, v in enumerate(doms): vm_id = v.UUIDString() vm_state = File(vm_id) if vm_state.load(cif): cif.log.info( 'recovery [1:%d/%d]: recovered domain %s', idx + 1, num_doms, vm_id) else: cif.log.info( 'recovery [1:%d/%d]: loose domain %s found, killing it.', idx + 1, num_doms, vm_id) try: v.destroy() except libvirt.libvirtError: cif.log.exception( 'recovery [1:%d/%d]: failed to kill loose domain %s', idx + 1, num_doms, vm_id)
def all_domains(cif): doms = _list_domains() + containersconnection.recovery() num_doms = len(doms) for idx, (dom_obj, dom_xml, external) in enumerate(doms): vm_id = dom_obj.UUIDString() if _recover_domain(cif, vm_id, dom_xml, external): cif.log.info('recovery [1:%d/%d]: recovered domain %s', idx + 1, num_doms, vm_id) elif external: cif.log.info("Failed to recover external domain: %s" % (vm_id, )) else: cif.log.info( 'recovery [1:%d/%d]: loose domain %s found, killing it.', idx + 1, num_doms, vm_id) try: dom_obj.destroy() except libvirt.libvirtError: cif.log.exception( 'recovery [1:%d/%d]: failed to kill loose domain %s', idx + 1, num_doms, vm_id)