def delete(dom): """Delete given libvirt domain""" name = dom.name() if queries.get_vm_state(name) == 1: dom.destroy() dom.undefine() queries.delete_vm(name) res = 'VM {} was destroyed'.format(name) return res
def delete(name, **kwargs): """Delete given libvirt domain""" dom = defineDomain(name) if queries.get_vm_state(name) == 1: dom.destroy() mac = getMAC(name) queries.unAssignIP(mac) queries.delete_vm(name) manageBridges.delConfHost(mac) # send res = 'VM {} was destroyed'.format(name) dom.undefine() return res