| from netaddr import IPAddress, IPNetwork |
| from django.db.models import F, Q |
| from planetstack.config import Config |
| from observer.openstacksyncstep import OpenStackSyncStep |
| from core.models.slice import Slice, ControllerSlice |
| from util.logger import Logger, logging |
| from observer.steps.sync_controller_slices import * |
| logger = Logger(level=logging.INFO) |
| class SyncSlices(OpenStackSyncStep): |
| def sync_record(self, slice): |
| for controller_slice in ControllerSlice.objects.filter(slice=slice): |
| # bump the 'updated' timestamp and trigger observer to update |
| # slice across all controllers |
| def delete_record(self, slice): |
| controller_slice_deleter = SyncControllerSlice().delete_record |
| for controller_slice in ControllerSlice.objects.filter(slice=slice): |
| controller_slice_deleter(controller_slice) |
| logger.log_exc("Failed to delete controller_slice %s" % controller_slice) |