]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add multiattach capabilities injection
authorWalter A. Boring IV <walter.boring@hp.com>
Thu, 26 Feb 2015 22:59:13 +0000 (22:59 +0000)
committerWalter A. Boring IV (hemna) <walter.boring@hp.com>
Wed, 11 Mar 2015 16:01:18 +0000 (16:01 +0000)
This patch is a follow up to the multiattach patch that adds
the ability to the scheduler to be able to filter capabilities
on the volume multiattach flag.   When a volume creation request
comes in with the multiattach flag set on a volume, there was no
way to filter out backends that don't support attaching a volume
to more than one host.   By defaut, no host supports it.  When
The Nova side lands, we can adjust drivers to add the new
multiattach:True capability reporting.

Change-Id: Ia426a2bf2ab8214f52fb6e70a3a1deff68d13d98

cinder/scheduler/filter_scheduler.py
cinder/scheduler/host_manager.py

index c9dd604c942d79659e3747b34033122df5353bad..52eb1ec3308dfcb7fa0434ab1eee06153528ea25 100644 (file)
@@ -283,6 +283,15 @@ class FilterScheduler(driver.Scheduler):
         self.populate_filter_properties(request_spec,
                                         filter_properties)
 
+        # If multiattach is enabled on a volume, we need to add
+        # multiattach to extra specs, so that the capability
+        # filtering is enabled.
+        multiattach = volume_properties.get('multiattach', False)
+        if multiattach and 'multiattach' not in resource_type.get(
+                'extra_specs', {}):
+            resource_type['extra_specs'].update(
+                multiattach='<is> True')
+
         # Find our local list of acceptable hosts by filtering and
         # weighing our options. we virtually consume resources on
         # it so subsequent selections can adjust accordingly.
index b9c59724ae2b46dd51e65efd2bea4e40abdb55ee..3637600b98c49497fa748bbd653ba64feef770cc 100644 (file)
@@ -118,6 +118,9 @@ class HostState(object):
         self.max_over_subscription_ratio = 1.0
         self.thin_provisioning_support = False
         self.thick_provisioning_support = False
+        # Does this backend support attaching a volume to more than
+        # once host/instance?
+        self.multiattach = False
 
         # PoolState for all pools
         self.pools = {}
@@ -331,6 +334,7 @@ class PoolState(HostState):
                 'thin_provisioning_support', False)
             self.thick_provisioning_support = capability.get(
                 'thick_provisioning_support', False)
+            self.multiattach = capability.get('multiattach', False)
 
     def update_pools(self, capability):
         # Do nothing, since we don't have pools within pool, yet