def setmem(vm_, memory, config=False):
    if vm_state(vm_) != 'shutdown':
        return False

    dom = _get_domain(vm_)

    # libvirt has a funny bitwise system for the flags in that the flag
    # to affect the "current" setting is 0, which means that to set the
    # current setting we have to call it a second time with just 0 set
    flags = libvirt.VIR_DOMAIN_MEM_MAXIMUM
    if config:
        flags = flags | libvirt.VIR_DOMAIN_AFFECT_CONFIG

    ret1 = dom.setMemoryFlags(memory * 1024, flags)
    ret2 = dom.setMemoryFlags(memory * 1024, libvirt.VIR_DOMAIN_AFFECT_CURRENT)

    # return True if both calls succeeded
    return ret1 == ret2 == 0
Test that proxy connections do not have TCP_NODELAY turned on
dataset/ETHPy150Open saltstack/salt/salt/modules/virt.py/setmem--crossover with--dataset/ETHPy150Open shazow/urllib3/test/with_dummyserver/test_proxy_poolmanager.py/TestHTTPProxyManager.test_nagle_proxy