Esempio n. 1
0
    def test_nova_service_update(self):
        compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes()
        self.fake_cdmc.cluster_data_model = compute_model
        handler = novanotification.ServiceUpdated(self.fake_cdmc)

        node0_uuid = 'Node_0'
        node0 = compute_model.get_node_by_uuid(node0_uuid)

        message = self.load_message('scenario3_service-update.json')

        self.assertEqual('hostname_0', node0.hostname)
        self.assertEqual(element.ServiceState.ONLINE.value, node0.state)
        self.assertEqual(element.ServiceState.ENABLED.value, node0.status)

        handler.info(
            ctxt=self.context,
            publisher_id=message['publisher_id'],
            event_type=message['event_type'],
            payload=message['payload'],
            metadata=self.FAKE_METADATA,
        )

        self.assertEqual('Node_0', node0.hostname)
        self.assertEqual(element.ServiceState.OFFLINE.value, node0.state)
        self.assertEqual(element.ServiceState.DISABLED.value, node0.status)
Esempio n. 2
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),
        ]
 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),
     ]
Esempio n. 4
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),
        ]