def InstanceBalloonMemory(instance, memory):
  hyper = hypervisor.GetHypervisor(instance.hypervisor)
  running = hyper.ListInstances(hvparams=instance.hvparams)
  if instance.name not in running:
    logging.info("Instance %s is not running, cannot balloon", instance.name)
    return
  try:
    hyper.BalloonInstanceMemory(instance, memory)
  except errors.HypervisorError, err:
    _Fail("Failed to balloon instance memory: %s", err, exc=True)
Resize an instance's memory.
dataset/ETHPy150Open ganeti/ganeti/lib/backend.py/InstanceBalloonMemory