Merge "Display correct volume size in error message"
This commit is contained in:
commit
9d6e0ef332
@ -738,9 +738,9 @@ class ExtendForm(forms.SelfHandlingForm):
|
||||
usages['totalGigabytesUsed']
|
||||
if availableGB < (new_size - orig_size):
|
||||
message = _('Volume cannot be extended to %(req)iGiB as '
|
||||
'you only have %(avail)iGiB of your quota '
|
||||
'available.')
|
||||
params = {'req': new_size, 'avail': availableGB}
|
||||
'the maximum size it can be extended to is '
|
||||
'%(max_size)iGiB.')
|
||||
params = {'req': new_size, 'max_size': (availableGB + orig_size)}
|
||||
self._errors["new_size"] = self.error_class([message % params])
|
||||
return cleaned_data
|
||||
|
||||
|
@ -1732,8 +1732,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
|
||||
args=[volume.id])
|
||||
res = self.client.post(url, formData)
|
||||
self.assertFormError(res, "form", "new_size",
|
||||
"Volume cannot be extended to 1000GiB as you "
|
||||
"only have 80GiB of your quota available.")
|
||||
"Volume cannot be extended to 1000GiB as "
|
||||
"the maximum size it can be extended to is "
|
||||
"120GiB.")
|
||||
|
||||
mock_get.assert_called_once_with(test.IsHttpRequest(), volume.id)
|
||||
self.assertEqual(2, mock_quotas.call_count)
|
||||
|
Loading…
x
Reference in New Issue
Block a user