Remove dead volume driver code
This cleans up some dead code for handling Cinder volumes for drivers that have been removed. The impacted drivers are: Removed in Ocata * AOE (CORAID) Removed in Stein * DRDB * HGST * ITRI DISCO Removed in Train * Veritas Hyperscale Removed in Ussuri * Sheepdog - the project has been defunct for several years now and was considered dead code in Cinder Since these drivers are not useful without Cinder, they are considered dead code and therefore do not need to go through a deprecation period in Nova. Change-Id: Id1c7d2ca8c93e35b71bf9d48668f1b10a947b0ba Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
parent
f576ab3f8b
commit
1cee7c01ef
|
@ -1,26 +0,0 @@
|
|||
# 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 mock
|
||||
from os_brick.initiator import connector
|
||||
|
||||
from nova.tests.unit.virt.libvirt.volume import test_volume
|
||||
from nova.virt.libvirt.volume import aoe
|
||||
|
||||
|
||||
class LibvirtAOEVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
|
||||
|
||||
@mock.patch('os.path.exists', return_value=True)
|
||||
def test_libvirt_aoe_driver(self, exists):
|
||||
libvirt_driver = aoe.LibvirtAOEVolumeDriver(self.fake_host)
|
||||
self.assertIsInstance(libvirt_driver.connector,
|
||||
connector.AoEConnector)
|
|
@ -1,61 +0,0 @@
|
|||
# Copyright (c) 2015 Industrial Technology Research Institute.
|
||||
# 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 mock
|
||||
from os_brick.initiator import connector
|
||||
|
||||
from nova.tests.unit.virt.libvirt.volume import test_volume
|
||||
from nova.virt.libvirt.volume import disco
|
||||
|
||||
|
||||
class LibvirtDISCOVolumeDriverTestCase(
|
||||
test_volume.LibvirtVolumeBaseTestCase):
|
||||
|
||||
def test_libvirt_disco_driver(self):
|
||||
libvirt_driver = disco.LibvirtDISCOVolumeDriver(
|
||||
self.fake_host)
|
||||
self.assertIsInstance(libvirt_driver.connector,
|
||||
connector.DISCOConnector)
|
||||
|
||||
def test_libvirt_disco_driver_connect(self):
|
||||
dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)
|
||||
conf = {'server_ip': '127.0.0.1', 'server_port': 9898}
|
||||
disk_info = {'disco_id': '1234567',
|
||||
'name': 'aDiscoVolume',
|
||||
'conf': conf}
|
||||
conn = {'data': disk_info}
|
||||
with mock.patch.object(dcon.connector,
|
||||
'connect_volume',
|
||||
return_value={'path': '/dev/dms1234567'}):
|
||||
dcon.connect_volume(conn, mock.sentinel.instance)
|
||||
self.assertEqual('/dev/dms1234567',
|
||||
conn['data']['device_path'])
|
||||
|
||||
def test_libvirt_disco_driver_get_config(self):
|
||||
dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)
|
||||
|
||||
conn = {'data': {'device_path': '/dev/dms1234567'}}
|
||||
conf = dcon.get_config(conn, self.disk_info)
|
||||
self.assertEqual('file', conf.source_type)
|
||||
self.assertEqual('/dev/dms1234567', conf.source_path)
|
||||
self.assertEqual('disco', conf.source_protocol)
|
||||
|
||||
def test_libvirt_disco_driver_disconnect(self):
|
||||
dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)
|
||||
dcon.connector.disconnect_volume = mock.MagicMock()
|
||||
conn = {'data': mock.sentinel.conn_data}
|
||||
dcon.disconnect_volume(conn, mock.sentinel.instance)
|
||||
dcon.connector.disconnect_volume.assert_called_once_with(
|
||||
mock.sentinel.conn_data, None)
|
|
@ -1,62 +0,0 @@
|
|||
# Copyright (c) 2015 LINBIT HA-Solutions GmbH.
|
||||
# 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.
|
||||
"""Unit tests for the DRDB volume driver module."""
|
||||
|
||||
import mock
|
||||
from os_brick.initiator import connector
|
||||
|
||||
from nova import context as nova_context
|
||||
from nova.tests.unit import fake_instance
|
||||
from nova.tests.unit.virt.libvirt.volume import test_volume
|
||||
from nova.virt.libvirt.volume import drbd
|
||||
|
||||
|
||||
class LibvirtDRBDVolumeDriverTestCase(
|
||||
test_volume.LibvirtVolumeBaseTestCase):
|
||||
"""Tests the LibvirtDRBDVolumeDriver class."""
|
||||
|
||||
def test_libvirt_drbd_driver(self):
|
||||
drbd_driver = drbd.LibvirtDRBDVolumeDriver(self.fake_host)
|
||||
self.assertIsInstance(drbd_driver.connector, connector.DRBDConnector)
|
||||
# connect a fake volume
|
||||
connection_info = {
|
||||
'data': {
|
||||
'device': '/path/to/fake-device'
|
||||
}
|
||||
}
|
||||
ctxt = nova_context.RequestContext('fake-user', 'fake-project')
|
||||
instance = fake_instance.fake_instance_obj(ctxt)
|
||||
device_info = {
|
||||
'type': 'block',
|
||||
'path': connection_info['data']['device'],
|
||||
}
|
||||
with mock.patch.object(connector.DRBDConnector, 'connect_volume',
|
||||
return_value=device_info):
|
||||
drbd_driver.connect_volume(connection_info, instance)
|
||||
# assert that the device_path was set
|
||||
self.assertIn('device_path', connection_info['data'])
|
||||
self.assertEqual('/path/to/fake-device',
|
||||
connection_info['data']['device_path'])
|
||||
# now get the config using the updated connection_info
|
||||
conf = drbd_driver.get_config(connection_info, self.disk_info)
|
||||
# assert things were passed through to the parent class
|
||||
self.assertEqual('block', conf.source_type)
|
||||
self.assertEqual('/path/to/fake-device', conf.source_path)
|
||||
# now disconnect the volume
|
||||
with mock.patch.object(connector.DRBDConnector,
|
||||
'disconnect_volume') as mock_disconnect:
|
||||
drbd_driver.disconnect_volume(connection_info, instance)
|
||||
# disconnect is all passthrough so just assert the call
|
||||
mock_disconnect.assert_called_once_with(connection_info['data'], None)
|
|
@ -1,58 +0,0 @@
|
|||
# Copyright 2015 HGST
|
||||
# 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 mock
|
||||
from os_brick.initiator import connector
|
||||
|
||||
from nova.tests.unit.virt.libvirt.volume import test_volume
|
||||
from nova.virt.libvirt.volume import hgst
|
||||
|
||||
|
||||
# Actual testing of the os_brick HGST driver done in the os_brick testcases
|
||||
# Here we're concerned only with the small API shim that connects Nova
|
||||
# so these will be pretty simple cases.
|
||||
|
||||
|
||||
class LibvirtHGSTVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
|
||||
def test_libvirt_hgst_driver_type(self):
|
||||
drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_host)
|
||||
self.assertIsInstance(drvr.connector, connector.HGSTConnector)
|
||||
|
||||
def test_libvirt_hgst_driver_connect(self):
|
||||
def brick_conn_vol(data):
|
||||
return {'path': '/dev/space01'}
|
||||
|
||||
drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_host)
|
||||
drvr.connector.connect_volume = brick_conn_vol
|
||||
di = {'path': '/dev/space01', 'name': 'space01'}
|
||||
ci = {'data': di}
|
||||
drvr.connect_volume(ci, mock.sentinel.instance)
|
||||
self.assertEqual('/dev/space01',
|
||||
ci['data']['device_path'])
|
||||
|
||||
def test_libvirt_hgst_driver_get_config(self):
|
||||
drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_host)
|
||||
ci = {'data': {'device_path': '/dev/space01'}}
|
||||
conf = drvr.get_config(ci, self.disk_info)
|
||||
self.assertEqual('block', conf.source_type)
|
||||
self.assertEqual('/dev/space01', conf.source_path)
|
||||
|
||||
def test_libvirt_hgst_driver_disconnect(self):
|
||||
drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_host)
|
||||
drvr.connector.disconnect_volume = mock.MagicMock()
|
||||
ci = {'data': mock.sentinel.conn_data}
|
||||
drvr.disconnect_volume(ci, mock.sentinel.instance)
|
||||
drvr.connector.disconnect_volume.assert_called_once_with(
|
||||
mock.sentinel.conn_data, None)
|
|
@ -35,25 +35,6 @@ class LibvirtNetVolumeDriverTestCase(
|
|||
iscsi_name = '%s/%s' % (self.iqn, self.vol['id'])
|
||||
self.assertEqual(iscsi_name, tree.find('./source').get('name'))
|
||||
|
||||
def sheepdog_connection(self, volume):
|
||||
return {
|
||||
'driver_volume_type': 'sheepdog',
|
||||
'data': {
|
||||
'name': volume['name']
|
||||
}
|
||||
}
|
||||
|
||||
def test_libvirt_sheepdog_driver(self):
|
||||
libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
|
||||
connection_info = self.sheepdog_connection(self.vol)
|
||||
conf = libvirt_driver.get_config(connection_info, self.disk_info)
|
||||
tree = conf.format_dom()
|
||||
self.assertEqual('network', tree.get('type'))
|
||||
self.assertEqual('sheepdog', tree.find('./source').get('protocol'))
|
||||
self.assertEqual(self.name, tree.find('./source').get('name'))
|
||||
libvirt_driver.disconnect_volume(connection_info,
|
||||
mock.sentinel.instance)
|
||||
|
||||
def rbd_connection(self, volume):
|
||||
return {
|
||||
'driver_volume_type': 'rbd',
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
# Copyright (c) 2017 Veritas Technologies LLC
|
||||
# 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 mock
|
||||
|
||||
from os_brick.initiator import connector
|
||||
|
||||
from nova.tests.unit.virt.libvirt.volume import test_volume
|
||||
from nova.virt.libvirt.volume import vrtshyperscale
|
||||
|
||||
DEVICE_NAME = '{8ee71c33-dcd0-4267-8f2b-e0742ecabe9f}'
|
||||
DEVICE_PATH = '/dev/8ee71c33-dcd0-4267-8f2b-e0742ec'
|
||||
|
||||
|
||||
class LibvirtHyperScaleVolumeDriverTestCase(
|
||||
test_volume.LibvirtVolumeBaseTestCase):
|
||||
|
||||
def test_driver_init(self):
|
||||
hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host)
|
||||
self.assertIsInstance(hs.connector, connector.HyperScaleConnector)
|
||||
|
||||
def test_get_config(self):
|
||||
hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host)
|
||||
|
||||
# expect valid conf is returned if called with proper arguments
|
||||
conn = {'data': {'device_path': DEVICE_PATH}}
|
||||
|
||||
conf = hs.get_config(conn, self.disk_info)
|
||||
|
||||
self.assertEqual("block", conf.source_type)
|
||||
self.assertEqual(DEVICE_PATH, conf.source_path)
|
||||
|
||||
@mock.patch('os_brick.initiator.connectors.vrtshyperscale'
|
||||
'.HyperScaleConnector.connect_volume')
|
||||
def test_connect_volume(self, mock_brick_connect_volume):
|
||||
mock_brick_connect_volume.return_value = {'path': DEVICE_PATH}
|
||||
|
||||
hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host)
|
||||
|
||||
# dummy arguments are just passed through to mock connector
|
||||
disk_info = {'name': DEVICE_NAME}
|
||||
connection_info = {'data': disk_info}
|
||||
|
||||
hs.connect_volume(connection_info, mock.sentinel.instance)
|
||||
|
||||
# expect connect_volume to add device_path to connection_info:
|
||||
self.assertEqual(connection_info['data']['device_path'], DEVICE_PATH)
|
||||
|
||||
@mock.patch('os_brick.initiator.connectors.vrtshyperscale'
|
||||
'.HyperScaleConnector.disconnect_volume')
|
||||
def test_disconnect_volume(self, mock_brick_disconnect_volume):
|
||||
mock_brick_disconnect_volume.return_value = None
|
||||
|
||||
hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host)
|
||||
|
||||
# dummy arguments are just passed through to mock connector
|
||||
conn_data = {'name': DEVICE_NAME}
|
||||
connection_info = {'data': conn_data}
|
||||
|
||||
hs.disconnect_volume(connection_info, mock.sentinel.instance)
|
||||
|
||||
hs.connector.disconnect_volume.assert_called_once_with(conn_data, None)
|
|
@ -173,26 +173,18 @@ libvirt_volume_drivers = [
|
|||
'iscsi=nova.virt.libvirt.volume.iscsi.LibvirtISCSIVolumeDriver',
|
||||
'iser=nova.virt.libvirt.volume.iser.LibvirtISERVolumeDriver',
|
||||
'local=nova.virt.libvirt.volume.volume.LibvirtVolumeDriver',
|
||||
'drbd=nova.virt.libvirt.volume.drbd.LibvirtDRBDVolumeDriver',
|
||||
'fake=nova.virt.libvirt.volume.volume.LibvirtFakeVolumeDriver',
|
||||
'rbd=nova.virt.libvirt.volume.net.LibvirtNetVolumeDriver',
|
||||
'sheepdog=nova.virt.libvirt.volume.net.LibvirtNetVolumeDriver',
|
||||
'nfs=nova.virt.libvirt.volume.nfs.LibvirtNFSVolumeDriver',
|
||||
'smbfs=nova.virt.libvirt.volume.smbfs.LibvirtSMBFSVolumeDriver',
|
||||
'aoe=nova.virt.libvirt.volume.aoe.LibvirtAOEVolumeDriver',
|
||||
'fibre_channel='
|
||||
'nova.virt.libvirt.volume.fibrechannel.'
|
||||
'LibvirtFibreChannelVolumeDriver',
|
||||
'gpfs=nova.virt.libvirt.volume.gpfs.LibvirtGPFSVolumeDriver',
|
||||
'quobyte=nova.virt.libvirt.volume.quobyte.LibvirtQuobyteVolumeDriver',
|
||||
'hgst=nova.virt.libvirt.volume.hgst.LibvirtHGSTVolumeDriver',
|
||||
'scaleio=nova.virt.libvirt.volume.scaleio.LibvirtScaleIOVolumeDriver',
|
||||
'disco=nova.virt.libvirt.volume.disco.LibvirtDISCOVolumeDriver',
|
||||
'vzstorage='
|
||||
'nova.virt.libvirt.volume.vzstorage.LibvirtVZStorageVolumeDriver',
|
||||
'veritas_hyperscale='
|
||||
'nova.virt.libvirt.volume.vrtshyperscale.'
|
||||
'LibvirtHyperScaleVolumeDriver',
|
||||
'storpool=nova.virt.libvirt.volume.storpool.LibvirtStorPoolVolumeDriver',
|
||||
'nvmeof=nova.virt.libvirt.volume.nvme.LibvirtNVMEVolumeDriver',
|
||||
]
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
# 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.
|
||||
|
||||
from os_brick import initiator
|
||||
from os_brick.initiator import connector
|
||||
from oslo_log import log as logging
|
||||
|
||||
import nova.conf
|
||||
from nova import utils
|
||||
from nova.virt.libvirt.volume import volume as libvirt_volume
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class LibvirtAOEVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
|
||||
"""Driver to attach AoE volumes to libvirt."""
|
||||
def __init__(self, host):
|
||||
super(LibvirtAOEVolumeDriver,
|
||||
self).__init__(host, is_block_dev=True)
|
||||
|
||||
# Call the factory here so we can support
|
||||
# more than x86 architectures.
|
||||
self.connector = connector.InitiatorConnector.factory(
|
||||
initiator.AOE, utils.get_root_helper(),
|
||||
device_scan_attempts=CONF.libvirt.num_aoe_discover_tries)
|
||||
|
||||
def get_config(self, connection_info, disk_info):
|
||||
"""Returns xml for libvirt."""
|
||||
conf = super(LibvirtAOEVolumeDriver,
|
||||
self).get_config(connection_info, disk_info)
|
||||
|
||||
conf.source_type = "block"
|
||||
conf.source_path = connection_info['data']['device_path']
|
||||
return conf
|
||||
|
||||
def connect_volume(self, connection_info, instance):
|
||||
LOG.debug("Calling os-brick to attach AoE Volume")
|
||||
device_info = self.connector.connect_volume(connection_info['data'])
|
||||
LOG.debug("Attached AoE volume %s", device_info)
|
||||
|
||||
connection_info['data']['device_path'] = device_info['path']
|
||||
|
||||
def disconnect_volume(self, connection_info, instance):
|
||||
"""Detach the volume from instance_name."""
|
||||
|
||||
LOG.debug("calling os-brick to detach AoE Volume", instance=instance)
|
||||
self.connector.disconnect_volume(connection_info['data'], None)
|
||||
LOG.debug("Disconnected AoE Volume", instance=instance)
|
||||
|
||||
super(LibvirtAOEVolumeDriver,
|
||||
self).disconnect_volume(connection_info, instance)
|
|
@ -1,62 +0,0 @@
|
|||
# Copyright (c) 2015 Industrial Technology Research Institute.
|
||||
# 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.
|
||||
|
||||
"""Libvirt volume driver for DISCO."""
|
||||
|
||||
from os_brick import initiator
|
||||
from os_brick.initiator import connector
|
||||
|
||||
import nova.conf
|
||||
from nova import utils
|
||||
from nova.virt.libvirt.volume import volume as libvirt_volume
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class LibvirtDISCOVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
|
||||
"""Class DISCO Libvirt volume Driver.
|
||||
|
||||
Implements Libvirt part of volume driver for DISCO cinder driver.
|
||||
Uses the DISCO connector from the os-brick projects.
|
||||
"""
|
||||
|
||||
def __init__(self, host):
|
||||
"""Init DISCO connector for LibVirt."""
|
||||
super(LibvirtDISCOVolumeDriver, self).__init__(host,
|
||||
is_block_dev=False)
|
||||
self.connector = connector.InitiatorConnector.factory(
|
||||
initiator.DISCO, utils.get_root_helper(),
|
||||
device_scan_attempts=CONF.libvirt.num_volume_scan_tries)
|
||||
|
||||
def get_config(self, connection_info, disk_info):
|
||||
"""Get DISCO volume attachment configuration."""
|
||||
conf = super(LibvirtDISCOVolumeDriver, self).get_config(
|
||||
connection_info, disk_info)
|
||||
|
||||
conf.source_path = connection_info['data']['device_path']
|
||||
conf.source_protocol = 'disco'
|
||||
conf.source_type = 'file'
|
||||
return conf
|
||||
|
||||
def connect_volume(self, connection_info, instance):
|
||||
"""Connect a DISCO volume to a compute node."""
|
||||
device_info = self.connector.connect_volume(connection_info['data'])
|
||||
connection_info['data']['device_path'] = device_info['path']
|
||||
|
||||
def disconnect_volume(self, connection_info, instance):
|
||||
"""Disconnect a DISCO volume of a compute node."""
|
||||
self.connector.disconnect_volume(connection_info['data'], None)
|
||||
super(LibvirtDISCOVolumeDriver, self).disconnect_volume(
|
||||
connection_info, instance)
|
|
@ -1,59 +0,0 @@
|
|||
# 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.
|
||||
|
||||
from os_brick import initiator
|
||||
from os_brick.initiator import connector
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova import utils
|
||||
from nova.virt.libvirt.volume import volume as libvirt_volume
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LibvirtDRBDVolumeDriver(libvirt_volume.LibvirtVolumeDriver):
|
||||
"""Driver to attach DRBD volumes to libvirt."""
|
||||
|
||||
def __init__(self, host):
|
||||
super(LibvirtDRBDVolumeDriver, self).__init__(host)
|
||||
self.connector = connector.InitiatorConnector.factory(
|
||||
initiator.DRBD, utils.get_root_helper())
|
||||
|
||||
def connect_volume(self, connection_info, instance):
|
||||
"""Connect the volume.
|
||||
|
||||
Sets the connection_info['data']['device_path'] value upon successful
|
||||
connection.
|
||||
|
||||
:param connection_info: dict of connection information for the backend
|
||||
storage when a connection was initiated with Cinder. Expects
|
||||
connection_info['data']['device'] to be set.
|
||||
:param instance: The nova.objects.Instance that is having a volume
|
||||
connected to it.
|
||||
"""
|
||||
LOG.debug("Calling os-brick to attach DRBD Volume.", instance=instance)
|
||||
device_info = self.connector.connect_volume(connection_info['data'])
|
||||
LOG.debug("Attached DRBD volume %s", device_info, instance=instance)
|
||||
connection_info['data']['device_path'] = device_info['path']
|
||||
|
||||
def disconnect_volume(self, connection_info, instance):
|
||||
"""Disconnect the volume.
|
||||
|
||||
:param connection_info: dict of connection information for the backend
|
||||
storage when a connection was initiated with Cinder.
|
||||
:param instance: The nova.objects.Instance that is having a volume
|
||||
disconnected from it.
|
||||
"""
|
||||
LOG.debug("Calling os-brick to detach DRBD Volume.", instance=instance)
|
||||
self.connector.disconnect_volume(connection_info['data'], None)
|
||||
LOG.debug("Disconnected DRBD Volume", instance=instance)
|
|
@ -1,52 +0,0 @@
|
|||
# Copyright 2015 HGST
|
||||
# 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.
|
||||
|
||||
from os_brick import initiator
|
||||
from os_brick.initiator import connector
|
||||
|
||||
import nova.conf
|
||||
from nova import utils
|
||||
from nova.virt.libvirt.volume import volume as libvirt_volume
|
||||
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class LibvirtHGSTVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
|
||||
"""Driver to attach HGST volumes to libvirt."""
|
||||
def __init__(self, host):
|
||||
super(LibvirtHGSTVolumeDriver,
|
||||
self).__init__(host, is_block_dev=True)
|
||||
self.connector = connector.InitiatorConnector.factory(
|
||||
initiator.HGST, utils.get_root_helper(),
|
||||
device_scan_attempts=CONF.libvirt.num_volume_scan_tries)
|
||||
|
||||
def get_config(self, connection_info, disk_info):
|
||||
"""Returns xml for libvirt."""
|
||||
conf = super(LibvirtHGSTVolumeDriver,
|
||||
self).get_config(connection_info, disk_info)
|
||||
|
||||
conf.source_type = "block"
|
||||
conf.source_path = connection_info['data']['device_path']
|
||||
return conf
|
||||
|
||||
def connect_volume(self, connection_info, instance):
|
||||
device_info = self.connector.connect_volume(connection_info['data'])
|
||||
connection_info['data']['device_path'] = device_info['path']
|
||||
|
||||
def disconnect_volume(self, connection_info, instance):
|
||||
self.connector.disconnect_volume(connection_info['data'], None)
|
||||
super(LibvirtHGSTVolumeDriver,
|
||||
self).disconnect_volume(connection_info, instance)
|
|
@ -1,58 +0,0 @@
|
|||
# Copyright (c) 2017 Veritas Technologies LLC.
|
||||
# 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.
|
||||
|
||||
"""Libvirt volume driver for HyperScale."""
|
||||
|
||||
from os_brick import initiator
|
||||
from os_brick.initiator import connector
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova import utils
|
||||
from nova.virt.libvirt.volume import volume as libvirt_volume
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LibvirtHyperScaleVolumeDriver(libvirt_volume.LibvirtVolumeDriver):
|
||||
"""Class HyperScale libvirt volume driver
|
||||
|
||||
This class implements a Libvirt volume driver for Veritas
|
||||
HyperScale storage. The class uses its parent class get_config method,
|
||||
and calls the Veritas HyperScale os-brick connector to handle the work
|
||||
of the connect_volume and disconnect volume methods.
|
||||
"""
|
||||
|
||||
def __init__(self, connection):
|
||||
super(LibvirtHyperScaleVolumeDriver, self).__init__(connection)
|
||||
self.connector = connector.InitiatorConnector.factory(
|
||||
initiator.VERITAS_HYPERSCALE, utils.get_root_helper())
|
||||
|
||||
def connect_volume(self, connection_info, instance):
|
||||
# The os-brick connector may raise BrickException.
|
||||
# The convention in nova is to just propagate it up.
|
||||
# Note that the device path is returned from the os-brick connector
|
||||
# using the "path" key, LibvirtVolumeDriver.get_config gets the
|
||||
# device path from the "device_path" key in connection_info.
|
||||
|
||||
device_info = self.connector.connect_volume(connection_info['data'])
|
||||
connection_info['data']['device_path'] = device_info.get('path')
|
||||
LOG.info("connect_volume: device path %(device_path)s",
|
||||
{'device_path': connection_info['data']['device_path']})
|
||||
|
||||
def disconnect_volume(self, connection_info, instance):
|
||||
self.connector.disconnect_volume(connection_info['data'], None)
|
||||
LOG.debug("Disconnected volume %(vol_id)s",
|
||||
{'vol_id': connection_info['data']['name']},
|
||||
instance=instance)
|
Loading…
Reference in New Issue