Ganeti Web Manager: RAM/CPU Quota should be based off running virtualmachines
completed by: CryptWizard
mentors: Peter Krenesky
Please make sure to submit your patch for this task and to take required notes for it in the OSUOSL issue tracker at http://code.osuosl.org/issues/2175 Required notes would include letting the community know you are working on the issue with a note in the tracker, any notes on progress or difficulties implementing, etc.
For help with this task, contact kreneskyp or ramereth in #ganeti-webmgr on Freenode.
Task description:
All quota values are currently based off of total virtual machines owned. This does not make sense as a load management standpoint since it's very likely that VMs will be created, but not running. E.g. someone doing support testing will be bringing up VMs of different distros and shutting them down afterwards.
h3. required changes
* update *ClusterUser.used_resources()* to filter on *status='running'* This likely means that two queries must be used to generate this value as disk_space requires checking all vms.
* add a CPU/RAM quota check to *VirtualMachine.startup()*
* modify the quota check in *virtual_machines.py::create()* to:
** check running CPU/RAM only if start_immediately is enabled, depends on #909
** The error message for CPU/RAM should indicate that they can lower the resource amount or toggle the start vm option.