def test_notify_about_capacity_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = "host1" output = volume_utils.notify_about_capacity_usage(mock.sentinel.context, mock.sentinel.capacity, "test_suffix") self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.capacity) mock_rpc.get_notifier.assert_called_once_with("capacity", "host1") mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, "capacity.test_suffix", mock_usage.return_value )
def test_notify_about_capacity_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' output = volume_utils.notify_about_capacity_usage( mock.sentinel.context, mock.sentinel.capacity, 'test_suffix') self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.capacity) mock_rpc.get_notifier.assert_called_once_with('capacity', 'host1') mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, 'capacity.test_suffix', mock_usage.return_value)
def test_notify_about_capacity_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' output = volume_utils.notify_about_capacity_usage( mock.sentinel.context, mock.sentinel.capacity, 'test_suffix') self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.capacity) mock_rpc.get_notifier.assert_called_once_with('capacity', 'host1') mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, 'capacity.test_suffix', mock_usage.return_value)
def test_notify_about_capacity_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = "host1" output = volume_utils.notify_about_capacity_usage( mock.sentinel.context, mock.sentinel.capacity, "test_suffix", extra_usage_info={"a": "b", "c": "d"}, host="host2", ) self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.capacity, a="b", c="d") mock_rpc.get_notifier.assert_called_once_with("capacity", "host2") mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, "capacity.test_suffix", mock_usage.return_value )
def test_notify_about_capacity_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' output = volume_utils.notify_about_capacity_usage( mock.sentinel.context, mock.sentinel.capacity, 'test_suffix', extra_usage_info={'a': 'b', 'c': 'd'}, host='host2') self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.capacity, a='b', c='d') mock_rpc.get_notifier.assert_called_once_with('capacity', 'host2') mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, 'capacity.test_suffix', mock_usage.return_value)
def test_notify_about_capacity_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' output = volume_utils.notify_about_capacity_usage( mock.sentinel.context, mock.sentinel.capacity, 'test_suffix', extra_usage_info={'a': 'b', 'c': 'd'}, host='host2') self.assertIsNone(output) mock_usage.assert_called_once_with(mock.sentinel.capacity, a='b', c='d') mock_rpc.get_notifier.assert_called_once_with('capacity', 'host2') mock_rpc.get_notifier.return_value.info.assert_called_once_with( mock.sentinel.context, 'capacity.test_suffix', mock_usage.return_value)
def _notify_capacity_usage(self, context, usage): if usage: for u in usage: vol_utils.notify_about_capacity_usage( context, u, u['type'], None, None) LOG.debug("Publish storage capacity: %s.", usage)
def _notify_capacity_usage(self, context, usage): if usage: for u in usage: vol_utils.notify_about_capacity_usage( context, u, u['type'], None, None) LOG.debug("Publish storage capacity: %s.", usage)