]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add discard to connection properties
authorDaniel Wilson <daniel.wilson@purestorage.com>
Fri, 24 Jul 2015 21:54:35 +0000 (14:54 -0700)
committerDaniel Wilson <daniel.wilson@purestorage.com>
Mon, 27 Jul 2015 22:14:54 +0000 (15:14 -0700)
This adds the discard property to base doc strings and base classes.
This also adds the discard capability into the Pure Storage driver
on initialize_connection as an example.

Change-Id: I43b783d6d935a0104d470255c646b3fe1efdf88f
Implements: bp cinder-backend-report-discard

cinder/tests/unit/test_pure.py
cinder/volume/driver.py
cinder/volume/drivers/pure.py
cinder/volume/targets/iscsi.py

index dce80fe8de76af293235a6ee8c8bb107da37bdd8..68704fdc8f532fe8731fe7796543acc4a7052aef 100644 (file)
@@ -160,6 +160,7 @@ ISCSI_CONNECTION_INFO = {
         "target_lun": 1,
         "target_discovered": True,
         "access_mode": "rw",
+        "discard": True,
     },
 }
 FC_CONNECTION_INFO = {
@@ -170,6 +171,7 @@ FC_CONNECTION_INFO = {
         "target_discovered": True,
         "access_mode": "rw",
         "initiator_target_map": INITIATOR_TARGET_MAP,
+        "discard": True,
     },
 }
 
index 28ad334004915a611e054b0378175a130c23c5bf..f3fc118e5ffbf1c68df3cdb9ab60440a87413a54 100644 (file)
@@ -1548,6 +1548,8 @@ class ISCSIDriver(VolumeDriver):
         :access_mode:    the volume access mode allow client used
                          ('rw' or 'ro' currently supported)
 
+        :discard:    boolean indicating if discard is supported
+
         In some of drivers that support multiple connections (for multipath
         and for single path with failover on connection failure), it returns
         :target_iqns, :target_portals, :target_luns, which contain lists of
@@ -1664,7 +1666,8 @@ class ISCSIDriver(VolumeDriver):
                     'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
                     'target_portal': '127.0.0.0.1:3260',
                     'volume_id': 1,
-                    'access_mode': 'rw'
+                    'access_mode': 'rw',
+                    'discard': False,
                 }
             }
 
@@ -1684,7 +1687,8 @@ class ISCSIDriver(VolumeDriver):
                     'target_lun': 1,
                     'target_luns': [1, 1],
                     'volume_id': 1,
-                    'access_mode': 'rw'
+                    'access_mode': 'rw',
+                    'discard': False,
                 }
             }
         """
@@ -1766,7 +1770,8 @@ class FakeISCSIDriver(ISCSIDriver):
     def initialize_connection(self, volume, connector):
         return {
             'driver_volume_type': 'iscsi',
-            'data': {'access_mode': 'rw'}
+            'data': {'access_mode': 'rw'},
+            'discard': False,
         }
 
     def terminate_connection(self, volume, connector, **kwargs):
@@ -1920,7 +1925,8 @@ class FibreChannelDriver(VolumeDriver):
                     'target_discovered': True,
                     'target_lun': 1,
                     'target_wwn': '1234567890123',
-                    'access_mode': 'rw'
+                    'access_mode': 'rw',
+                    'discard': False,
                 }
             }
 
@@ -1932,7 +1938,8 @@ class FibreChannelDriver(VolumeDriver):
                     'target_discovered': True,
                     'target_lun': 1,
                     'target_wwn': ['1234567890123', '0987654321321'],
-                    'access_mode': 'rw'
+                    'access_mode': 'rw',
+                    'discard': False,
                 }
             }
 
index 5fec7965d7f5910d740ce2dd6992c60a5d9aef53..375cc7ec67e97aed9f52faff2d6dbf95078d66aa 100644 (file)
@@ -650,6 +650,7 @@ class PureISCSIDriver(PureBaseVolumeDriver, san.SanISCSIDriver):
                 "target_lun": connection["lun"],
                 "target_discovered": True,
                 "access_mode": "rw",
+                "discard": True,
             },
         }
 
@@ -826,6 +827,7 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver):
                 "target_wwn": target_wwns,
                 'access_mode': 'rw',
                 'initiator_target_map': init_targ_map,
+                "discard": True,
             }
         }
 
index 1ba1b8aacbc51902afc54812efab1997f1137757..b37535a1b87eae0902809d72b270c4db506b2c4a 100644 (file)
@@ -78,6 +78,8 @@ class ISCSITarget(driver.Target):
         :access_mode:    the volume access mode allow client used
                          ('rw' or 'ro' currently supported)
 
+        :discard:    boolean indicating if discard is supported
+
         In some of drivers that support multiple connections (for multipath
         and for single path with failover on connection failure), it returns
         :target_iqns, :target_portals, :target_luns, which contain lists of
@@ -289,7 +291,8 @@ class ISCSITarget(driver.Target):
                     'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
                     'target_portal': '127.0.0.0.1:3260',
                     'volume_id': '9a0d35d0-175a-11e4-8c21-0800200c9a66',
-                    'access_mode': 'rw'
+                    'access_mode': 'rw',
+                    'discard': False,
                 }
             }
         """