summaryrefslogtreecommitdiff
path: root/bin/nova-manage
diff options
context:
space:
mode:
authorMandar Vaze <mandar.vaze@vertex.co.in>2012-04-02 03:02:22 -0700
committerMandar Vaze <mandar.vaze@vertex.co.in>2012-04-26 01:42:23 -0700
commit2cea9b04139a0b64f1bda5b777c062e207d739f9 (patch)
treef17803c518b2926b75934af5214053ac33cf6551 /bin/nova-manage
parentcaa1b282c701d5e9b9e02ffdb07d432d9b35ed13 (diff)
downloadnova-2cea9b04139a0b64f1bda5b777c062e207d739f9.tar.gz
Disallow network creation when label > 255. Fixes bug 965008
Added length check for label. Without length check, label is truncated. Warning is shown by sqlalchemy layer. Raise an InvalidInput exception when validation fails (like rest of the surroudning code) Change-Id: Iae517e03099e36f1c00f4742049834a9231a2fff
Diffstat (limited to 'bin/nova-manage')
-rwxr-xr-xbin/nova-manage4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 53c4fd6f30..bd68578188 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -740,6 +740,10 @@ class NetworkCommands(object):
# check for certain required inputs
if not label:
raise exception.NetworkNotCreated(req='--label')
+ # Size of "label" column in nova.networks is 255, hence the restriction
+ if len(label) > 255:
+ reason = _("Maximum allowed length for 'label' is 255.")
+ raise exception.InvalidInput(reason=reason)
if not (fixed_range_v4 or fixed_range_v6):
req = '--fixed_range_v4 or --fixed_range_v6'
raise exception.NetworkNotCreated(req=req)