def destroy(self):
		with MutexStore.getObjectLock(self.getLockIdentifier()):

			if self.vms.all().count()>0:
				raise Exception("Cannot destroy a server which hosts VMs. Delete VMs first")
			
			#Delete associated interfaces
			for interface in self.networkInterfaces.all():
				interface.destroy()

			#Delete instance
			self.delete()
dataset/ETHPy150Open fp7-ofelia/ocf/vt_manager/src/python/vt_manager/models/VTServer.py/VTServer.destroy/original