diff --git a/orm/services/flavor_manager/fms_rest/data/wsme/models.py b/orm/services/flavor_manager/fms_rest/data/wsme/models.py index d5097db5..ced99d93 100755 --- a/orm/services/flavor_manager/fms_rest/data/wsme/models.py +++ b/orm/services/flavor_manager/fms_rest/data/wsme/models.py @@ -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")