Autogenerate container name correctly for vol backup

The volume backup code is passing '' as a default container name,
which will cause cinder/swift to fail.   If no container name is provided,
the default value of None will enable the auto creation of a container correctly.

Change-Id: I7813153c65652ce6e1a5ac03204a8738eefdc64e
Closes-Bug: #1658137
(cherry picked from commit 90a9af2e0b)
This commit is contained in:
Eric Peterson 2017-01-23 10:39:52 -07:00 committed by Rob Cresswell
parent 87ae58b95e
commit 3238dc0738
1 changed files with 4 additions and 1 deletions

View File

@ -616,9 +616,12 @@ def volume_backup_create(request,
container_name,
name,
description):
# need to ensure the container name is not an empty
# string, but pass None to get the container name
# generated correctly
backup = cinderclient(request).backups.create(
volume_id,
container=container_name,
container=container_name if container_name else None,
name=name,
description=description)
return VolumeBackup(backup)