def setmem(vm_, memory, config=False):
 if (vm_state(vm_)[vm_] != 'shutdown'):
  return False
 dom = _get_domain(vm_)
 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 (ret1 == ret2 == 0)

def setmem ( vm_ , memory , config = False ) : if ( vm_state ( vm_ ) [ vm_ ] != 'shutdown' ) : return False dom = _get_domain ( vm_ ) 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 ( ret1 == ret2 == 0 )
change the amount of memory allocated to vm .