Commit e19eaa8e by Dudás Ádám

vm: operation for removing a network interface from a VM

parent c7920a85
...@@ -144,7 +144,6 @@ class Interface(Model): ...@@ -144,7 +144,6 @@ class Interface(Model):
queue=queue_name).get() queue=queue_name).get()
def destroy(self): def destroy(self):
self.shutdown()
if self.host is not None: if self.host is not None:
self.host.delete() self.host.delete()
......
...@@ -131,6 +131,7 @@ class DestroyOperation(InstanceOperation): ...@@ -131,6 +131,7 @@ class DestroyOperation(InstanceOperation):
if self.instance.node: if self.instance.node:
# Destroy networks # Destroy networks
with activity.sub_activity('destroying_net'): with activity.sub_activity('destroying_net'):
self.instance.shutdown_net()
self.instance.destroy_net() self.instance.destroy_net()
# Delete virtual machine # Delete virtual machine
...@@ -201,6 +202,23 @@ class RebootOperation(InstanceOperation): ...@@ -201,6 +202,23 @@ class RebootOperation(InstanceOperation):
register_instance_operation(RebootOperation) register_instance_operation(RebootOperation)
class RemoveInterfaceOperation(InstanceOperation):
activity_code_suffix = 'remove_interface'
id = 'remove_interface'
name = _("remove interface")
description = _("Remove the specified network interface from the VM.")
def _operation(self, activity, user, system, interface):
if self.instance.is_running:
interface.shutdown()
interface.destroy()
interface.delete()
register_instance_operation(RemoveInterfaceOperation)
class ResetOperation(InstanceOperation): class ResetOperation(InstanceOperation):
activity_code_suffix = 'reset' activity_code_suffix = 'reset'
id = 'reset' id = 'reset'
......
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