Drop support for --allow-multiattach

The ability to enable multiattach on the command line was deprecated in
Queens with the full implementation of multiattach enabling it through
volume type extra specs. This removes the command line arg and handling
for specifying it with volume creation.

Change-Id: Ifc0c874657f959266050cd1a7a40e6ecccc8c114
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis
2019-04-18 12:22:19 -05:00
committed by Brian Rosmaita
parent 61fec71adb
commit 3c1b417959
12 changed files with 19 additions and 70 deletions

View File

@@ -17,7 +17,8 @@ from cinderclient.tests.functional import base
class CinderVolumeTests(base.ClientTestBase): class CinderVolumeTests(base.ClientTestBase):
"""Check of base cinder volume commands.""" """Check of base cinder volume commands."""
CREATE_VOLUME_PROPERTY = ('attachments', 'multiattach', CREATE_VOLUME_PROPERTY = (
'attachments',
'os-vol-tenant-attr:tenant_id', 'os-vol-tenant-attr:tenant_id',
'availability_zone', 'bootable', 'availability_zone', 'bootable',
'created_at', 'description', 'encrypted', 'id', 'created_at', 'description', 'encrypted', 'id',

View File

@@ -10,11 +10,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import unittest
import ddt import ddt
import six import six
from tempest.lib import exceptions from tempest.lib import exceptions
from cinderclient.tests.functional import base from cinderclient.tests.functional import base
@@ -91,17 +88,6 @@ class CinderVolumeTestsWithParameters(base.ClientTestBase):
format(volume_description)) format(volume_description))
self.assertEqual(volume_description, volume['description']) self.assertEqual(volume_description, volume['description'])
@unittest.skip("Skip until multiattach will be supported")
def test_volume_create_multiattach(self):
"""Test steps:
1) create volume and allow multiattach
2) check that multiattach is true
"""
volume = self.object_create('volume',
params='--allow-multiattach 1')
self.assertEqual('True', volume['multiattach'])
def test_volume_create_metadata(self): def test_volume_create_metadata(self):
"""Test steps: """Test steps:

View File

@@ -56,7 +56,6 @@ def _stub_volume(*args, **kwargs):
"metadata": {}, "metadata": {},
"status": "available", "status": "available",
'description': None, 'description': None,
"multiattach": "false",
"os-volume-replication:driver_data": None, "os-volume-replication:driver_data": None,
"source_volid": None, "source_volid": None,
"consistencygroup_id": None, "consistencygroup_id": None,

View File

@@ -105,7 +105,7 @@ class ShellTest(utils.TestCase):
'metadata': {'key1': '"--test1"'}, 'metadata': {'key1': '"--test1"'},
'volume_type': None, 'volume_type': None,
'description': None, 'description': None,
'multiattach': False}} }}
self.assert_called_anytime('POST', '/volumes', expected) self.assert_called_anytime('POST', '/volumes', expected)
def test_metadata_args_limiter_display_name(self): def test_metadata_args_limiter_display_name(self):
@@ -121,7 +121,7 @@ class ShellTest(utils.TestCase):
'metadata': {'key1': '"--t1"'}, 'metadata': {'key1': '"--t1"'},
'volume_type': None, 'volume_type': None,
'description': None, 'description': None,
'multiattach': False}} }}
self.assert_called_anytime('POST', '/volumes', expected) self.assert_called_anytime('POST', '/volumes', expected)
def test_delimit_metadata_args(self): def test_delimit_metadata_args(self):
@@ -137,7 +137,7 @@ class ShellTest(utils.TestCase):
'key2': '"test2"'}, 'key2': '"test2"'},
'volume_type': None, 'volume_type': None,
'description': None, 'description': None,
'multiattach': False}} }}
self.assert_called_anytime('POST', '/volumes', expected) self.assert_called_anytime('POST', '/volumes', expected)
def test_delimit_metadata_args_display_name(self): def test_delimit_metadata_args_display_name(self):
@@ -153,7 +153,7 @@ class ShellTest(utils.TestCase):
'metadata': {'key1': '"t1"'}, 'metadata': {'key1': '"t1"'},
'volume_type': None, 'volume_type': None,
'description': None, 'description': None,
'multiattach': False}} }}
self.assert_called_anytime('POST', '/volumes', expected) self.assert_called_anytime('POST', '/volumes', expected)
def test_list_filter_status(self): def test_list_filter_status(self):

View File

@@ -100,7 +100,7 @@ class VolumesTest(utils.TestCase):
'volume_type': None, 'volume_type': None,
'metadata': {}, 'metadata': {},
'consistencygroup_id': None, 'consistencygroup_id': None,
'multiattach': False}, },
'OS-SCH-HNT:scheduler_hints': 'uuid'} 'OS-SCH-HNT:scheduler_hints': 'uuid'}
cs.assert_called('POST', '/volumes', body=expected) cs.assert_called('POST', '/volumes', body=expected)
self._assert_request_id(vol) self._assert_request_id(vol)

View File

@@ -658,7 +658,6 @@ class ShellTest(utils.TestCase):
'metadata': {}, 'metadata': {},
'volume_type': '4321', 'volume_type': '4321',
'description': None, 'description': None,
'multiattach': False,
'backup_id': None}} 'backup_id': None}}
self.assert_called_anytime('POST', '/volumes', expected) self.assert_called_anytime('POST', '/volumes', expected)
@@ -681,7 +680,6 @@ class ShellTest(utils.TestCase):
'metadata': {}, 'metadata': {},
'volume_type': None, 'volume_type': None,
'description': None, 'description': None,
'multiattach': False,
'backup_id': None}} 'backup_id': None}}
expected['volume'].update(update) expected['volume'].update(update)
self.assert_called_anytime('POST', '/volumes', body=expected) self.assert_called_anytime('POST', '/volumes', body=expected)

View File

@@ -83,7 +83,6 @@ class VolumesTest(utils.TestCase):
'volume_type': '5678', 'volume_type': '5678',
'metadata': {}, 'metadata': {},
'consistencygroup_id': None, 'consistencygroup_id': None,
'multiattach': False,
'group_id': '1234', 'group_id': '1234',
'backup_id': None}} 'backup_id': None}}
cs.assert_called('POST', '/volumes', body=expected) cs.assert_called('POST', '/volumes', body=expected)

View File

@@ -292,12 +292,6 @@ class CheckSizeArgForCreate(argparse.Action):
help='Scheduler hint, similar to nova. Repeat option to set ' help='Scheduler hint, similar to nova. Repeat option to set '
'multiple hints. Values with the same key will be stored ' 'multiple hints. Values with the same key will be stored '
'as a list.') 'as a list.')
@utils.arg('--allow-multiattach',
dest='multiattach',
action="store_true",
help=('Allow volume to be attached more than once. (DEPRECATED)'
' Default=False'),
default=False)
def do_create(cs, args): def do_create(cs, args):
"""Creates a volume.""" """Creates a volume."""
# NOTE(thingee): Backwards-compatibility with v1 args # NOTE(thingee): Backwards-compatibility with v1 args
@@ -339,8 +333,7 @@ def do_create(cs, args):
availability_zone=args.availability_zone, availability_zone=args.availability_zone,
imageRef=image_ref, imageRef=image_ref,
metadata=volume_metadata, metadata=volume_metadata,
scheduler_hints=hints, scheduler_hints=hints)
multiattach=args.multiattach)
info = dict() info = dict()
volume = cs.volumes.get(volume.id) volume = cs.volumes.get(volume.id)

View File

@@ -15,8 +15,6 @@
"""Volume interface (v2 extension).""" """Volume interface (v2 extension)."""
import warnings
from cinderclient.apiclient import base as common_base from cinderclient.apiclient import base as common_base
from cinderclient import base from cinderclient import base
@@ -233,8 +231,7 @@ class VolumeManager(base.ManagerWithFind):
source_volid=None, name=None, description=None, source_volid=None, name=None, description=None,
volume_type=None, user_id=None, volume_type=None, user_id=None,
project_id=None, availability_zone=None, project_id=None, availability_zone=None,
metadata=None, imageRef=None, scheduler_hints=None, metadata=None, imageRef=None, scheduler_hints=None):
multiattach=False):
"""Create a volume. """Create a volume.
:param size: Size of volume in GB :param size: Size of volume in GB
@@ -251,8 +248,6 @@ class VolumeManager(base.ManagerWithFind):
:param source_volid: ID of source volume to clone from :param source_volid: ID of source volume to clone from
:param scheduler_hints: (optional extension) arbitrary key-value pairs :param scheduler_hints: (optional extension) arbitrary key-value pairs
specified by the client to help boot an instance specified by the client to help boot an instance
:param multiattach: Allow the volume to be attached to more than
one instance (deprecated)
:rtype: :class:`Volume` :rtype: :class:`Volume`
""" """
if metadata is None: if metadata is None:
@@ -260,13 +255,6 @@ class VolumeManager(base.ManagerWithFind):
else: else:
volume_metadata = metadata volume_metadata = metadata
if multiattach:
warnings.warn('The ``multiattach`` volume create flag is '
'deprecated and will be removed in a future '
'release. Multiattach capability is now controlled '
'using volume type extra specs.',
DeprecationWarning)
body = {'volume': {'size': size, body = {'volume': {'size': size,
'consistencygroup_id': consistencygroup_id, 'consistencygroup_id': consistencygroup_id,
'snapshot_id': snapshot_id, 'snapshot_id': snapshot_id,
@@ -277,7 +265,6 @@ class VolumeManager(base.ManagerWithFind):
'metadata': volume_metadata, 'metadata': volume_metadata,
'imageRef': imageRef, 'imageRef': imageRef,
'source_volid': source_volid, 'source_volid': source_volid,
'multiattach': multiattach,
}} }}
if scheduler_hints: if scheduler_hints:

View File

@@ -606,12 +606,6 @@ def do_reset_state(cs, args):
help='Scheduler hint, similar to nova. Repeat option to set ' help='Scheduler hint, similar to nova. Repeat option to set '
'multiple hints. Values with the same key will be stored ' 'multiple hints. Values with the same key will be stored '
'as a list.') 'as a list.')
@utils.arg('--allow-multiattach',
dest='multiattach',
action="store_true",
help=('Allow volume to be attached more than once. (DEPRECATED)'
' Default=False'),
default=False)
@utils.arg('--poll', @utils.arg('--poll',
action="store_true", action="store_true",
help=('Wait for volume creation until it completes.')) help=('Wait for volume creation until it completes.'))
@@ -666,7 +660,6 @@ def do_create(cs, args):
imageRef=image_ref, imageRef=image_ref,
metadata=volume_metadata, metadata=volume_metadata,
scheduler_hints=hints, scheduler_hints=hints,
multiattach=args.multiattach,
backup_id=backup_id) backup_id=backup_id)
info = dict() info = dict()

View File

@@ -14,7 +14,6 @@
# under the License. # under the License.
"""Volume interface (v3 extension).""" """Volume interface (v3 extension)."""
import warnings
from cinderclient import api_versions from cinderclient import api_versions
from cinderclient.apiclient import base as common_base from cinderclient.apiclient import base as common_base
@@ -78,7 +77,7 @@ class VolumeManager(volumes.VolumeManager):
volume_type=None, user_id=None, volume_type=None, user_id=None,
project_id=None, availability_zone=None, project_id=None, availability_zone=None,
metadata=None, imageRef=None, scheduler_hints=None, metadata=None, imageRef=None, scheduler_hints=None,
multiattach=False, backup_id=None): backup_id=None):
"""Create a volume. """Create a volume.
:param size: Size of volume in GB :param size: Size of volume in GB
@@ -96,8 +95,6 @@ class VolumeManager(volumes.VolumeManager):
:param source_volid: ID of source volume to clone from :param source_volid: ID of source volume to clone from
:param scheduler_hints: (optional extension) arbitrary key-value pairs :param scheduler_hints: (optional extension) arbitrary key-value pairs
specified by the client to help boot an instance specified by the client to help boot an instance
:param multiattach: Allow the volume to be attached to more than
one instance (deprecated)
:param backup_id: ID of the backup :param backup_id: ID of the backup
:rtype: :class:`Volume` :rtype: :class:`Volume`
""" """
@@ -106,13 +103,6 @@ class VolumeManager(volumes.VolumeManager):
else: else:
volume_metadata = metadata volume_metadata = metadata
if multiattach:
warnings.warn('The ``multiattach`` volume create flag is '
'deprecated and will be removed in a future '
'release. Multiattach capability is now controlled '
'using volume type extra specs.',
DeprecationWarning)
body = {'volume': {'size': size, body = {'volume': {'size': size,
'consistencygroup_id': consistencygroup_id, 'consistencygroup_id': consistencygroup_id,
'snapshot_id': snapshot_id, 'snapshot_id': snapshot_id,
@@ -123,7 +113,6 @@ class VolumeManager(volumes.VolumeManager):
'metadata': volume_metadata, 'metadata': volume_metadata,
'imageRef': imageRef, 'imageRef': imageRef,
'source_volid': source_volid, 'source_volid': source_volid,
'multiattach': multiattach,
'backup_id': backup_id 'backup_id': backup_id
}} }}

View File

@@ -22,3 +22,7 @@ upgrade:
for several releases and have now been removed. After upgrading, use the for several releases and have now been removed. After upgrading, use the
equivalent ``--os_project_name``, ``--os_project_id``, ``OS_PROJECT_NAME`` equivalent ``--os_project_name``, ``--os_project_id``, ``OS_PROJECT_NAME``
and ``OS_PROJECT_ID``. and ``OS_PROJECT_ID``.
- |
The deprecated volume create option ``--allow-multiattach`` has now been
removed. Multiattach capability is now controlled using `volume-type extra
specs <https://docs.openstack.org/cinder/latest/admin/blockstorage-volume-multiattach.html>`_.