Fix NoneType has no attribute get

If volume_type is None and then create volumes with allow-multiattach,
Cinder-schduler will raise error:

AttributeError: 'NoneType' object has no attribute 'get'

Change-Id: Ied42d13b642617dd239ea92c019354b90657821a
Closes-bug: #1683431
(cherry picked from commit a58f66e180)
This commit is contained in:
wangxiyuan 2017-04-18 09:56:29 +08:00 committed by Xiaojun Liao
parent f3f3fb3c49
commit 8a0c155a98
1 changed files with 2 additions and 1 deletions

View File

@ -297,7 +297,8 @@ class FilterScheduler(driver.Scheduler):
# Since Cinder is using mixed filters from Oslo and it's own, which
# takes 'resource_XX' and 'volume_XX' as input respectively, copying
# 'volume_XX' to 'resource_XX' will make both filters happy.
volume_type = resource_type = request_spec.get("volume_type")
volume_type = request_spec.get("volume_type")
resource_type = request_spec.get("volume_type", {})
config_options = self._get_configuration_options()