Ejemplo n.º 1
0
    def __init__(self):
        self.api_version = self.API_VERSION
        self.service_name = None

        # fake cluster instead on Nova CDM
        self.fake_cdmc = faker_cluster_state.FakerModelCollector()

        self.publisher_id = 'test_publisher_id'
        self.conductor_topic = 'test_conductor_topic'
        self.status_topic = 'test_status_topic'
        self.notification_topics = ['nova']

        self.conductor_endpoints = []  # Disable audit endpoint
        self.status_endpoints = []

        self.notification_endpoints = [
            novanotification.ServiceUpdated(self.fake_cdmc),
            novanotification.InstanceCreated(self.fake_cdmc),
            novanotification.InstanceUpdated(self.fake_cdmc),
            novanotification.InstanceDeletedEnd(self.fake_cdmc),
            novanotification.LegacyInstanceCreatedEnd(self.fake_cdmc),
            novanotification.LegacyInstanceUpdated(self.fake_cdmc),
            novanotification.LegacyLiveMigratedEnd(self.fake_cdmc),
            novanotification.LegacyInstanceDeletedEnd(self.fake_cdmc),
        ]
Ejemplo n.º 2
0
 def notification_endpoints(self):
     return [
         novanotification.ServiceUpdated(self.fake_cdmc),
         novanotification.InstanceCreated(self.fake_cdmc),
         novanotification.InstanceUpdated(self.fake_cdmc),
         novanotification.InstanceDeletedEnd(self.fake_cdmc),
         novanotification.LegacyInstanceCreatedEnd(self.fake_cdmc),
         novanotification.LegacyInstanceUpdated(self.fake_cdmc),
         novanotification.LegacyLiveMigratedEnd(self.fake_cdmc),
         novanotification.LegacyInstanceDeletedEnd(self.fake_cdmc),
     ]
Ejemplo n.º 3
0
    def notification_endpoints(self):
        """Associated notification endpoints

        :return: Associated notification endpoints
        :rtype: List of :py:class:`~.EventsNotificationEndpoint` instances
        """
        return [
            nova.ServiceUpdated(self),
            nova.InstanceCreated(self),
            nova.InstanceUpdated(self),
            nova.InstanceDeletedEnd(self),
            nova.LegacyInstanceCreatedEnd(self),
            nova.LegacyInstanceUpdated(self),
            nova.LegacyInstanceDeletedEnd(self),
            nova.LegacyLiveMigratedEnd(self),
        ]
Ejemplo n.º 4
0
    def test_legacy_live_migrated_end(self):
        compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes()
        self.fake_cdmc.cluster_data_model = compute_model
        handler = novanotification.LegacyLiveMigratedEnd(self.fake_cdmc)

        instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc'
        instance0 = compute_model.get_instance_by_uuid(instance0_uuid)

        node = compute_model.get_node_by_instance_uuid(instance0_uuid)
        self.assertEqual('Node_0', node.uuid)

        message = self.load_message(
            'scenario3_legacy_livemigration-post-dest-end.json')
        handler.info(
            ctxt=self.context,
            publisher_id=message['publisher_id'],
            event_type=message['event_type'],
            payload=message['payload'],
            metadata=self.FAKE_METADATA,
        )
        node = compute_model.get_node_by_instance_uuid(instance0_uuid)
        self.assertEqual('Node_1', node.uuid)
        self.assertEqual(element.InstanceState.ACTIVE.value, instance0.state)