Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 1 | From 98e9487ad99ac6969e5ae58601ab5550b947202b Mon Sep 17 00:00:00 2001 |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 2 | From: Peter Penchev <openstack-dev@storpool.com> |
Biser Milanov | 8323a8c | 2024-11-20 10:53:27 +0200 | [diff] [blame] | 3 | Date: Mon, 12 Mar 2018 12:00:10 +0200 |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 4 | Subject: [PATCH] Add iSCSI export support to the StorPool driver |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 5 | |
| 6 | Add four new driver options: |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 7 | - storpool_iscsi_cinder_volume: use StorPool iSCSI attachments whenever |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 8 | the cinder-volume service needs to attach a volume to the controller, |
| 9 | e.g. for copying an image to a volume or vice versa |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 10 | - storpool_iscsi_export_to: |
| 11 | - an empty string to use the StorPool native protocol for exporting |
| 12 | volumes |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 13 | - the string "*" to always use iSCSI for exporting volumes |
| 14 | - an experimental, not fully supported list of IQN patterns to export |
| 15 | volumes to using iSCSI; this results in a Cinder driver that exports |
| 16 | different volumes using different storage protocols |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 17 | - storpool_iscsi_portal_group: the name of the iSCSI portal group |
| 18 | defined in the StorPool configuration to use for these export |
| 19 | - storpool_iscsi_learn_initiator_iqns: automatically create StorPool |
| 20 | configuration records for an initiator when a volume is first exported |
| 21 | to it |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 22 | |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 23 | When exporting volumes via iSCSI, report the storage protocol as |
| 24 | "iSCSI". |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 25 | |
| 26 | Change-Id: I9de64306e0e6976268df782053b0651dd1cca96f |
| 27 | --- |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 28 | .../unit/volume/drivers/test_storpool.py | 441 +++++++++++++++++- |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 29 | cinder/volume/drivers/storpool.py | 386 ++++++++++++++- |
Biser Milanov | da1b068 | 2024-11-29 09:37:10 +0200 | [diff] [blame] | 30 | .../drivers/storpool-volume-driver.rst | 68 ++- |
| 31 | .../storpool-iscsi-cefcfe590a07c5c7.yaml | 15 + |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 32 | 4 files changed, 895 insertions(+), 15 deletions(-) |
Biser Milanov | da1b068 | 2024-11-29 09:37:10 +0200 | [diff] [blame] | 33 | create mode 100644 releasenotes/notes/storpool-iscsi-cefcfe590a07c5c7.yaml |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 34 | |
Peter Pentchev | acaaa38 | 2023-02-28 11:26:13 +0200 | [diff] [blame] | 35 | diff --git a/cinder/tests/unit/volume/drivers/test_storpool.py b/cinder/tests/unit/volume/drivers/test_storpool.py |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 36 | index 2015c734d..b21f1582d 100644 |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 37 | --- a/cinder/tests/unit/volume/drivers/test_storpool.py |
| 38 | +++ b/cinder/tests/unit/volume/drivers/test_storpool.py |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 39 | @@ -13,9 +13,12 @@ |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 40 | # License for the specific language governing permissions and limitations |
Biser Milanov | da1b068 | 2024-11-29 09:37:10 +0200 | [diff] [blame] | 41 | # under the License. |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 42 | |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 43 | +from __future__ import annotations |
| 44 | |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 45 | +import dataclasses |
| 46 | import itertools |
| 47 | import re |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 48 | +from typing import Any, NamedTuple # noqa: H301 |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 49 | from unittest import mock |
| 50 | |
| 51 | import ddt |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 52 | @@ -23,6 +26,7 @@ from os_brick.initiator import storpool_utils |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 53 | from os_brick.tests.initiator import test_storpool_utils |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 54 | from oslo_utils import units |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 55 | |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 56 | +from cinder.common import constants |
| 57 | from cinder import exception |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 58 | from cinder.tests.unit import fake_constants |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 59 | from cinder.tests.unit import test |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 60 | @@ -30,6 +34,13 @@ from cinder.volume import configuration as conf |
Biser Milanov | da1b068 | 2024-11-29 09:37:10 +0200 | [diff] [blame] | 61 | from cinder.volume.drivers import storpool as driver |
| 62 | |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 63 | |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 64 | +ISCSI_IQN_OURS = 'beleriand' |
| 65 | +ISCSI_IQN_OTHER = 'rohan' |
| 66 | +ISCSI_IQN_THIRD = 'gondor' |
| 67 | +ISCSI_PAT_OTHER = 'roh*' |
| 68 | +ISCSI_PAT_BOTH = '*riand roh*' |
| 69 | +ISCSI_PORTAL_GROUP = 'openstack_pg' |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 70 | + |
| 71 | volume_types = { |
| 72 | fake_constants.VOLUME_TYPE_ID: {}, |
| 73 | fake_constants.VOLUME_TYPE2_ID: {'storpool_template': 'ssd'}, |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 74 | @@ -67,6 +78,10 @@ def snapshotName(vtype, vid, more=None): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 75 | ) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 76 | |
| 77 | |
| 78 | +def targetName(vid): |
| 79 | + return 'iqn.2012-11.storpool:{id}'.format(id=vid) |
| 80 | + |
| 81 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 82 | class MockAPI(object): |
| 83 | def __init__(self, *args): |
| 84 | self._disks = {} |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 85 | @@ -162,6 +177,242 @@ class MockAPI(object): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 86 | volumes[name] = dict(snapshots[snapname]) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 87 | |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 88 | |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 89 | +class IscsiTestCase(NamedTuple): |
| 90 | + """A single test case for the iSCSI config and export methods.""" |
| 91 | + |
| 92 | + initiator: str | None |
| 93 | + volume: str | None |
| 94 | + exported: bool |
| 95 | + commands_count: int |
| 96 | + |
| 97 | + |
| 98 | +@dataclasses.dataclass(frozen=True) |
| 99 | +class MockIscsiConfig: |
| 100 | + """Mock the structure returned by the "get current config" query.""" |
| 101 | + |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 102 | + @classmethod |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 103 | + def build(cls, tcase: IscsiTestCase) -> dict: |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 104 | + """Build a test config structure.""" |
| 105 | + initiators = { |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 106 | + '0': {'name': ISCSI_IQN_OTHER, 'exports': []}, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 107 | + } |
| 108 | + if tcase.initiator is not None: |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 109 | + initiators['1'] = { |
| 110 | + 'name': tcase.initiator, |
| 111 | + 'exports': ( |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 112 | + [ |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 113 | + { |
| 114 | + 'portalGroup': ISCSI_PORTAL_GROUP, |
| 115 | + 'target': targetName(tcase.volume), |
| 116 | + }, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 117 | + ] |
| 118 | + if tcase.exported |
| 119 | + else [] |
| 120 | + ), |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 121 | + } |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 122 | + |
| 123 | + targets = { |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 124 | + '0': { |
| 125 | + 'name': targetName(fake_constants.VOLUME2_ID), |
| 126 | + 'volume': volumeName(fake_constants.VOLUME2_ID), |
| 127 | + }, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 128 | + } |
| 129 | + if tcase.volume is not None: |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 130 | + targets['1'] = { |
| 131 | + 'name': targetName(tcase.volume), |
| 132 | + 'volume': volumeName(tcase.volume), |
| 133 | + } |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 134 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 135 | + return { |
| 136 | + |
| 137 | + 'portalGroups': { |
| 138 | + '0': { |
| 139 | + 'name': ISCSI_PORTAL_GROUP + '-not', |
| 140 | + 'networks': [], |
| 141 | + }, |
| 142 | + '1': { |
| 143 | + 'name': ISCSI_PORTAL_GROUP, |
| 144 | + 'networks': [ |
| 145 | + {'address': "192.0.2.0"}, |
| 146 | + {'address': "195.51.100.0"}, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 147 | + ], |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 148 | + }, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 149 | + }, |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 150 | + 'initiators': initiators, |
| 151 | + 'targets': targets, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 152 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 153 | + } |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 154 | + |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 155 | + |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 156 | +class MockIscsiAPI: |
| 157 | + """Mock only the iSCSI-related calls of the StorPool API bindings.""" |
| 158 | + |
| 159 | + _asrt: test.TestCase |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 160 | + _configs: list[dict] |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 161 | + |
| 162 | + def __init__( |
| 163 | + self, |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 164 | + configs: list[dict], |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 165 | + asrt: test.TestCase, |
| 166 | + ) -> None: |
| 167 | + """Store the reference to the list of iSCSI config objects.""" |
| 168 | + self._asrt = asrt |
| 169 | + self._configs = configs |
| 170 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 171 | + def get_iscsi_config(self) -> dict: |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 172 | + """Return the last version of the iSCSI configuration.""" |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 173 | + return {'iscsi': self._configs[-1]} |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 174 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 175 | + def _handle_export(self, cfg: dict, cmd: dict[str, Any]) -> dict: |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 176 | + """Add an export for an initiator.""" |
| 177 | + self._asrt.assertDictEqual( |
| 178 | + cmd, |
| 179 | + { |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 180 | + 'initiator': ISCSI_IQN_OURS, |
| 181 | + 'portalGroup': ISCSI_PORTAL_GROUP, |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 182 | + 'volumeName': volumeName(fake_constants.VOLUME_ID), |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 183 | + }, |
| 184 | + ) |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 185 | + self._asrt.assertEqual(cfg['initiators']['1']['name'], |
| 186 | + cmd['initiator']) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 187 | + self._asrt.assertListEqual(cfg['initiators']['1']['exports'], []) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 188 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 189 | + cfg['initiators'] = { |
| 190 | + **cfg['initiators'], |
| 191 | + '1': { |
| 192 | + **cfg['initiators']['1'], |
| 193 | + 'exports': [ |
| 194 | + { |
| 195 | + 'portalGroup': cmd['portalGroup'], |
| 196 | + 'target': targetName(fake_constants.VOLUME_ID), |
| 197 | + }, |
| 198 | + ], |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 199 | + }, |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 200 | + } |
| 201 | + return cfg |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 202 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 203 | + def _handle_delete_export(self, cfg: dict, cmd: dict[str, Any]) -> dict: |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 204 | + """Delete an export for an initiator.""" |
| 205 | + self._asrt.assertDictEqual( |
| 206 | + cmd, |
| 207 | + { |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 208 | + 'initiator': ISCSI_IQN_OURS, |
| 209 | + 'portalGroup': ISCSI_PORTAL_GROUP, |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 210 | + 'volumeName': volumeName(fake_constants.VOLUME_ID), |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 211 | + }, |
| 212 | + ) |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 213 | + self._asrt.assertEqual(cfg['initiators']['1']['name'], |
| 214 | + cmd['initiator']) |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 215 | + self._asrt.assertListEqual( |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 216 | + cfg['initiators']['1']['exports'], |
| 217 | + [{'portalGroup': ISCSI_PORTAL_GROUP, |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 218 | + 'target': cfg['targets']['1']['name']}]) |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 219 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 220 | + del cfg['initiators']['1'] |
| 221 | + return cfg |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 222 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 223 | + def _handle_create_initiator(self, cfg: dict, cmd: dict[str, Any]) -> dict: |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 224 | + """Add a whole new initiator.""" |
| 225 | + self._asrt.assertDictEqual( |
| 226 | + cmd, |
| 227 | + { |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 228 | + 'name': ISCSI_IQN_OURS, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 229 | + 'username': '', |
| 230 | + 'secret': '', |
| 231 | + }, |
| 232 | + ) |
| 233 | + self._asrt.assertNotIn( |
| 234 | + cmd['name'], |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 235 | + [init['name'] for init in cfg['initiators'].values()], |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 236 | + ) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 237 | + self._asrt.assertListEqual(sorted(cfg['initiators']), ['0']) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 238 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 239 | + cfg['initiators'] = { |
| 240 | + **cfg['initiators'], |
| 241 | + '1': {'name': cmd['name'], 'exports': []}, |
| 242 | + } |
| 243 | + return cfg |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 244 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 245 | + def _handle_create_target(self, cfg: dict, cmd: dict[str, Any]) -> dict: |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 246 | + """Add a target for a volume so that it may be exported.""" |
| 247 | + self._asrt.assertDictEqual( |
| 248 | + cmd, |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 249 | + {'volumeName': volumeName(fake_constants.VOLUME_ID)}, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 250 | + ) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 251 | + self._asrt.assertListEqual(sorted(cfg['targets']), ['0']) |
| 252 | + cfg['targets'] = { |
| 253 | + **cfg['targets'], |
| 254 | + '1': { |
| 255 | + 'name': targetName(fake_constants.VOLUME_ID), |
| 256 | + 'volume': volumeName(fake_constants.VOLUME_ID), |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 257 | + }, |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 258 | + } |
| 259 | + return cfg |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 260 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 261 | + def _handle_delete_target(self, cfg: dict, cmd: dict[str, Any]) -> dict: |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 262 | + """Remove a target for a volume.""" |
| 263 | + self._asrt.assertDictEqual( |
| 264 | + cmd, |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 265 | + {'volumeName': volumeName(fake_constants.VOLUME_ID)}, |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 266 | + ) |
| 267 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 268 | + self._asrt.assertListEqual(sorted(cfg['targets']), ['0', '1']) |
| 269 | + del cfg['targets']['1'] |
| 270 | + return cfg |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 271 | + |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 272 | + def _handle_initiator_add_network( |
| 273 | + self, |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 274 | + cfg: dict, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 275 | + cmd: dict[str, Any], |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 276 | + ) -> dict: |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 277 | + """Add a network that an initiator is allowed to log in from.""" |
| 278 | + self._asrt.assertDictEqual( |
| 279 | + cmd, |
| 280 | + { |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 281 | + 'initiator': ISCSI_IQN_OURS, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 282 | + 'net': '0.0.0.0/0', |
| 283 | + }, |
| 284 | + ) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 285 | + return cfg |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 286 | + |
| 287 | + _CMD_HANDLERS = { |
| 288 | + 'createInitiator': _handle_create_initiator, |
| 289 | + 'createTarget': _handle_create_target, |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 290 | + 'deleteTarget': _handle_delete_target, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 291 | + 'export': _handle_export, |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 292 | + 'exportDelete': _handle_delete_export, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 293 | + 'initiatorAddNetwork': _handle_initiator_add_network, |
| 294 | + } |
| 295 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 296 | + def post_iscsi_config( |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 297 | + self, |
| 298 | + commands: dict[str, list[dict[str, dict[str, Any]]]], |
| 299 | + ) -> None: |
| 300 | + """Apply the requested changes to the iSCSI configuration. |
| 301 | + |
| 302 | + This method adds a new config object to the configs list, |
| 303 | + making a shallow copy of the last one and applying the changes |
| 304 | + specified in the list of commands. |
| 305 | + """ |
| 306 | + self._asrt.assertListEqual(sorted(commands), ['commands']) |
| 307 | + self._asrt.assertGreater(len(commands['commands']), 0) |
| 308 | + for cmd in commands['commands']: |
| 309 | + keys = sorted(cmd.keys()) |
| 310 | + cmd_name = keys[0] |
| 311 | + self._asrt.assertListEqual(keys, [cmd_name]) |
| 312 | + handler = self._CMD_HANDLERS[cmd_name] |
| 313 | + new_cfg = handler(self, self._configs[-1], cmd[cmd_name]) |
| 314 | + self._configs.append(new_cfg) |
| 315 | + |
| 316 | + |
| 317 | +_ISCSI_TEST_CASES = [ |
| 318 | + IscsiTestCase(None, None, False, 4), |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 319 | + IscsiTestCase(ISCSI_IQN_OURS, None, False, 2), |
| 320 | + IscsiTestCase(ISCSI_IQN_OURS, fake_constants.VOLUME_ID, False, 1), |
| 321 | + IscsiTestCase(ISCSI_IQN_OURS, fake_constants.VOLUME_ID, True, 0), |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 322 | +] |
| 323 | + |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 324 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 325 | class MockVolumeDB(object): |
| 326 | """Simulate a Cinder database with a volume_get() method.""" |
| 327 | |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 328 | @@ -198,7 +449,15 @@ class StorPoolTestCase(test.TestCase): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 329 | self.cfg.volume_backend_name = 'storpool_test' |
| 330 | self.cfg.storpool_template = None |
| 331 | self.cfg.storpool_replication = 3 |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 332 | + self.cfg.storpool_iscsi_cinder_volume = False |
| 333 | + self.cfg.storpool_iscsi_export_to = '' |
| 334 | + self.cfg.storpool_iscsi_learn_initiator_iqns = True |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 335 | + self.cfg.storpool_iscsi_portal_group = ISCSI_PORTAL_GROUP |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 336 | |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 337 | + self._setup_test_driver() |
| 338 | + |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 339 | + def _setup_test_driver(self): |
| 340 | + """Initialize a StorPool driver as per the current configuration.""" |
| 341 | mock_exec = mock.Mock() |
| 342 | mock_exec.return_value = ('', '') |
| 343 | |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 344 | @@ -216,7 +475,7 @@ class StorPoolTestCase(test.TestCase): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 345 | self.driver.check_for_setup_error() |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 346 | |
| 347 | @ddt.data( |
| 348 | - (5, TypeError), |
| 349 | + (5, (TypeError, AttributeError)), |
| 350 | ({'no-host': None}, KeyError), |
| 351 | ({'host': 'sbad'}, driver.StorPoolConfigurationInvalid), |
| 352 | ({'host': 's01'}, None), |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 353 | @@ -232,7 +491,7 @@ class StorPoolTestCase(test.TestCase): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 354 | conn) |
| 355 | |
| 356 | @ddt.data( |
| 357 | - (5, TypeError), |
| 358 | + (5, (TypeError, AttributeError)), |
| 359 | ({'no-host': None}, KeyError), |
| 360 | ({'host': 'sbad'}, driver.StorPoolConfigurationInvalid), |
| 361 | ) |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 362 | @@ -271,7 +530,7 @@ class StorPoolTestCase(test.TestCase): |
Peter Pentchev | 5a9f8a6 | 2023-12-06 10:40:18 +0200 | [diff] [blame] | 363 | self.assertEqual(21, pool['total_capacity_gb']) |
| 364 | self.assertEqual(5, int(pool['free_capacity_gb'])) |
| 365 | |
| 366 | - self.assertTrue(pool['multiattach']) |
| 367 | + self.assertFalse(pool['multiattach']) |
| 368 | self.assertFalse(pool['QoS_support']) |
| 369 | self.assertFalse(pool['thick_provisioning_support']) |
| 370 | self.assertTrue(pool['thin_provisioning_support']) |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 371 | @@ -690,3 +949,179 @@ class StorPoolTestCase(test.TestCase): |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 372 | 'No such volume', |
| 373 | self.driver.revert_to_snapshot, None, |
| 374 | {'id': vol_id}, {'id': snap_id}) |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 375 | + |
| 376 | + @ddt.data( |
| 377 | + # The default values |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 378 | + ('', False, constants.STORPOOL, ISCSI_IQN_OURS, False), |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 379 | + |
| 380 | + # Export to all |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 381 | + ('*', True, constants.ISCSI, ISCSI_IQN_OURS, True), |
| 382 | + ('*', True, constants.ISCSI, ISCSI_IQN_OURS, True), |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 383 | + |
| 384 | + # Only export to the controller |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 385 | + ('', False, constants.STORPOOL, ISCSI_IQN_OURS, False), |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 386 | + |
| 387 | + # Some of the not-fully-supported pattern lists |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 388 | + (ISCSI_PAT_OTHER, False, constants.STORPOOL, ISCSI_IQN_OURS, False), |
| 389 | + (ISCSI_PAT_OTHER, False, constants.STORPOOL, ISCSI_IQN_OTHER, True), |
| 390 | + (ISCSI_PAT_BOTH, False, constants.STORPOOL, ISCSI_IQN_OURS, True), |
| 391 | + (ISCSI_PAT_BOTH, False, constants.STORPOOL, ISCSI_IQN_OTHER, True), |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 392 | + ) |
| 393 | + @ddt.unpack |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 394 | + def test_wants_iscsi(self, storpool_iscsi_export_to, use_iscsi, |
| 395 | + storage_protocol, hostname, expected): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 396 | + """Check the "should this export use iSCSI?" detection.""" |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 397 | + self.cfg.storpool_iscsi_export_to = storpool_iscsi_export_to |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 398 | + self._setup_test_driver() |
| 399 | + self.assertEqual(self.driver._use_iscsi, use_iscsi) |
| 400 | + |
| 401 | + # Make sure the driver reports the correct protocol in the stats |
| 402 | + self.driver._update_volume_stats() |
| 403 | + self.assertEqual(self.driver._stats["vendor_name"], "StorPool") |
| 404 | + self.assertEqual(self.driver._stats["storage_protocol"], |
| 405 | + storage_protocol) |
| 406 | + |
| 407 | + def check(conn, forced, expected): |
| 408 | + """Pass partially or completely valid connector info.""" |
| 409 | + for initiator in (None, hostname): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 410 | + for host in (None, ISCSI_IQN_THIRD): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 411 | + self.assertEqual( |
| 412 | + self.driver._connector_wants_iscsi({ |
| 413 | + "host": host, |
| 414 | + "initiator": initiator, |
| 415 | + **conn, |
| 416 | + }), |
| 417 | + expected if initiator is not None and host is not None |
| 418 | + else forced) |
| 419 | + |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 420 | + # If storpool_iscsi_cinder_volume is set and this is the controller, |
| 421 | + # then yes. |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 422 | + check({"storpool_wants_iscsi": True}, True, True) |
| 423 | + |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 424 | + # If storpool_iscsi_cinder_volume is not set or this is not the |
| 425 | + # controller, then look at the specified expected value. |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 426 | + check({"storpool_wants_iscsi": False}, use_iscsi, expected) |
| 427 | + check({}, use_iscsi, expected) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 428 | + |
| 429 | + def _validate_iscsi_config( |
| 430 | + self, |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 431 | + cfg: dict, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 432 | + res: dict[str, Any], |
| 433 | + tcase: IscsiTestCase, |
| 434 | + ) -> None: |
| 435 | + """Make sure the returned structure makes sense.""" |
| 436 | + initiator = res['initiator'] |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 437 | + cfg_initiator = cfg['initiators'].get('1') |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 438 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 439 | + self.assertIs(res['cfg']['iscsi'], cfg) |
| 440 | + self.assertEqual(res['pg']['name'], ISCSI_PORTAL_GROUP) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 441 | + |
| 442 | + if tcase.initiator is None: |
| 443 | + self.assertIsNone(initiator) |
| 444 | + else: |
| 445 | + self.assertIsNotNone(initiator) |
| 446 | + self.assertEqual(initiator, cfg_initiator) |
| 447 | + |
| 448 | + if tcase.volume is None: |
| 449 | + self.assertIsNone(res['target']) |
| 450 | + else: |
| 451 | + self.assertIsNotNone(res['target']) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 452 | + self.assertEqual(res['target'], cfg['targets'].get('1')) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 453 | + |
| 454 | + if tcase.initiator is None: |
| 455 | + self.assertIsNone(cfg_initiator) |
| 456 | + self.assertIsNone(res['export']) |
| 457 | + else: |
| 458 | + self.assertIsNotNone(cfg_initiator) |
| 459 | + if tcase.exported: |
| 460 | + self.assertIsNotNone(res['export']) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 461 | + self.assertEqual(res['export'], cfg_initiator['exports'][0]) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 462 | + else: |
| 463 | + self.assertIsNone(res['export']) |
| 464 | + |
| 465 | + @ddt.data(*_ISCSI_TEST_CASES) |
| 466 | + def test_iscsi_get_config(self, tcase: IscsiTestCase) -> None: |
| 467 | + """Make sure the StorPool iSCSI configuration is parsed correctly.""" |
| 468 | + cfg_orig = MockIscsiConfig.build(tcase) |
| 469 | + configs = [cfg_orig] |
| 470 | + iapi = MockIscsiAPI(configs, self) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 471 | + with mock.patch.object(self.driver, '_sp_api', iapi): |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 472 | + res = self.driver._get_iscsi_config( |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 473 | + ISCSI_IQN_OURS, |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 474 | + fake_constants.VOLUME_ID, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 475 | + ) |
| 476 | + |
| 477 | + self._validate_iscsi_config(cfg_orig, res, tcase) |
| 478 | + |
| 479 | + @ddt.data(*_ISCSI_TEST_CASES) |
| 480 | + def test_iscsi_create_export(self, tcase: IscsiTestCase) -> None: |
| 481 | + """Make sure _create_iscsi_export() makes the right API calls.""" |
| 482 | + cfg_orig = MockIscsiConfig.build(tcase) |
| 483 | + configs = [cfg_orig] |
| 484 | + iapi = MockIscsiAPI(configs, self) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 485 | + with mock.patch.object(self.driver, '_sp_api', iapi): |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 486 | + self.driver._create_iscsi_export( |
| 487 | + { |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 488 | + 'id': fake_constants.VOLUME_ID, |
| 489 | + 'display_name': fake_constants.VOLUME_NAME, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 490 | + }, |
| 491 | + { |
| 492 | + # Yeah, okay, so we cheat a little bit here... |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 493 | + 'host': ISCSI_IQN_OURS + '.hostname', |
| 494 | + 'initiator': ISCSI_IQN_OURS, |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 495 | + }, |
| 496 | + ) |
| 497 | + |
| 498 | + self.assertEqual(len(configs), tcase.commands_count + 1) |
| 499 | + cfg_final = configs[-1] |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 500 | + self.assertEqual(cfg_final['initiators']['1']['name'], ISCSI_IQN_OURS) |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 501 | + self.assertEqual( |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 502 | + cfg_final['initiators']['1']['exports'][0]['target'], |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 503 | + targetName(fake_constants.VOLUME_ID), |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 504 | + ) |
| 505 | + self.assertEqual( |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 506 | + cfg_final['targets']['1']['volume'], |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 507 | + volumeName(fake_constants.VOLUME_ID), |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 508 | + ) |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 509 | + |
| 510 | + @ddt.data(*_ISCSI_TEST_CASES) |
| 511 | + def test_remove_iscsi_export(self, tcase: IscsiTestCase): |
| 512 | + cfg_orig = MockIscsiConfig.build(tcase) |
| 513 | + configs = [cfg_orig] |
| 514 | + iapi = MockIscsiAPI(configs, self) |
| 515 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 516 | + def _target_exists(cfg: dict, volume: str) -> bool: |
| 517 | + for name, target in cfg['targets'].items(): |
| 518 | + if target['volume'] == volumeName(volume): |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 519 | + return True |
| 520 | + return False |
| 521 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 522 | + def _export_exists(cfg: dict, volume: str) -> bool: |
| 523 | + for name, initiator in cfg['initiators'].items(): |
| 524 | + for export in initiator['exports']: |
| 525 | + if export['target'] == targetName(volume): |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 526 | + return True |
| 527 | + return False |
| 528 | + |
| 529 | + if tcase.exported: |
| 530 | + self.assertTrue( |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 531 | + _target_exists(iapi.get_iscsi_config()['iscsi'], tcase.volume)) |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 532 | + self.assertTrue( |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 533 | + _export_exists(iapi.get_iscsi_config()['iscsi'], tcase.volume)) |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 534 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 535 | + with mock.patch.object(self.driver, '_sp_api', iapi): |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 536 | + self.driver._remove_iscsi_export( |
| 537 | + { |
Biser Milanov | ec3bf98 | 2024-11-27 17:42:17 +0200 | [diff] [blame] | 538 | + 'id': fake_constants.VOLUME_ID, |
| 539 | + 'display_name': fake_constants.VOLUME_NAME, |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 540 | + }, |
| 541 | + { |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 542 | + 'host': ISCSI_IQN_OURS + '.hostname', |
| 543 | + 'initiator': ISCSI_IQN_OURS, |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 544 | + }, |
| 545 | + ) |
| 546 | + |
| 547 | + self.assertFalse( |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 548 | + _target_exists(iapi.get_iscsi_config()['iscsi'], tcase.volume)) |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 549 | + self.assertFalse( |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 550 | + _export_exists(iapi.get_iscsi_config()['iscsi'], tcase.volume)) |
Peter Pentchev | acaaa38 | 2023-02-28 11:26:13 +0200 | [diff] [blame] | 551 | diff --git a/cinder/volume/drivers/storpool.py b/cinder/volume/drivers/storpool.py |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 552 | index 2dc7bb6be..acfabccd6 100644 |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 553 | --- a/cinder/volume/drivers/storpool.py |
| 554 | +++ b/cinder/volume/drivers/storpool.py |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 555 | @@ -15,6 +15,7 @@ |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 556 | |
Biser Milanov | da1b068 | 2024-11-29 09:37:10 +0200 | [diff] [blame] | 557 | """StorPool block device driver""" |
| 558 | |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 559 | +import fnmatch |
Biser Milanov | da1b068 | 2024-11-29 09:37:10 +0200 | [diff] [blame] | 560 | import platform |
Biser Milanov | 90b5a14 | 2024-11-28 11:33:39 +0200 | [diff] [blame] | 561 | |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 562 | from os_brick.initiator import storpool_utils |
| 563 | @@ -36,6 +37,32 @@ LOG = logging.getLogger(__name__) |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 564 | |
| 565 | |
| 566 | storpool_opts = [ |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 567 | + cfg.BoolOpt('storpool_iscsi_cinder_volume', |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 568 | + default=False, |
| 569 | + help='Let the cinder-volume service use iSCSI instead of ' |
| 570 | + 'the StorPool block device driver for accessing ' |
| 571 | + 'StorPool volumes, e.g. when creating a volume from ' |
| 572 | + 'an image or vice versa.'), |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 573 | + cfg.StrOpt('storpool_iscsi_export_to', |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 574 | + default='', |
| 575 | + help='Whether to export volumes using iSCSI. ' |
| 576 | + 'An empty string (the default) makes the driver export ' |
| 577 | + 'all volumes using the StorPool native network protocol. ' |
| 578 | + 'The value "*" makes the driver export all volumes using ' |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 579 | + 'iSCSI (see the Cinder StorPool driver documentation for ' |
| 580 | + 'how this option and ``storpool_iscsi_cinder_volume`` ' |
| 581 | + 'interact). Any other value leads to an experimental ' |
| 582 | + 'not fully supported configuration and is interpreted as ' |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 583 | + 'a whitespace-separated list of patterns for IQNs for ' |
| 584 | + 'hosts that need volumes to be exported via iSCSI, e.g. ' |
| 585 | + '"iqn.1991-05.com.microsoft:\\*" for Windows hosts.'), |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 586 | + cfg.BoolOpt('storpool_iscsi_learn_initiator_iqns', |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 587 | + default=True, |
| 588 | + help='Create a StorPool record for a new initiator as soon as ' |
| 589 | + 'Cinder asks for a volume to be exported to it.'), |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 590 | + cfg.StrOpt('storpool_iscsi_portal_group', |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 591 | + default=None, |
| 592 | + help='The portal group to export volumes via iSCSI in.'), |
| 593 | cfg.StrOpt('storpool_template', |
| 594 | default=None, |
| 595 | help='The StorPool template for volumes with no type.'), |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 596 | @@ -89,10 +116,10 @@ class StorPoolDriver(driver.VolumeDriver): |
| 597 | 2.1.0 - Use the new API client in os-brick to communicate with the |
| 598 | StorPool API instead of packages `storpool` and |
| 599 | `storpool.spopenstack` |
| 600 | - |
| 601 | + 2.2.0 - Add iSCSI export support. |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 602 | """ |
| 603 | |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 604 | - VERSION = '2.1.0' |
| 605 | + VERSION = '2.2.0' |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 606 | CI_WIKI_NAME = 'StorPool_distributed_storage_CI' |
| 607 | |
| 608 | def __init__(self, *args, **kwargs): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 609 | @@ -103,6 +130,7 @@ class StorPoolDriver(driver.VolumeDriver): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 610 | self._ourIdInt = None |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 611 | self._sp_api = None |
| 612 | self._volume_prefix = None |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 613 | + self._use_iscsi = False |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 614 | |
| 615 | @staticmethod |
| 616 | def get_driver_options(): |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 617 | @@ -158,10 +186,327 @@ class StorPoolDriver(driver.VolumeDriver): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 618 | raise StorPoolConfigurationInvalid( |
| 619 | section=hostname, param='SP_OURID', error=e) |
| 620 | |
| 621 | + def _connector_wants_iscsi(self, connector): |
| 622 | + """Should we do this export via iSCSI? |
| 623 | + |
| 624 | + Check the configuration to determine whether this connector is |
| 625 | + expected to provide iSCSI exports as opposed to native StorPool |
| 626 | + protocol ones. Match the initiator's IQN against the list of |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 627 | + patterns supplied in the "storpool_iscsi_export_to" configuration |
| 628 | + setting. |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 629 | + """ |
| 630 | + if connector is None: |
| 631 | + return False |
| 632 | + if self._use_iscsi: |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 633 | + LOG.debug('forcing iSCSI for all exported volumes') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 634 | + return True |
| 635 | + if connector.get('storpool_wants_iscsi'): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 636 | + LOG.debug('forcing iSCSI for the controller') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 637 | + return True |
| 638 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 639 | + iqn = connector.get('initiator', None) |
| 640 | + host = connector.get('host', None) |
| 641 | + |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 642 | + if iqn is None or host is None: |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 643 | + LOG.debug('this connector certainly does not want iSCSI') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 644 | + return False |
| 645 | + |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 646 | + LOG.debug('check whether %(host)s (%(iqn)s) wants iSCSI', |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 647 | + { |
| 648 | + 'host': host, |
| 649 | + 'iqn': iqn, |
| 650 | + }) |
| 651 | + |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 652 | + export_to = self.configuration.storpool_iscsi_export_to |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 653 | + if export_to is None: |
| 654 | + return False |
| 655 | + |
| 656 | + for pat in export_to.split(): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 657 | + LOG.debug('matching against %(pat)s', {'pat': pat}) |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 658 | + if fnmatch.fnmatch(iqn, pat): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 659 | + LOG.debug('got it!') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 660 | + return True |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 661 | + LOG.debug('nope') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 662 | + return False |
| 663 | + |
| 664 | def validate_connector(self, connector): |
| 665 | + if self._connector_wants_iscsi(connector): |
| 666 | + return True |
| 667 | return self._storpool_client_id(connector) >= 0 |
| 668 | |
| 669 | + def _get_iscsi_config(self, iqn, volume_id): |
| 670 | + """Get the StorPool iSCSI config items pertaining to this volume. |
| 671 | + |
| 672 | + Find the elements of the StorPool iSCSI configuration tree that |
| 673 | + will be needed to create, ensure, or remove the iSCSI export of |
| 674 | + the specified volume to the specified initiator. |
| 675 | + """ |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 676 | + cfg = self._sp_api.get_iscsi_config() |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 677 | + |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 678 | + pg_name = self.configuration.storpool_iscsi_portal_group |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 679 | + pg_found = [ |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 680 | + pg for pg in |
| 681 | + cfg['iscsi']['portalGroups'].values() if pg['name'] == pg_name |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 682 | + ] |
| 683 | + if not pg_found: |
| 684 | + raise Exception('StorPool Cinder iSCSI configuration error: ' |
| 685 | + 'no portal group "{pg}"'.format(pg=pg_name)) |
| 686 | + pg = pg_found[0] |
| 687 | + |
| 688 | + # Do we know about this initiator? |
| 689 | + i_found = [ |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 690 | + init for init in |
| 691 | + cfg['iscsi']['initiators'].values() if init['name'] == iqn |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 692 | + ] |
| 693 | + if i_found: |
| 694 | + initiator = i_found[0] |
| 695 | + else: |
| 696 | + initiator = None |
| 697 | + |
| 698 | + # Is this volume already being exported? |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 699 | + volname = storpool_utils.os_to_sp_volume_name( |
| 700 | + self._volume_prefix, volume_id) |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 701 | + t_found = [ |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 702 | + tgt for tgt in |
| 703 | + cfg['iscsi']['targets'].values() if tgt['volume'] == volname |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 704 | + ] |
| 705 | + if t_found: |
| 706 | + target = t_found[0] |
| 707 | + else: |
| 708 | + target = None |
| 709 | + |
| 710 | + # OK, so is this volume being exported to this initiator? |
| 711 | + export = None |
| 712 | + if initiator is not None and target is not None: |
| 713 | + e_found = [ |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 714 | + exp for exp in initiator['exports'] |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 715 | + if (exp['portalGroup'] == pg['name'] and |
| 716 | + exp['target'] == target['name']) |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 717 | + ] |
| 718 | + if e_found: |
| 719 | + export = e_found[0] |
| 720 | + |
| 721 | + return { |
| 722 | + 'cfg': cfg, |
| 723 | + 'pg': pg, |
| 724 | + 'initiator': initiator, |
| 725 | + 'target': target, |
| 726 | + 'export': export, |
| 727 | + 'volume_name': volname, |
| 728 | + 'volume_id': volume_id, |
| 729 | + } |
| 730 | + |
| 731 | + def _create_iscsi_export(self, volume, connector): |
| 732 | + """Create (if needed) an iSCSI export for the StorPool volume.""" |
| 733 | + LOG.debug( |
| 734 | + '_create_iscsi_export() invoked for volume ' |
| 735 | + '"%(vol_name)s" (%(vol_id)s) connector %(connector)s', |
| 736 | + { |
| 737 | + 'vol_name': volume['display_name'], |
| 738 | + 'vol_id': volume['id'], |
| 739 | + 'connector': connector, |
| 740 | + } |
| 741 | + ) |
| 742 | + iqn = connector['initiator'] |
| 743 | + try: |
| 744 | + cfg = self._get_iscsi_config(iqn, volume['id']) |
| 745 | + except Exception as exc: |
| 746 | + LOG.error( |
| 747 | + 'Could not fetch the iSCSI config: %(exc)s', {'exc': exc} |
| 748 | + ) |
| 749 | + raise |
| 750 | + |
| 751 | + if cfg['initiator'] is None: |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 752 | + if not (self.configuration.storpool_iscsi_learn_initiator_iqns or |
| 753 | + self.configuration.storpool_iscsi_cinder_volume and |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 754 | + connector.get('storpool_wants_iscsi')): |
| 755 | + raise Exception('The "{iqn}" initiator IQN for the "{host}" ' |
| 756 | + 'host is not defined in the StorPool ' |
| 757 | + 'configuration.' |
| 758 | + .format(iqn=iqn, host=connector['host'])) |
| 759 | + else: |
| 760 | + LOG.info('Creating a StorPool iSCSI initiator ' |
| 761 | + 'for "{host}s" ({iqn}s)', |
| 762 | + {'host': connector['host'], 'iqn': iqn}) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 763 | + self._sp_api.post_iscsi_config({ |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 764 | + 'commands': [ |
| 765 | + { |
| 766 | + 'createInitiator': { |
| 767 | + 'name': iqn, |
| 768 | + 'username': '', |
| 769 | + 'secret': '', |
| 770 | + }, |
| 771 | + }, |
| 772 | + { |
| 773 | + 'initiatorAddNetwork': { |
| 774 | + 'initiator': iqn, |
| 775 | + 'net': '0.0.0.0/0', |
| 776 | + }, |
| 777 | + }, |
| 778 | + ] |
| 779 | + }) |
| 780 | + |
| 781 | + if cfg['target'] is None: |
| 782 | + LOG.info( |
| 783 | + 'Creating a StorPool iSCSI target ' |
| 784 | + 'for the "%(vol_name)s" volume (%(vol_id)s)', |
| 785 | + { |
| 786 | + 'vol_name': volume['display_name'], |
| 787 | + 'vol_id': volume['id'], |
| 788 | + } |
| 789 | + ) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 790 | + self._sp_api.post_iscsi_config({ |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 791 | + 'commands': [ |
| 792 | + { |
| 793 | + 'createTarget': { |
| 794 | + 'volumeName': cfg['volume_name'], |
| 795 | + }, |
| 796 | + }, |
| 797 | + ] |
| 798 | + }) |
| 799 | + cfg = self._get_iscsi_config(iqn, volume['id']) |
| 800 | + |
| 801 | + if cfg['export'] is None: |
| 802 | + LOG.info('Creating a StorPool iSCSI export ' |
| 803 | + 'for the "{vol_name}s" volume ({vol_id}s) ' |
| 804 | + 'to the "{host}s" initiator ({iqn}s) ' |
| 805 | + 'in the "{pg}s" portal group', |
| 806 | + { |
| 807 | + 'vol_name': volume['display_name'], |
| 808 | + 'vol_id': volume['id'], |
| 809 | + 'host': connector['host'], |
| 810 | + 'iqn': iqn, |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 811 | + 'pg': cfg['pg']['name'] |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 812 | + }) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 813 | + self._sp_api.post_iscsi_config({ |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 814 | + 'commands': [ |
| 815 | + { |
| 816 | + 'export': { |
| 817 | + 'initiator': iqn, |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 818 | + 'portalGroup': cfg['pg']['name'], |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 819 | + 'volumeName': cfg['volume_name'], |
| 820 | + }, |
| 821 | + }, |
| 822 | + ] |
| 823 | + }) |
| 824 | + |
Peter Pentchev | c53e6c0 | 2023-02-08 15:13:56 +0200 | [diff] [blame] | 825 | + target_portals = [ |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 826 | + "{addr}:3260".format(addr=net['address']) |
| 827 | + for net in cfg['pg']['networks'] |
Peter Pentchev | c53e6c0 | 2023-02-08 15:13:56 +0200 | [diff] [blame] | 828 | + ] |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 829 | + target_iqns = [cfg['target']['name']] * len(target_portals) |
Peter Pentchev | c53e6c0 | 2023-02-08 15:13:56 +0200 | [diff] [blame] | 830 | + target_luns = [0] * len(target_portals) |
| 831 | + if connector.get('multipath', False): |
| 832 | + multipath_settings = { |
| 833 | + 'target_iqns': target_iqns, |
| 834 | + 'target_portals': target_portals, |
| 835 | + 'target_luns': target_luns, |
| 836 | + } |
| 837 | + else: |
| 838 | + multipath_settings = {} |
| 839 | + |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 840 | + res = { |
| 841 | + 'driver_volume_type': 'iscsi', |
| 842 | + 'data': { |
Peter Pentchev | c53e6c0 | 2023-02-08 15:13:56 +0200 | [diff] [blame] | 843 | + **multipath_settings, |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 844 | + 'target_discovered': False, |
Peter Pentchev | c53e6c0 | 2023-02-08 15:13:56 +0200 | [diff] [blame] | 845 | + 'target_iqn': target_iqns[0], |
| 846 | + 'target_portal': target_portals[0], |
| 847 | + 'target_lun': target_luns[0], |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 848 | + 'volume_id': volume['id'], |
| 849 | + 'discard': True, |
| 850 | + }, |
| 851 | + } |
| 852 | + LOG.debug('returning %(res)s', {'res': res}) |
| 853 | + return res |
| 854 | + |
| 855 | + def _remove_iscsi_export(self, volume, connector): |
| 856 | + """Remove an iSCSI export for the specified StorPool volume.""" |
| 857 | + LOG.debug( |
| 858 | + '_remove_iscsi_export() invoked for volume ' |
| 859 | + '"%(vol_name)s" (%(vol_id)s) connector %(conn)s', |
| 860 | + { |
| 861 | + 'vol_name': volume['display_name'], |
| 862 | + 'vol_id': volume['id'], |
| 863 | + 'conn': connector, |
| 864 | + } |
| 865 | + ) |
| 866 | + try: |
| 867 | + cfg = self._get_iscsi_config(connector['initiator'], volume['id']) |
| 868 | + except Exception as exc: |
| 869 | + LOG.error( |
| 870 | + 'Could not fetch the iSCSI config: %(exc)s', {'exc': exc} |
| 871 | + ) |
| 872 | + raise |
| 873 | + |
| 874 | + if cfg['export'] is not None: |
| 875 | + LOG.info('Removing the StorPool iSCSI export ' |
| 876 | + 'for the "%(vol_name)s" volume (%(vol_id)s) ' |
| 877 | + 'to the "%(host)s" initiator (%(iqn)s) ' |
| 878 | + 'in the "%(pg)s" portal group', |
| 879 | + { |
| 880 | + 'vol_name': volume['display_name'], |
| 881 | + 'vol_id': volume['id'], |
| 882 | + 'host': connector['host'], |
| 883 | + 'iqn': connector['initiator'], |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 884 | + 'pg': cfg['pg']['name'], |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 885 | + }) |
| 886 | + try: |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 887 | + self._sp_api.post_iscsi_config({ |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 888 | + 'commands': [ |
| 889 | + { |
| 890 | + 'exportDelete': { |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 891 | + 'initiator': cfg['initiator']['name'], |
| 892 | + 'portalGroup': cfg['pg']['name'], |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 893 | + 'volumeName': cfg['volume_name'], |
| 894 | + }, |
| 895 | + }, |
| 896 | + ] |
| 897 | + }) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 898 | + except storpool_utils.StorPoolAPIError as e: |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 899 | + if e.name not in ('objectExists', 'objectDoesNotExist'): |
| 900 | + raise |
| 901 | + LOG.info('Looks like somebody beat us to it') |
| 902 | + |
| 903 | + if cfg['target'] is not None: |
| 904 | + last = True |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 905 | + for initiator in cfg['cfg']['iscsi']['initiators'].values(): |
| 906 | + if initiator['name'] == cfg['initiator']['name']: |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 907 | + continue |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 908 | + for exp in initiator['exports']: |
| 909 | + if exp['target'] == cfg['target']['name']: |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 910 | + last = False |
| 911 | + break |
| 912 | + if not last: |
| 913 | + break |
| 914 | + |
| 915 | + if last: |
| 916 | + LOG.info( |
| 917 | + 'Removing the StorPool iSCSI target ' |
| 918 | + 'for the "{vol_name}s" volume ({vol_id}s)', |
| 919 | + { |
| 920 | + 'vol_name': volume['display_name'], |
| 921 | + 'vol_id': volume['id'], |
| 922 | + } |
| 923 | + ) |
| 924 | + try: |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 925 | + self._sp_api.post_iscsi_config({ |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 926 | + 'commands': [ |
| 927 | + { |
| 928 | + 'deleteTarget': { |
| 929 | + 'volumeName': cfg['volume_name'], |
| 930 | + }, |
| 931 | + }, |
| 932 | + ] |
| 933 | + }) |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 934 | + except storpool_utils.StorPoolAPIError as e: |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 935 | + if e.name not in ('objectDoesNotExist', 'invalidParam'): |
| 936 | + raise |
| 937 | + LOG.info('Looks like somebody beat us to it') |
| 938 | + |
| 939 | def initialize_connection(self, volume, connector): |
| 940 | + if self._connector_wants_iscsi(connector): |
| 941 | + return self._create_iscsi_export(volume, connector) |
| 942 | return {'driver_volume_type': 'storpool', |
| 943 | 'data': { |
| 944 | 'client_id': self._storpool_client_id(connector), |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 945 | @@ -170,6 +515,9 @@ class StorPoolDriver(driver.VolumeDriver): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 946 | }} |
| 947 | |
| 948 | def terminate_connection(self, volume, connector, **kwargs): |
| 949 | + if self._connector_wants_iscsi(connector): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 950 | + LOG.debug('removing an iSCSI export') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 951 | + self._remove_iscsi_export(volume, connector) |
| 952 | pass |
| 953 | |
| 954 | def create_snapshot(self, snapshot): |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 955 | @@ -278,11 +626,20 @@ class StorPoolDriver(driver.VolumeDriver): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 956 | ) |
| 957 | |
| 958 | def create_export(self, context, volume, connector): |
| 959 | - pass |
| 960 | + if self._connector_wants_iscsi(connector): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 961 | + LOG.debug('creating an iSCSI export') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 962 | + self._create_iscsi_export(volume, connector) |
| 963 | |
| 964 | def remove_export(self, context, volume): |
| 965 | pass |
| 966 | |
| 967 | + def _attach_volume(self, context, volume, properties, remote=False): |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 968 | + if self.configuration.storpool_iscsi_cinder_volume and not remote: |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 969 | + LOG.debug('adding the "storpool_wants_iscsi" flag') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 970 | + properties['storpool_wants_iscsi'] = True |
| 971 | + |
| 972 | + return super()._attach_volume(context, volume, properties, remote) |
| 973 | + |
| 974 | def delete_volume(self, volume): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 975 | name = storpool_utils.os_to_sp_volume_name( |
| 976 | self._volume_prefix, volume['id']) |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 977 | @@ -321,6 +678,17 @@ class StorPoolDriver(driver.VolumeDriver): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 978 | LOG.error("StorPoolDriver API initialization failed: %s", e) |
| 979 | raise |
| 980 | |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 981 | + export_to = self.configuration.storpool_iscsi_export_to |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 982 | + export_to_set = export_to is not None and export_to.split() |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 983 | + vol_iscsi = self.configuration.storpool_iscsi_cinder_volume |
| 984 | + pg_name = self.configuration.storpool_iscsi_portal_group |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 985 | + if (export_to_set or vol_iscsi) and pg_name is None: |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 986 | + msg = _('The "storpool_iscsi_portal_group" option is required if ' |
| 987 | + 'any patterns are listed in "storpool_iscsi_export_to"') |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 988 | + raise exception.VolumeDriverException(message=msg) |
| 989 | + |
| 990 | + self._use_iscsi = export_to == "*" |
| 991 | + |
| 992 | def _update_volume_stats(self): |
| 993 | try: |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 994 | dl = self._sp_api.disks_list() |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 995 | @@ -346,7 +714,7 @@ class StorPoolDriver(driver.VolumeDriver): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 996 | 'total_capacity_gb': total / units.Gi, |
| 997 | 'free_capacity_gb': free / units.Gi, |
| 998 | 'reserved_percentage': 0, |
| 999 | - 'multiattach': True, |
Peter Pentchev | 5a9f8a6 | 2023-12-06 10:40:18 +0200 | [diff] [blame] | 1000 | + 'multiattach': self._use_iscsi, |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1001 | 'QoS_support': False, |
| 1002 | 'thick_provisioning_support': False, |
| 1003 | 'thin_provisioning_support': True, |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 1004 | @@ -365,7 +733,9 @@ class StorPoolDriver(driver.VolumeDriver): |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1005 | 'volume_backend_name') or 'storpool', |
| 1006 | 'vendor_name': 'StorPool', |
| 1007 | 'driver_version': self.VERSION, |
| 1008 | - 'storage_protocol': constants.STORPOOL, |
| 1009 | + 'storage_protocol': ( |
| 1010 | + constants.ISCSI if self._use_iscsi else constants.STORPOOL |
| 1011 | + ), |
Peter Pentchev | acaaa38 | 2023-02-28 11:26:13 +0200 | [diff] [blame] | 1012 | # Driver capabilities |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1013 | 'clone_across_pools': True, |
| 1014 | 'sparse_copy_volume': True, |
Biser Milanov | c6c42e0 | 2025-01-27 14:52:39 +0200 | [diff] [blame^] | 1015 | @@ -452,15 +822,15 @@ class StorPoolDriver(driver.VolumeDriver): |
Biser Milanov | 233be15 | 2025-01-24 17:35:11 +0200 | [diff] [blame] | 1016 | LOG.debug('Trying to swap volume names, intermediate "%(int)s"', |
| 1017 | {'int': int_name}) |
| 1018 | try: |
| 1019 | - LOG.debug('- rename "%(orig)s" to "%(int)s"', |
| 1020 | + LOG.debug('rename "%(orig)s" to "%(int)s"', |
| 1021 | {'orig': orig_name, 'int': int_name}) |
| 1022 | self._sp_api.volume_update(orig_name, {'rename': int_name}) |
| 1023 | |
| 1024 | - LOG.debug('- rename "%(temp)s" to "%(orig)s"', |
| 1025 | + LOG.debug('rename "%(temp)s" to "%(orig)s"', |
| 1026 | {'temp': temp_name, 'orig': orig_name}) |
| 1027 | self._sp_api.volume_update(temp_name, {'rename': orig_name}) |
| 1028 | |
| 1029 | - LOG.debug('- rename "%(int)s" to "%(temp)s"', |
| 1030 | + LOG.debug('rename "%(int)s" to "%(temp)s"', |
| 1031 | {'int': int_name, 'temp': temp_name}) |
| 1032 | self._sp_api.volume_update(int_name, {'rename': temp_name}) |
| 1033 | return {'_name_id': None} |
Peter Pentchev | acaaa38 | 2023-02-28 11:26:13 +0200 | [diff] [blame] | 1034 | diff --git a/doc/source/configuration/block-storage/drivers/storpool-volume-driver.rst b/doc/source/configuration/block-storage/drivers/storpool-volume-driver.rst |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1035 | index d2c5895a9..936e83675 100644 |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1036 | --- a/doc/source/configuration/block-storage/drivers/storpool-volume-driver.rst |
| 1037 | +++ b/doc/source/configuration/block-storage/drivers/storpool-volume-driver.rst |
Peter Pentchev | acaaa38 | 2023-02-28 11:26:13 +0200 | [diff] [blame] | 1038 | @@ -19,12 +19,15 @@ Prerequisites |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1039 | * The controller and all the compute nodes must have access to the StorPool |
| 1040 | API service. |
| 1041 | |
| 1042 | -* All nodes where StorPool-backed volumes will be attached must have access to |
| 1043 | +* If iSCSI is not being used as a transport (see below), all nodes where |
| 1044 | + StorPool-backed volumes will be attached must have access to |
| 1045 | the StorPool data network and run the ``storpool_block`` service. |
| 1046 | |
| 1047 | -* If StorPool-backed Cinder volumes need to be created directly from Glance |
| 1048 | - images, then the node running the ``cinder-volume`` service must also have |
| 1049 | - access to the StorPool data network and run the ``storpool_block`` service. |
| 1050 | +* If Glance uses Cinder as its image store, or if StorPool-backed Cinder |
| 1051 | + volumes need to be created directly from Glance images, and iSCSI is not |
| 1052 | + being used as a transport, then the node running the ``cinder-volume`` |
| 1053 | + service must also have access to the StorPool data network and run |
| 1054 | + the ``storpool_block`` service. |
| 1055 | |
| 1056 | * All nodes that need to access the StorPool API (the compute nodes and |
| 1057 | the node running the ``cinder-volume`` service) must have the following |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1058 | @@ -34,6 +37,34 @@ Prerequisites |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1059 | * the storpool Python bindings package |
| 1060 | * the storpool.spopenstack Python helper package |
| 1061 | |
| 1062 | +Using iSCSI as the transport protocol |
| 1063 | +------------------------------------- |
| 1064 | + |
| 1065 | +The StorPool distributed storage system uses its own, highly optimized and |
| 1066 | +tailored for its specifics, network protocol for communication between |
| 1067 | +the storage servers and the clients (the OpenStack cluster nodes where |
| 1068 | +StorPool-backed volumes will be attached). There are cases when granting |
| 1069 | +various nodes access to the StorPool data network or installing and |
| 1070 | +running the ``storpool_block`` client service on them may pose difficulties. |
| 1071 | +The StorPool servers may also expose the user-created volumes and snapshots |
| 1072 | +using the standard iSCSI protocol that only requires TCP routing and |
| 1073 | +connectivity between the storage servers and the StorPool clients. |
| 1074 | +The StorPool Cinder driver may be configured to export volumes and |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1075 | +snapshots via iSCSI using the ``storpool_iscsi_export_to`` and |
| 1076 | +``storpool_iscsi_portal_group`` configuration options. |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1077 | + |
| 1078 | +Additionally, even if e.g. the hypervisor nodes running Nova will use |
| 1079 | +the StorPool network protocol and run the ``storpool_block`` service |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1080 | +(so the ``storpool_iscsi_export_to`` option has its default empty string |
| 1081 | +value), the ``storpool_iscsi_cinder_volume`` option configures the |
| 1082 | +StorPool Cinder driver so that only the ``cinder-volume`` service will |
| 1083 | +use the iSCSI protocol when attaching volumes and snapshots to transfer |
| 1084 | +data to and from Glance images. |
Biser Milanov | d684c1c | 2024-11-22 12:12:59 +0200 | [diff] [blame] | 1085 | + |
| 1086 | +Multiattach support for StorPool is only enabled if iSCSI is used: |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1087 | +``storpool_iscsi_export_to`` is set to ``*``, that is, when all StorPool |
| 1088 | +volumes will be exported via iSCSI to all initiators. |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1089 | + |
| 1090 | Configuring the StorPool volume driver |
| 1091 | -------------------------------------- |
| 1092 | |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1093 | @@ -55,6 +86,35 @@ volume backend definition) and per volume type: |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1094 | with the default placement constraints for the StorPool cluster. |
| 1095 | The default value for the chain replication is 3. |
| 1096 | |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 1097 | +In addition, if the iSCSI protocol is used to access the StorPool cluster as |
| 1098 | +described in the previous section, the following options may be defined in |
| 1099 | +the ``cinder.conf`` volume backend definition: |
| 1100 | + |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1101 | +- ``storpool_iscsi_export_to``: if set to the value ``*``, the StorPool |
| 1102 | + Cinder driver will export volumes and snapshots using the iSCSI |
| 1103 | + protocol instead of the StorPool network protocol. The |
| 1104 | + ``storpool_iscsi_portal_group`` option must also be specified. |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1105 | + |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1106 | +- ``storpool_iscsi_portal_group``: if the ``storpool_iscsi_export_to`` |
| 1107 | + option is set to the value ``*`` or the |
| 1108 | + ``storpool_iscsi_cinder_volume`` option is turned on, this option |
| 1109 | + specifies the name of the iSCSI portal group that Cinder volumes will |
| 1110 | + be exported to. |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1111 | + |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1112 | +- ``storpool_iscsi_cinder_volume``: if enabled, even if the |
| 1113 | + ``storpool_iscsi_export_to`` option has its default empty value, the |
| 1114 | + ``cinder-volume`` service will use iSCSI to attach the volumes and |
| 1115 | + snapshots for transferring data to and from Glance images if Glance is |
| 1116 | + configured to use the Cinder glance_store. |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1117 | + |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1118 | +- ``storpool_iscsi_learn_initiator_iqns``: if enabled, the StorPool |
| 1119 | + Cinder driver will automatically use the StorPool API to create |
| 1120 | + definitions for new initiators in the StorPool cluster's |
| 1121 | + configuration. This is the default behavior of the driver; it may be |
| 1122 | + disabled in the rare case if, e.g. because of site policy, OpenStack |
| 1123 | + iSCSI initiators (e.g. Nova hypervisors) need to be explicitly allowed |
| 1124 | + to use the StorPool iSCSI targets. |
Peter Pentchev | ea35446 | 2023-07-18 11:15:56 +0300 | [diff] [blame] | 1125 | + |
Peter Pentchev | 9c24be9 | 2022-09-26 22:35:24 +0300 | [diff] [blame] | 1126 | Using the StorPool volume driver |
| 1127 | -------------------------------- |
| 1128 | |
Biser Milanov | c0ee358 | 2025-01-22 09:09:24 +0000 | [diff] [blame] | 1129 | diff --git a/releasenotes/notes/storpool-iscsi-cefcfe590a07c5c7.yaml b/releasenotes/notes/storpool-iscsi-cefcfe590a07c5c7.yaml |
| 1130 | new file mode 100644 |
| 1131 | index 000000000..3863e4099 |
| 1132 | --- /dev/null |
| 1133 | +++ b/releasenotes/notes/storpool-iscsi-cefcfe590a07c5c7.yaml |
| 1134 | @@ -0,0 +1,15 @@ |
| 1135 | +features: |
| 1136 | + - | |
| 1137 | + StorPool driver: Added support for exporting the StorPool-backed |
| 1138 | + volumes using the iSCSI protocol, so that the Cinder volume service |
| 1139 | + and/or the Nova or Glance consumers do not need to have the StorPool |
| 1140 | + block device third-party service installed. See the StorPool driver |
| 1141 | + section in the Cinder documentation for more information on the |
| 1142 | + ``storpool_iscsi_export_to``, ``storpool_iscsi_portal_group``, |
| 1143 | + ``storpool_iscsi_cinder_volume``, and |
| 1144 | + ``storpool_iscsi_learn_initiator_iqns`` options. |
| 1145 | + |
| 1146 | + .. note:: |
| 1147 | + Multiattach support for StorPool is now only enabled if |
| 1148 | + ``storpool_iscsi_export_to`` is set to ``*``, that is, when all |
| 1149 | + StorPool volumes will be exported via iSCSI to all initiators. |
| 1150 | -- |
| 1151 | 2.43.0 |
| 1152 | |