'Get volume stats.'

@mock.patch('cinder.volume.drivers.qnap.QnapAPIExecutor')
def test_get_volume_stats(self, mock_api_executor):

    mock_api_return = mock_api_executor.return_value
    mock_api_return.get_basic_info.return_value = ('ES1640dc    ', 'ES1640dc    ', '1.1.3')
    mock_api_return.get_specific_poolinfo.return_value = self.get_specific_poolinfo_return_value()
    self.driver = qnap.QnapISCSIDriver(configuration=create_configuration('admin', 'qnapadmin', 'http://1.2.3.4:8080', '1.2.3.4', 'Pool1', True))
    self.driver.do_setup('context')
    expected_res = {'volume_backend_name': 'QNAP', 'vendor_name': 'QNAP', 'driver_version': '1.0.0', 'storage_protocol': 'iscsi'}
    single_pool = dict(pool_name=self.driver.configuration.qnap_poolname, total_capacity_gb=(930213412209 / units.Gi), free_capacity_gb=(928732941681 / units.Gi), provisioned_capacity_gb=(1480470528 / units.Gi), reserved_percentage=self.driver.configuration.reserved_percentage, QoS_support=False)
    expected_res['pools'] = [single_pool]
    self.assertEqual(expected_res, self.driver.get_volume_stats(refresh=True))
    mock_api_return.get_specific_poolinfo.assert_called_once_with(self.driver.configuration.qnap_poolname)
