]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fibre Channel base class for Cinder drivers
authorKurt Martin <kurt.f.martin@hp.com>
Wed, 13 Feb 2013 19:30:17 +0000 (11:30 -0800)
committerKurt Martin <kurt.f.martin@hp.com>
Tue, 19 Feb 2013 17:56:19 +0000 (09:56 -0800)
This is the base class, FibreChannelDriver, for all fibre channel
drivers to extend. Currently, it has only initialize_connection
with comments, but this will be a place to put common functions
similar to the iSCSI base class.

This patch depends on the following nova and devstack changes
to be functional(both still in the review process but approved
for Grizzly):
https://review.openstack.org/#/c/19992/
https://review.openstack.org/#/c/20003/

This patch does not support copy_image_to_volume and
copy_volume_to_image in the Grizzly release. We'll revisit
this in Havana and add that support.

Partially Implements: blueprint fibre-channel-block-storage

Change-Id: I8bd28b8bd96deaec1db219457f407169ed172f69

cinder/tests/test_volume.py
cinder/volume/driver.py

index 6c47f1b95dade26785a874e1f4ee5ef0c877f203..7fef8478c4f58511baf5f12a433e52a6c0b111f8 100644 (file)
@@ -966,6 +966,17 @@ class ISCSITestCase(DriverTestCase):
         self.assertEquals(result["target_lun"], 0)
 
 
+class FibreChannelTestCase(DriverTestCase):
+    """Test Case for FibreChannelDriver"""
+    driver_name = "cinder.volume.driver.FibreChannelDriver"
+
+    def test_initialize_connection(self):
+        self.driver = driver.FibreChannelDriver()
+        self.driver.do_setup(None)
+        self.assertRaises(NotImplementedError,
+                          self.driver.initialize_connection, {}, {})
+
+
 class VolumePolicyTestCase(test.TestCase):
 
     def setUp(self):
index 96391f0288f2179ba2d2ed3b412b98039db855d4..798a9909cf2af65e70dae5bb338eb9f5ae38706a 100644 (file)
@@ -490,3 +490,47 @@ class FakeISCSIDriver(ISCSIDriver):
         """Execute that simply logs the command."""
         LOG.debug(_("FAKE ISCSI: %s"), cmd)
         return (None, None)
+
+
+class FibreChannelDriver(VolumeDriver):
+    """Executes commands relating to Fibre Channel volumes."""
+    def __init__(self, *args, **kwargs):
+        super(FibreChannelDriver, self).__init__(*args, **kwargs)
+
+    def initialize_connection(self, volume, connector):
+        """Initializes the connection and returns connection info.
+
+        The  driver returns a driver_volume_type of 'fibre_channel'.
+        The target_wwn can be a single entry or a list of wwns that
+        correspond to the list of remote wwn(s) that will export the volume.
+        Example return values:
+
+            {
+                'driver_volume_type': 'fibre_channel'
+                'data': {
+                    'target_discovered': True,
+                    'target_lun': 1,
+                    'target_wwn': '1234567890123',
+                }
+            }
+
+            or
+
+             {
+                'driver_volume_type': 'fibre_channel'
+                'data': {
+                    'target_discovered': True,
+                    'target_lun': 1,
+                    'target_wwn': ['1234567890123', '0987654321321'],
+                }
+            }
+
+        """
+        msg = _("Driver must implement initialize_connection")
+        raise NotImplementedError(msg)
+
+    def copy_image_to_volume(self, context, volume, image_service, image_id):
+        raise NotImplementedError()
+
+    def copy_volume_to_image(self, context, volume, image_service, image_meta):
+        raise NotImplementedError()