From 2c1bb9efd9287381f16979899bf25022822bf95b Mon Sep 17 00:00:00 2001 From: Haiwei Xu Date: Tue, 12 Feb 2013 01:37:27 +0000 Subject: Check the length of flavor name in "flavor-create" Fixes bug 1102280 The length of flavor name is defined 255 charaters in database. But flavor name can be more than 255 characters when a flavor is created. This patch adds the length check of flavor name. Change-Id: If9db879e5f6340594b215b057a29d03c6fef1503 --- nova/compute/instance_types.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index 045a24d4d..4cc5d5d4e 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -86,6 +86,9 @@ def create(name, memory, vcpus, root_gb, ephemeral_gb=None, flavorid=None, 'rxtx_factor': rxtx_factor, } + # ensure name do not exceed 255 characters + utils.check_string_length(name, 'name', min_length=1, max_length=255) + # ensure name does not contain any special characters invalid_name = INVALID_NAME_REGEX.search(name) if invalid_name: -- cgit