def libvirt_get_kimchi_metadata_node(dom, mode="current"): FeatureTests.disable_libvirt_error_logging() try: xml = dom.metadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT, KIMCHI_META_URL, flags=get_vm_config_flag(dom, mode)) return etree.fromstring(xml) except libvirt.libvirtError: return None finally: FeatureTests.enable_libvirt_error_logging()
def _clean_leftovers(self): conn = self.conn.get() FeatureTests.disable_libvirt_error_logging() try: dom = conn.lookupByName(FEATURETEST_VM_NAME) dom.undefine() except Exception: # Any exception can be ignored here pass try: pool = conn.storagePoolLookupByName(FEATURETEST_POOL_NAME) pool.undefine() except Exception: # Any exception can be ignored here pass FeatureTests.enable_libvirt_error_logging()