From 04ec4673c61fb8300069e7991ab80f7782cc6b86 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Thu, 2 Oct 2014 09:44:12 -0700 Subject: [PATCH] Clarify InvalidInput exception when the size is missing In the case where size is None, the exception message 'Volume size must be an integer...' is misleading. Change-Id: Ida34a84f8b3d156e3dca54de594c991b5ef73295 --- cinder/volume/flows/api/create_volume.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cinder/volume/flows/api/create_volume.py b/cinder/volume/flows/api/create_volume.py index cd9432181..5a1357404 100644 --- a/cinder/volume/flows/api/create_volume.py +++ b/cinder/volume/flows/api/create_volume.py @@ -175,7 +175,7 @@ class ExtractVolumeRequestTask(flow_utils.CinderTask): def validate_snap_size(size): if snapshot and size < snapshot['volume_size']: - msg = _("Volume size %(size)sGB cannot be smaller than" + msg = _("Volume size '%(size)s'GB cannot be smaller than" " the snapshot size %(snap_size)sGB. " "They must be >= original snapshot size.") msg = msg % {'size': size, @@ -184,7 +184,7 @@ class ExtractVolumeRequestTask(flow_utils.CinderTask): def validate_source_size(size): if source_volume and size < source_volume['size']: - msg = _("Volume size %(size)sGB cannot be smaller than " + msg = _("Volume size '%(size)s'GB cannot be smaller than " "original volume size %(source_size)sGB. " "They must be >= original volume size.") msg = msg % {'size': size, @@ -193,7 +193,7 @@ class ExtractVolumeRequestTask(flow_utils.CinderTask): def validate_int(size): if not isinstance(size, int) or size <= 0: - msg = _("Volume size %(size)s must be an integer and" + msg = _("Volume size '%(size)s' must be an integer and" " greater than 0") % {'size': size} raise exception.InvalidInput(reason=msg) @@ -212,7 +212,7 @@ class ExtractVolumeRequestTask(flow_utils.CinderTask): size = snapshot['volume_size'] size = utils.as_int(size) - LOG.debug("Validating volume %(size)s using %(functors)s" % + LOG.debug("Validating volume '%(size)s' using %(functors)s" % {'size': size, 'functors': ", ".join([common.make_pretty_name(func) for func in validator_functors])}) -- 2.45.2