Created
February 26, 2015 00:46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cinder/scheduler/filter_scheduler.py b/cinder/scheduler/filter_scheduler.py | |
index c9dd604..fd33178 100644 | |
--- a/cinder/scheduler/filter_scheduler.py | |
+++ b/cinder/scheduler/filter_scheduler.py | |
@@ -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. | |
@@ -342,6 +351,17 @@ class FilterScheduler(driver.Scheduler): | |
resource_type['extra_specs'].update( | |
consistencygroup_support='<is> True') | |
+ # If multiattach is enabled on a volume, we need to add | |
+ # multiattach to extra specs, so that the capability | |
+ # filtering is enabled. | |
+ LOG.warn("Volume properties %s" % volume_properties) | |
+ multiattach = volume_properties.get('multiattach', False) | |
+ LOG.warn("extra specs %s" % resource_type.get('extra_specs', None)) | |
+ if multiattach and 'multiattach' not in resource_type.get( | |
+ 'extra_specs', {}): | |
+ resource_type['extra_specs'].update( | |
+ multiattach='<is> True') | |
+ | |
filter_properties.update({'context': context, | |
'request_spec': request_spec, | |
'config_options': config_options, | |
diff --git a/cinder/scheduler/host_manager.py b/cinder/scheduler/host_manager.py | |
index b9c5972..05e3067 100644 | |
--- a/cinder/scheduler/host_manager.py | |
+++ b/cinder/scheduler/host_manager.py | |
@@ -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 = {} | |
diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py | |
index e709891..7d03cfb 100644 | |
--- a/cinder/volume/drivers/lvm.py | |
+++ b/cinder/volume/drivers/lvm.py | |
@@ -186,6 +186,7 @@ class LVMVolumeDriver(driver.VolumeDriver): | |
data["vendor_name"] = 'Open Source' | |
data["driver_version"] = self.VERSION | |
data["storage_protocol"] = self.protocol | |
+ data["multiattach"] = True | |
data["pools"] = [] | |
total_capacity = 0 | |
@@ -228,6 +229,7 @@ class LVMVolumeDriver(driver.VolumeDriver): | |
reserved_percentage=self.configuration.reserved_percentage, | |
location_info=location_info, | |
QoS_support=False, | |
+ multiattach=True, | |
provisioned_capacity_gb=provisioned_capacity, | |
max_over_subscription_ratio=( | |
self.configuration.max_over_subscription_ratio), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment