From 65e1b1d28286018b4df9fcfd732ec1ebb4d2a60c Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Mon, 30 Mar 2015 10:10:45 -0700 Subject: [PATCH] Fix potential access to missing key This patch puts a simple check around the 'extra_specs' key, and makes sure it's there, while trying to inject the multiattach capabilities filtering. If we want to change the approach, we can do so in early Liberty, when we enable multiattach for drivers. At this stage of the release, lets just do the simple and safe thing. Change-Id: I45496e4325122ba20e79351f85945ca9804eaa61 Closes-Bug: 1438141 --- cinder/scheduler/filter_scheduler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cinder/scheduler/filter_scheduler.py b/cinder/scheduler/filter_scheduler.py index d84ad48b3..1e30dbe1c 100644 --- a/cinder/scheduler/filter_scheduler.py +++ b/cinder/scheduler/filter_scheduler.py @@ -289,6 +289,9 @@ class FilterScheduler(driver.Scheduler): multiattach = volume_properties.get('multiattach', False) if multiattach and 'multiattach' not in resource_type.get( 'extra_specs', {}): + if 'extra_specs' not in resource_type: + resource_type['extra_specs'] = {} + resource_type['extra_specs'].update( multiattach=' True') -- 2.45.2