コード例 #1
0
ファイル: test_volume_utils.py プロジェクト: openstack/cinder
 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
     )
コード例 #2
0
ファイル: test_volume_utils.py プロジェクト: ashang/cinder-1
 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)
コード例 #3
0
 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)
コード例 #4
0
ファイル: test_volume_utils.py プロジェクト: openstack/cinder
 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
     )
コード例 #5
0
 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)
コード例 #6
0
 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)
コード例 #7
0
 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)
コード例 #8
0
 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)