« Previous | Next » 

Revision 41a7fae7


Added by Christos Stavrakakis almost 11 years ago

cyclades: Major refactor to api and logic apps

Major refactor to cyclades api and logic apps that removes most code
from the api views and moves it to logic app, so that the same logic
code can be used by different apps (e.g. EC2 API). Code is moved into

This commit also introduces the VirtualMachine.task attribute
which contains the last issued action to a server. This attribute is set
when the corresponding job is sent to Ganeti, and is cleared upon
completion of the corresponding job (task_job_id attribute). Until the
task is completed, no other action is allowed on the VM. The only
exception is 'DESTROY' action which is always allowed. Actions on VMs
with uncompleted tasks results in a bad request fault. Also, some
actions are not allowed if the operating state of the VM is not correct.
For example, it is not allowed to start or resize a running VM. The
running task is also exposed to the API (SNF:task_state), and the
available states are:

Also, this commit introduces two quotable resources, the 'active_ram'
and 'active_cpu' representing the ram and cpu of running instances,
specifically the instances in 'STARTED', 'BUILD' and 'ERROR' operstate.
In order to count quotas for these resources, commissioning is needed
when starting, stopping and rebooting instances. Also, the destroy
commissioning is different if the vm is running or is stopped.

Finally this commit changes the way commissioning is used in
snf-dispatcher. Until now dispatcher only accepted or rejected
commissions issued by the API. This commit introduces extra logic in
dispatcher, to issue commissions for every quotable change, if a
commission for this change has not already been issued by the API. This
enables the administrator to do whatever action in the Ganeti backend
without resulting in unsynced quotas. If a new commission is required,
the previous commission for the VM by the API (if existing) will be
rejected, since this commission will reflect a different change in the


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences