def estimate_evacuate_timeout(session, host):
    """ Rough estimation of the evacuate uplimit based on live VMs memory """
    mref = session.xenapi.host.get_metrics(host)
    metrics = session.xenapi.host_metrics.get_record(mref)
    memory_used = int(metrics['memory_total']) - int(metrics['memory_free'])
    # Conservative estimation based on 1000Mbps link, and the memory usage of
    # Dom0 (which is not going to be transferred) is an intentional surplus
    return (memory_used * 8. / (1000. * 1024 * 1024))