blob: 097f0f767414b77d26525d3fe09e9b1e3b7163e7 [file] [log] [blame]
Tony Mackbdb188a2014-04-01 20:24:47 -04001from core.models import Sliver, SliceDeployments
Tony Mack387a73f2013-09-18 07:59:14 -04002from observer.deleter import Deleter
3
4class SliverDeleter(Deleter):
5 model='Sliver'
6
7 def call(self, pk):
8 sliver = Sliver.objects.get(pk=pk)
9 if sliver.instance_id:
Tony Mackbdb188a2014-04-01 20:24:47 -040010 driver = self.driver.client_driver(caller=sliver.creator,
11 tenant=sliver.slice.name,
12 deployment=sliver.deploymentNetwork.name)
13 driver.destroy_instance(sliver.instance_id)
Tony Mack387a73f2013-09-18 07:59:14 -040014 sliver.delete()