예제 #1
0
    def test_build_ems_log_message_1(self):

        self.mock_object(
            socket, 'gethostname', mock.Mock(return_value='fake_hostname'))
        aggregate_pools = ['aggr1', 'aggr2']
        flexvol_pools = ['vol1', 'vol2']

        result = utils.build_ems_log_message_1(
            'fake_driver_name', 'fake_app_version', 'fake_vserver',
            flexvol_pools, aggregate_pools)

        pool_info = {
            'pools': {
                'vserver': 'fake_vserver',
                'aggregates': aggregate_pools,
                'flexvols': flexvol_pools,
            },
        }
        self.assertDictEqual(pool_info,
                             json.loads(result['event-description']))

        result['event-description'] = ''
        expected = {
            'computer-name': 'fake_hostname',
            'event-source': 'Cinder driver fake_driver_name',
            'app-version': 'fake_app_version',
            'category': 'provisioning',
            'log-level': '5',
            'auto-support': 'false',
            'event-id': '1',
            'event-description': '',
        }
        self.assertEqual(expected, result)
예제 #2
0
    def test_build_ems_log_message_1(self):

        self.mock_object(socket, 'gethostname', return_value='fake_hostname')
        aggregate_pools = ['aggr1', 'aggr2']
        flexvol_pools = ['vol1', 'vol2']

        result = utils.build_ems_log_message_1('fake_driver_name',
                                               'fake_app_version',
                                               'fake_vserver', flexvol_pools,
                                               aggregate_pools)

        pool_info = {
            'pools': {
                'vserver': 'fake_vserver',
                'aggregates': aggregate_pools,
                'flexvols': flexvol_pools,
            },
        }
        self.assertDictEqual(pool_info,
                             json.loads(result['event-description']))

        result['event-description'] = ''
        expected = {
            'computer-name': 'fake_hostname',
            'event-source': 'Cinder driver fake_driver_name',
            'app-version': 'fake_app_version',
            'category': 'provisioning',
            'log-level': '5',
            'auto-support': 'false',
            'event-id': '1',
            'event-description': '',
        }
        self.assertEqual(expected, result)
예제 #3
0
    def _handle_ems_logging(self):
        """Log autosupport messages."""

        base_ems_message = dot_utils.build_ems_log_message_0(
            self.driver_name, self.app_version, self.driver_mode)
        self.zapi_client.send_ems_log_message(base_ems_message)

        pool_ems_message = dot_utils.build_ems_log_message_1(
            self.driver_name, self.app_version, None, self.volume_list, [])
        self.zapi_client.send_ems_log_message(pool_ems_message)
예제 #4
0
    def _handle_ems_logging(self):
        """Log autosupport messages."""

        base_ems_message = dot_utils.build_ems_log_message_0(self.driver_name, self.app_version, self.driver_mode)
        self.zapi_client.send_ems_log_message(base_ems_message)

        pool_ems_message = dot_utils.build_ems_log_message_1(
            self.driver_name, self.app_version, None, self._get_backing_flexvol_names(), []
        )
        self.zapi_client.send_ems_log_message(pool_ems_message)
예제 #5
0
    def _handle_ems_logging(self):
        """Log autosupport messages."""

        base_ems_message = dot_utils.build_ems_log_message_0(
            self.driver_name, self.app_version)
        self.zapi_client.send_ems_log_message(base_ems_message)

        pool_ems_message = dot_utils.build_ems_log_message_1(
            self.driver_name, self.app_version, self.vserver,
            self._get_backing_flexvol_names(), [])
        self.zapi_client.send_ems_log_message(pool_ems_message)
예제 #6
0
    def _handle_ems_logging(self):
        """Log autosupport messages."""

        base_ems_message = dot_utils.build_ems_log_message_0(
            self.driver_name, self.app_version)
        self.zapi_client.send_ems_log_message(base_ems_message)

        pool_ems_message = dot_utils.build_ems_log_message_1(
            self.driver_name, self.app_version, self.vserver,
            self.ssc_library.get_ssc_flexvol_names(), [])
        self.zapi_client.send_ems_log_message(pool_ems_message)