Remove CORAID AOE connector
The CORAID driver was removed many cycles ago. This cleans up os-brick and removes the unused connector. Depends-on: https://review.opendev.org/745393 Change-Id: I45ac41509f8fec9eb8f57aa03bcfb439a361b561 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
parent
ff57ac837d
commit
360154bbf9
|
@ -18,11 +18,6 @@
|
|||
.. automethod:: connect_volume
|
||||
.. automethod:: disconnect_volume
|
||||
|
||||
.. autoclass:: os_brick.initiator.connector.AoEConnector
|
||||
|
||||
.. automethod:: connect_volume
|
||||
.. automethod:: disconnect_volume
|
||||
|
||||
.. autoclass:: os_brick.initiator.connector.LocalConnector
|
||||
|
||||
.. automethod:: connect_volume
|
||||
|
|
|
@ -41,7 +41,6 @@ PPC64LE = "ppc64le"
|
|||
ISCSI = "ISCSI"
|
||||
ISER = "ISER"
|
||||
FIBRE_CHANNEL = "FIBRE_CHANNEL"
|
||||
AOE = "AOE"
|
||||
NFS = "NFS"
|
||||
SMBFS = 'SMBFS'
|
||||
GLUSTERFS = "GLUSTERFS"
|
||||
|
|
|
@ -54,7 +54,6 @@ unix_connector_list = [
|
|||
'FibreChannelConnectorS390X'),
|
||||
('os_brick.initiator.connectors.fibre_channel_ppc64.'
|
||||
'FibreChannelConnectorPPC64'),
|
||||
'os_brick.initiator.connectors.aoe.AoEConnector',
|
||||
'os_brick.initiator.connectors.remotefs.RemoteFsConnector',
|
||||
'os_brick.initiator.connectors.rbd.RBDConnector',
|
||||
'os_brick.initiator.connectors.local.LocalConnector',
|
||||
|
@ -77,8 +76,6 @@ def _get_connector_list():
|
|||
|
||||
# Mappings used to determine who to construct in the factory
|
||||
_connector_mapping_linux = {
|
||||
initiator.AOE:
|
||||
'os_brick.initiator.connectors.aoe.AoEConnector',
|
||||
initiator.GLUSTERFS:
|
||||
'os_brick.initiator.connectors.remotefs.RemoteFsConnector',
|
||||
initiator.NFS:
|
||||
|
|
|
@ -1,176 +0,0 @@
|
|||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import loopingcall
|
||||
|
||||
from os_brick import exception
|
||||
from os_brick import initiator
|
||||
|
||||
from os_brick.initiator.connectors import base
|
||||
from os_brick import utils
|
||||
|
||||
DEVICE_SCAN_ATTEMPTS_DEFAULT = 3
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AoEConnector(base.BaseLinuxConnector):
|
||||
"""Connector class to attach/detach AoE volumes."""
|
||||
|
||||
def __init__(self, root_helper, driver=None,
|
||||
device_scan_attempts=initiator.DEVICE_SCAN_ATTEMPTS_DEFAULT,
|
||||
*args, **kwargs):
|
||||
super(AoEConnector, self).__init__(
|
||||
root_helper,
|
||||
driver=driver,
|
||||
device_scan_attempts=device_scan_attempts,
|
||||
*args, **kwargs)
|
||||
|
||||
@staticmethod
|
||||
def get_connector_properties(root_helper, *args, **kwargs):
|
||||
"""The AoE connector properties."""
|
||||
return {}
|
||||
|
||||
def get_search_path(self):
|
||||
return '/dev/etherd'
|
||||
|
||||
def get_volume_paths(self, connection_properties):
|
||||
aoe_device, aoe_path = self._get_aoe_info(connection_properties)
|
||||
volume_paths = []
|
||||
if os.path.exists(aoe_path):
|
||||
volume_paths.append(aoe_path)
|
||||
|
||||
return volume_paths
|
||||
|
||||
def _get_aoe_info(self, connection_properties):
|
||||
shelf = connection_properties['target_shelf']
|
||||
lun = connection_properties['target_lun']
|
||||
aoe_device = 'e%(shelf)s.%(lun)s' % {'shelf': shelf,
|
||||
'lun': lun}
|
||||
path = self.get_search_path()
|
||||
aoe_path = '%(path)s/%(device)s' % {'path': path,
|
||||
'device': aoe_device}
|
||||
return aoe_device, aoe_path
|
||||
|
||||
@utils.trace
|
||||
@lockutils.synchronized('aoe_control', 'aoe-')
|
||||
def connect_volume(self, connection_properties):
|
||||
"""Discover and attach the volume.
|
||||
|
||||
:param connection_properties: The dictionary that describes all
|
||||
of the target volume attributes.
|
||||
:type connection_properties: dict
|
||||
:returns: dict
|
||||
|
||||
connection_properties for AoE must include:
|
||||
target_shelf - shelf id of volume
|
||||
target_lun - lun id of volume
|
||||
"""
|
||||
aoe_device, aoe_path = self._get_aoe_info(connection_properties)
|
||||
|
||||
device_info = {
|
||||
'type': 'block',
|
||||
'device': aoe_device,
|
||||
'path': aoe_path,
|
||||
}
|
||||
|
||||
if os.path.exists(aoe_path):
|
||||
self._aoe_revalidate(aoe_device)
|
||||
else:
|
||||
self._aoe_discover()
|
||||
|
||||
waiting_status = {'tries': 0}
|
||||
|
||||
# NOTE(jbr_): Device path is not always present immediately
|
||||
def _wait_for_discovery(aoe_path):
|
||||
if os.path.exists(aoe_path):
|
||||
raise loopingcall.LoopingCallDone
|
||||
|
||||
if waiting_status['tries'] >= self.device_scan_attempts:
|
||||
raise exception.VolumeDeviceNotFound(device=aoe_path)
|
||||
|
||||
LOG.info("AoE volume not yet found at: %(path)s. "
|
||||
"Try number: %(tries)s",
|
||||
{'path': aoe_device, 'tries': waiting_status['tries']})
|
||||
|
||||
self._aoe_discover()
|
||||
waiting_status['tries'] += 1
|
||||
|
||||
timer = loopingcall.FixedIntervalLoopingCall(_wait_for_discovery,
|
||||
aoe_path)
|
||||
timer.start(interval=2).wait()
|
||||
|
||||
if waiting_status['tries']:
|
||||
LOG.debug("Found AoE device %(path)s "
|
||||
"(after %(tries)s rediscover)",
|
||||
{'path': aoe_path,
|
||||
'tries': waiting_status['tries']})
|
||||
|
||||
return device_info
|
||||
|
||||
@utils.trace
|
||||
@lockutils.synchronized('aoe_control', 'aoe-')
|
||||
def disconnect_volume(self, connection_properties, device_info,
|
||||
force=False, ignore_errors=False):
|
||||
"""Detach and flush the volume.
|
||||
|
||||
:param connection_properties: The dictionary that describes all
|
||||
of the target volume attributes.
|
||||
:type connection_properties: dict
|
||||
:param device_info: historical difference, but same as connection_props
|
||||
:type device_info: dict
|
||||
|
||||
connection_properties for AoE must include:
|
||||
target_shelf - shelf id of volume
|
||||
target_lun - lun id of volume
|
||||
"""
|
||||
aoe_device, aoe_path = self._get_aoe_info(connection_properties)
|
||||
|
||||
if os.path.exists(aoe_path):
|
||||
self._aoe_flush(aoe_device)
|
||||
|
||||
def _aoe_discover(self):
|
||||
(out, err) = self._execute('aoe-discover',
|
||||
run_as_root=True,
|
||||
root_helper=self._root_helper,
|
||||
check_exit_code=0)
|
||||
|
||||
LOG.debug('aoe-discover: stdout=%(out)s stderr%(err)s',
|
||||
{'out': out, 'err': err})
|
||||
|
||||
def _aoe_revalidate(self, aoe_device):
|
||||
(out, err) = self._execute('aoe-revalidate',
|
||||
aoe_device,
|
||||
run_as_root=True,
|
||||
root_helper=self._root_helper,
|
||||
check_exit_code=0)
|
||||
|
||||
LOG.debug('aoe-revalidate %(dev)s: stdout=%(out)s stderr%(err)s',
|
||||
{'dev': aoe_device, 'out': out, 'err': err})
|
||||
|
||||
def _aoe_flush(self, aoe_device):
|
||||
(out, err) = self._execute('aoe-flush',
|
||||
aoe_device,
|
||||
run_as_root=True,
|
||||
root_helper=self._root_helper,
|
||||
check_exit_code=0)
|
||||
LOG.debug('aoe-flush %(dev)s: stdout=%(out)s stderr%(err)s',
|
||||
{'dev': aoe_device, 'out': out, 'err': err})
|
||||
|
||||
def extend_volume(self, connection_properties):
|
||||
# TODO(walter-boring): is this possible?
|
||||
raise NotImplementedError
|
|
@ -1,101 +0,0 @@
|
|||
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
from os_brick import exception
|
||||
from os_brick.initiator.connectors import aoe
|
||||
from os_brick.tests.initiator import test_connector
|
||||
|
||||
|
||||
class AoEConnectorTestCase(test_connector.ConnectorTestCase):
|
||||
"""Test cases for AoE initiator class."""
|
||||
|
||||
def setUp(self):
|
||||
super(AoEConnectorTestCase, self).setUp()
|
||||
self.connector = aoe.AoEConnector('sudo')
|
||||
self.connection_properties = {'target_shelf': 'fake_shelf',
|
||||
'target_lun': 'fake_lun'}
|
||||
|
||||
def test_get_search_path(self):
|
||||
expected = "/dev/etherd"
|
||||
actual_path = self.connector.get_search_path()
|
||||
self.assertEqual(expected, actual_path)
|
||||
|
||||
@mock.patch.object(os.path, 'exists', return_value=True)
|
||||
def test_get_volume_paths(self, mock_exists):
|
||||
expected = ["/dev/etherd/efake_shelf.fake_lun"]
|
||||
paths = self.connector.get_volume_paths(self.connection_properties)
|
||||
self.assertEqual(expected, paths)
|
||||
|
||||
def test_get_connector_properties(self):
|
||||
props = aoe.AoEConnector.get_connector_properties(
|
||||
'sudo', multipath=True, enforce_multipath=True)
|
||||
|
||||
expected_props = {}
|
||||
self.assertEqual(expected_props, props)
|
||||
|
||||
@mock.patch.object(os.path, 'exists', side_effect=[True, True])
|
||||
def test_connect_volume(self, exists_mock):
|
||||
"""Ensure that if path exist aoe-revalidate was called."""
|
||||
aoe_device, aoe_path = self.connector._get_aoe_info(
|
||||
self.connection_properties)
|
||||
with mock.patch.object(self.connector, '_execute',
|
||||
return_value=["", ""]):
|
||||
self.connector.connect_volume(self.connection_properties)
|
||||
|
||||
@mock.patch.object(os.path, 'exists', side_effect=[False, True])
|
||||
def test_connect_volume_without_path(self, exists_mock):
|
||||
"""Ensure that if path doesn't exist aoe-discovery was called."""
|
||||
|
||||
aoe_device, aoe_path = self.connector._get_aoe_info(
|
||||
self.connection_properties)
|
||||
expected_info = {
|
||||
'type': 'block',
|
||||
'device': aoe_device,
|
||||
'path': aoe_path,
|
||||
}
|
||||
|
||||
with mock.patch.object(self.connector, '_execute',
|
||||
return_value=["", ""]):
|
||||
volume_info = self.connector.connect_volume(
|
||||
self.connection_properties)
|
||||
|
||||
self.assertDictEqual(volume_info, expected_info)
|
||||
|
||||
@mock.patch.object(os.path, 'exists', return_value=False)
|
||||
def test_connect_volume_could_not_discover_path(self, exists_mock):
|
||||
_aoe_device, aoe_path = self.connector._get_aoe_info(
|
||||
self.connection_properties)
|
||||
|
||||
with mock.patch.object(self.connector, '_execute',
|
||||
return_value=["", ""]):
|
||||
self.assertRaises(exception.VolumeDeviceNotFound,
|
||||
self.connector.connect_volume,
|
||||
self.connection_properties)
|
||||
|
||||
@mock.patch.object(os.path, 'exists', return_value=True)
|
||||
def test_disconnect_volume(self, mock_exists):
|
||||
"""Ensure that if path exist aoe-revaliadte was called."""
|
||||
aoe_device, aoe_path = self.connector._get_aoe_info(
|
||||
self.connection_properties)
|
||||
|
||||
with mock.patch.object(self.connector, '_execute',
|
||||
return_value=["", ""]):
|
||||
self.connector.disconnect_volume(self.connection_properties, {})
|
||||
|
||||
def test_extend_volume(self):
|
||||
self.assertRaises(NotImplementedError,
|
||||
self.connector.extend_volume,
|
||||
self.connection_properties)
|
|
@ -226,9 +226,6 @@ class ConnectorTestCase(test_base.TestCase):
|
|||
arch='s390x')
|
||||
self.assertEqual("FibreChannelConnectorS390X", obj.__class__.__name__)
|
||||
|
||||
obj = connector.InitiatorConnector.factory('aoe', None, arch='x86_64')
|
||||
self.assertEqual("AoEConnector", obj.__class__.__name__)
|
||||
|
||||
obj = connector.InitiatorConnector.factory(
|
||||
'nfs', None, nfs_mount_point_base='/mnt/test')
|
||||
self.assertEqual("RemoteFsConnector", obj.__class__.__name__)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
upgrade:
|
||||
- |
|
||||
The CORAID driver was removed from Cinder in the Ocata release.
|
||||
The AOE protocol connector logic in os-brick is no longer needed and has
|
||||
now been removed.
|
Loading…
Reference in New Issue