Skip to content

Commit

Permalink
Fibre Channel base class for Cinder drivers
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kumartin committed Feb 19, 2013
1 parent 0c52162 commit af64eac
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cinder/tests/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,17 @@ def test_get_iscsi_properties(self):
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):
Expand Down
44 changes: 44 additions & 0 deletions cinder/volume/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,47 @@ def fake_execute(cmd, *_args, **_kwargs):
"""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()

0 comments on commit af64eac

Please sign in to comment.