Commit 3e3e5bb4 by Dudás Ádám

vm: rearrange methods

parent db51287a
...@@ -93,18 +93,6 @@ class Interface(Model): ...@@ -93,18 +93,6 @@ class Interface(Model):
'managed': self.host is not None 'managed': self.host is not None
} }
def deploy(self, user=None, task_uuid=None):
net_tasks.create.apply_async(
args=[self.get_vmnetwork_desc()],
queue=self.instance.get_remote_queue_name('net'))
def destroy(self, delete_host=True, user=None, task_uuid=None):
net_tasks.destroy.apply_async(
args=[self.get_vmnetwork_desc()],
queue=self.instance.get_remote_queue_name('net'))
if delete_host and self.host is not None:
self.host.delete()
@classmethod @classmethod
def create(cls, instance, vlan, managed, owner=None, base_activity=None): def create(cls, instance, vlan, managed, owner=None, base_activity=None):
"""Create a new interface for a VM instance to the specified VLAN. """Create a new interface for a VM instance to the specified VLAN.
...@@ -149,6 +137,18 @@ class Interface(Model): ...@@ -149,6 +137,18 @@ class Interface(Model):
iface.save() iface.save()
return iface return iface
def deploy(self, user=None, task_uuid=None):
net_tasks.create.apply_async(
args=[self.get_vmnetwork_desc()],
queue=self.instance.get_remote_queue_name('net'))
def destroy(self, delete_host=True, user=None, task_uuid=None):
net_tasks.destroy.apply_async(
args=[self.get_vmnetwork_desc()],
queue=self.instance.get_remote_queue_name('net'))
if delete_host and self.host is not None:
self.host.delete()
def save_as_template(self, instance_template): def save_as_template(self, instance_template):
"""Create a template based on this interface. """Create a template based on this interface.
""" """
......
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