Commit 43e810d2 by Dudás Ádám

vm: refactor old code and add some new bits

* reorder classes
* make context creator method a module level function
* class method for creating an instance from a template
* fix primary host selection code
* use timezone.now() instead of datetime.now() to get timezone aware dates
* remove obsolete methods and implementations (leaving TODOs)
parent fd75f6f9
...@@ -46,6 +46,15 @@ class Disk(TimeStampedModel): ...@@ -46,6 +46,15 @@ class Disk(TimeStampedModel):
verbose_name = _('disk') verbose_name = _('disk')
verbose_name_plural = _('disks') verbose_name_plural = _('disks')
def get_exculsive(self):
"""Get an instance of the disk for exclusive usage.
It might mean copying the disk, creating a snapshot or creating a
symbolic link to a read-only image.
"""
# TODO implement (or call) logic
return self
def to_json(self): def to_json(self):
self.base_name = self.base.name if self.base else None self.base_name = self.base.name if self.base else None
self.dir = self.datastore.path self.dir = self.datastore.path
......
from celery import task
@task
def create_instance_task(parameters):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment