'Regression test for bug #1680457.
When the Cinder client returns OverLimit when trying to create
a volume, an OverQuota exception should be raised.'

@mock.patch('nova.volume.cinder.cinderclient')
def test_over_limit_volumes_with_message(self, mock_cinder):

    cinder_client = mock.Mock()
    mock_cinder.return_value = cinder_client
    msg = 'VolumeSizeExceedsLimit:    Requested    volume    size    XG    is    larger    than    maximum    allowed    limit    YG.'
    exc = cinder_exceptions.OverLimit(413, message=msg)
    cinder_client.volumes.create.side_effect = exc
    volume = {'display_name': 'vol1', 'size': 3}
    e = self.assertRaises(client.OpenStackApiException, self.api.post_volume, {'volume': volume})
    self.assertEqual(403, e.response.status_code)
    self.assertIn('VolumeSizeExceedsLimit', e.response.text)
