Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure names are truncated to accommodate NVP limit
Switches created through Advanced Plugin should have their name truncated as well. To this aim, move things around to avoid awkward imports or code duplications Fixes bug #1227927 Change-Id: I3cc69356227d3bd63603ee1e53d82e6561f4cad0
- Loading branch information
armando-migliaccio
committed
Sep 20, 2013
1 parent
53b7df3
commit 2a76286
Showing
5 changed files
with
50 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
|
||
# Copyright 2013 VMware, Inc. | ||
# All Rights Reserved | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from neutron.openstack.common import log | ||
|
||
LOG = log.getLogger(__name__) | ||
MAX_DISPLAY_NAME_LEN = 40 | ||
|
||
|
||
def check_and_truncate(display_name): | ||
if display_name and len(display_name) > MAX_DISPLAY_NAME_LEN: | ||
LOG.debug(_("Specified name:'%s' exceeds maximum length. " | ||
"It will be truncated on NVP"), display_name) | ||
return display_name[:MAX_DISPLAY_NAME_LEN] | ||
return display_name or '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters