Update FMS service to provide values in error message
Ram, vcpus, disk, and ephemeral storage values provided in error messages will allow team to better debug output when rare out of bounds defect occurs. This will allow us to determine if the problem is the number calculated for testing or the ranger formula in the code that is responsible for this defect. Change-Id: I8aedefa757b48319f90ac97c1dfd3495218ad4d2
This commit is contained in:
parent
921179d5f6
commit
d2c95ac8c8
@ -302,13 +302,15 @@ class Flavor(Model):
|
||||
raise ErrorStatus(400, "ephemeral must be a number")
|
||||
if int(self.ram) not in list(range(1024, vram_limit + 1, 1024)):
|
||||
raise ErrorStatus(400,
|
||||
"ram value is out of range. Expected range"
|
||||
" is 1024(1GB)-%6d(%3dGB) and must be a"
|
||||
" multiple of 1024" %
|
||||
(vram_limit, vram_limit / 1024))
|
||||
"ram value % is out of range. Expected range"
|
||||
" is 1024(1GB)-% (% GB) and must be a"
|
||||
" multiple of 1024".format(
|
||||
self.ram,
|
||||
vram_limit,
|
||||
vram_limit // 1024))
|
||||
if int(self.vcpus) not in list(range(1, vcpu_limit + 1)):
|
||||
raise ErrorStatus(400, "vcpus value is out of range. Expected"
|
||||
"range is 1-%2d" % (vcpu_limit))
|
||||
raise ErrorStatus(400, "vcpus value % is out of range. Expected"
|
||||
"range is 1-%" % (str(self.vcpus), str(vcpu_limit)))
|
||||
if int(self.disk) < 0:
|
||||
raise ErrorStatus(400, "disk cannot be less than zero")
|
||||
|
||||
@ -318,16 +320,20 @@ class Flavor(Model):
|
||||
and int(self.ephemeral) not in
|
||||
list(range(0, ephemeral_limit + 1))):
|
||||
raise ErrorStatus(400,
|
||||
"ephemeral value is out of range. Expected"
|
||||
" range is 0-%5d(%2dTB)" %
|
||||
(ephemeral_limit, ephemeral_limit / 1000))
|
||||
"ephemeral value {} is out of range. Expected"
|
||||
" range is 0-{} ({}TB)".format(
|
||||
self.ephemeral,
|
||||
ephemeral_limit,
|
||||
ephemeral_limit // 1000))
|
||||
|
||||
if int(self.swap) not in list(range(0, swap_file_limit + 1, 1024)):
|
||||
raise ErrorStatus(400,
|
||||
"swap value is out of range. Expected"
|
||||
" range is 0-%6d(%3dGB) and must be a"
|
||||
" multiple of 1024" %
|
||||
(swap_file_limit, swap_file_limit / 1024))
|
||||
"swap value {} is out of range. Expected"
|
||||
" range is 0-{}({}GB) and must be a"
|
||||
" multiple of 1024".format(
|
||||
self.swap,
|
||||
swap_file_limit,
|
||||
swap_file_limit // 1024))
|
||||
except ValueError:
|
||||
raise ErrorStatus(400, "ram, vcpus, disk, ephemeral and swap must"
|
||||
" be integers")
|
||||
|
Loading…
x
Reference in New Issue
Block a user