Forbid users to create shares with the name "None"

This patch will prevent ambiguity between manila share creation
with name = 'None' and without name argument.

Closes-Bug: #1909477
Change-Id: Ie21cad4754f32afdaf2c3f69202acfd7aa10f57c
This commit is contained in:
lkuchlan 2020-12-28 15:26:47 +02:00
parent 68052cd26b
commit fc5b6c5985
1 changed files with 5 additions and 0 deletions

View File

@ -884,6 +884,11 @@ def do_create(cs, args):
share_network = None
if args.share_network:
share_network = _find_share_network(cs, args.share_network)
if args.name == 'None':
raise exceptions.CommandError(
"Share name cannot be with the value 'None'")
share = cs.shares.create(args.share_protocol, args.size, args.snapshot_id,
args.name, args.description,
metadata=share_metadata,