def shutdown_vm(conn, uuid): # XXX hack for OpenVZ because of a bad libvirt driver if conn.getType() == 'OpenVZ': openvz.shutdown_vm(conn, uuid) else: dom = conn.lookupByUUIDString(uuid) dom.shutdown() try : time.sleep(5*60) dom.destroy() except libvirt.libvirtError as e: logging.error("Got libvirt exception when trying to force shutdown %s. Error code %s" % (uuid, e.get_error_code()))
def shutdown_vm(conn, uuid): # XXX hack for OpenVZ because of a bad libvirt driver if conn.getType() == 'OpenVZ': openvz.shutdown_vm(conn, uuid) else: dom = conn.lookupByUUIDString(uuid) dom.shutdown() try: time.sleep(5 * 60) dom.destroy() except libvirt.libvirtError as e: logging.error( "Got libvirt exception when trying to force shutdown %s. Error code %s" % (uuid, e.get_error_code()))