Can't create shares on drivers that don't support snapshots

For a driver that doesn't support snapshots, a share type with
snapshot_support = '<is> False' will prevent share creation.
Root cause is code in HostManager that improperly checks whether
snapshot_support (and other boolean properties) is set on each
pool. This commit fixes the check for the boolean pool capabilities.

Change-Id: I6a488788926cca119498b3de992beec3b0545259
Closes-Bug: #1498646
This commit is contained in:
Clinton Knight 2015-09-23 10:48:34 -04:00
parent 8d67177111
commit 8a34fb3890
3 changed files with 24 additions and 15 deletions

View File

@ -274,19 +274,19 @@ class HostState(object):
if not pool_cap.get('storage_protocol'): if not pool_cap.get('storage_protocol'):
pool_cap['storage_protocol'] = self.storage_protocol pool_cap['storage_protocol'] = self.storage_protocol
if not pool_cap.get('driver_handles_share_servers'): if 'driver_handles_share_servers' not in pool_cap:
pool_cap['driver_handles_share_servers'] = \ pool_cap['driver_handles_share_servers'] = (
self.driver_handles_share_servers self.driver_handles_share_servers)
if not pool_cap.get('snapshot_support'): if 'snapshot_support' not in pool_cap:
pool_cap['snapshot_support'] = True pool_cap['snapshot_support'] = self.snapshot_support
if not pool_cap.get('consistency_group_support'): if not pool_cap.get('consistency_group_support'):
pool_cap['consistency_group_support'] = \ pool_cap['consistency_group_support'] = \
self.consistency_group_support self.consistency_group_support
if not pool_cap.get('dedupe'): if 'dedupe' not in pool_cap:
pool_cap['dedupe'] = False pool_cap['dedupe'] = self.dedupe
def update_backend(self, capability): def update_backend(self, capability):
self.share_backend_name = capability.get('share_backend_name') self.share_backend_name = capability.get('share_backend_name')

View File

@ -38,6 +38,7 @@ SERVICE_STATES_NO_POOLS = {
provisioned_capacity_gb=312, provisioned_capacity_gb=312,
max_over_subscription_ratio=1.0, max_over_subscription_ratio=1.0,
thin_provisioning=False, thin_provisioning=False,
snapshot_support=False,
driver_handles_share_servers=False), driver_handles_share_servers=False),
'host2@back1': dict(share_backend_name='BBB', 'host2@back1': dict(share_backend_name='BBB',
total_capacity_gb=256, free_capacity_gb=100, total_capacity_gb=256, free_capacity_gb=100,
@ -45,6 +46,7 @@ SERVICE_STATES_NO_POOLS = {
provisioned_capacity_gb=400, provisioned_capacity_gb=400,
max_over_subscription_ratio=2.0, max_over_subscription_ratio=2.0,
thin_provisioning=True, thin_provisioning=True,
snapshot_support=True,
driver_handles_share_servers=False), driver_handles_share_servers=False),
'host2@back2': dict(share_backend_name='CCC', 'host2@back2': dict(share_backend_name='CCC',
total_capacity_gb=10000, free_capacity_gb=700, total_capacity_gb=10000, free_capacity_gb=700,
@ -52,6 +54,7 @@ SERVICE_STATES_NO_POOLS = {
provisioned_capacity_gb=50000, provisioned_capacity_gb=50000,
max_over_subscription_ratio=20.0, max_over_subscription_ratio=20.0,
thin_provisioning=True, thin_provisioning=True,
snapshot_support=True,
driver_handles_share_servers=False), driver_handles_share_servers=False),
} }
@ -180,7 +183,8 @@ class FakeHostManager(host_manager.HostManager):
'allocated_capacity_gb': 0, 'allocated_capacity_gb': 0,
'thin_provisioning': False, 'thin_provisioning': False,
'reserved_percentage': 10, 'reserved_percentage': 10,
'timestamp': None}, 'timestamp': None,
'snapshot_support': True},
'host2': {'total_capacity_gb': 2048, 'host2': {'total_capacity_gb': 2048,
'free_capacity_gb': 300, 'free_capacity_gb': 300,
'allocated_capacity_gb': 1748, 'allocated_capacity_gb': 1748,
@ -188,7 +192,8 @@ class FakeHostManager(host_manager.HostManager):
'max_over_subscription_ratio': 2.0, 'max_over_subscription_ratio': 2.0,
'thin_provisioning': True, 'thin_provisioning': True,
'reserved_percentage': 10, 'reserved_percentage': 10,
'timestamp': None}, 'timestamp': None,
'snapshot_support': True},
'host3': {'total_capacity_gb': 512, 'host3': {'total_capacity_gb': 512,
'free_capacity_gb': 256, 'free_capacity_gb': 256,
'allocated_capacity_gb': 256, 'allocated_capacity_gb': 256,
@ -197,7 +202,8 @@ class FakeHostManager(host_manager.HostManager):
'thin_provisioning': False, 'thin_provisioning': False,
'consistency_group_support': 'host', 'consistency_group_support': 'host',
'reserved_percentage': 0, 'reserved_percentage': 0,
'timestamp': None}, 'timestamp': None,
'snapshot_support': True},
'host4': {'total_capacity_gb': 2048, 'host4': {'total_capacity_gb': 2048,
'free_capacity_gb': 200, 'free_capacity_gb': 200,
'allocated_capacity_gb': 1848, 'allocated_capacity_gb': 1848,
@ -205,7 +211,8 @@ class FakeHostManager(host_manager.HostManager):
'max_over_subscription_ratio': 1.0, 'max_over_subscription_ratio': 1.0,
'thin_provisioning': True, 'thin_provisioning': True,
'reserved_percentage': 5, 'reserved_percentage': 5,
'timestamp': None}, 'timestamp': None,
'snapshot_support': True},
'host5': {'total_capacity_gb': 2048, 'host5': {'total_capacity_gb': 2048,
'free_capacity_gb': 500, 'free_capacity_gb': 500,
'allocated_capacity_gb': 1548, 'allocated_capacity_gb': 1548,
@ -214,13 +221,15 @@ class FakeHostManager(host_manager.HostManager):
'thin_provisioning': True, 'thin_provisioning': True,
'reserved_percentage': 5, 'reserved_percentage': 5,
'timestamp': None, 'timestamp': None,
'consistency_group_support': 'pool'}, 'consistency_group_support': 'pool',
'snapshot_support': True},
'host6': {'total_capacity_gb': 'unknown', 'host6': {'total_capacity_gb': 'unknown',
'free_capacity_gb': 'unknown', 'free_capacity_gb': 'unknown',
'allocated_capacity_gb': 1548, 'allocated_capacity_gb': 1548,
'thin_provisioning': False, 'thin_provisioning': False,
'reserved_percentage': 5, 'reserved_percentage': 5,
'timestamp': None}, 'timestamp': None,
'snapshot_support': True},
} }

View File

@ -194,7 +194,7 @@ class HostManagerTestCase(test.TestCase):
'vendor_name': None, 'vendor_name': None,
'storage_protocol': None, 'storage_protocol': None,
'driver_handles_share_servers': False, 'driver_handles_share_servers': False,
'snapshot_support': True, 'snapshot_support': False,
'consistency_group_support': False, 'consistency_group_support': False,
'dedupe': False, 'dedupe': False,
}, },
@ -420,7 +420,7 @@ class HostManagerTestCase(test.TestCase):
'capabilities': { 'capabilities': {
'timestamp': None, 'timestamp': None,
'driver_handles_share_servers': False, 'driver_handles_share_servers': False,
'snapshot_support': True, 'snapshot_support': False,
'share_backend_name': 'AAA', 'share_backend_name': 'AAA',
'free_capacity_gb': 200, 'free_capacity_gb': 200,
'driver_version': None, 'driver_version': None,