Merge "Drop support for --allow-multiattach"
This commit is contained in:
		@@ -17,12 +17,13 @@ from cinderclient.tests.functional import base
 | 
			
		||||
class CinderVolumeTests(base.ClientTestBase):
 | 
			
		||||
    """Check of base cinder volume commands."""
 | 
			
		||||
 | 
			
		||||
    CREATE_VOLUME_PROPERTY = ('attachments', 'multiattach',
 | 
			
		||||
                       'os-vol-tenant-attr:tenant_id',
 | 
			
		||||
                       'availability_zone', 'bootable',
 | 
			
		||||
                       'created_at', 'description', 'encrypted', 'id',
 | 
			
		||||
                       'metadata', 'name', 'size', 'status',
 | 
			
		||||
                       'user_id', 'volume_type')
 | 
			
		||||
    CREATE_VOLUME_PROPERTY = (
 | 
			
		||||
        'attachments',
 | 
			
		||||
        'os-vol-tenant-attr:tenant_id',
 | 
			
		||||
        'availability_zone', 'bootable',
 | 
			
		||||
        'created_at', 'description', 'encrypted', 'id',
 | 
			
		||||
        'metadata', 'name', 'size', 'status',
 | 
			
		||||
        'user_id', 'volume_type')
 | 
			
		||||
 | 
			
		||||
    SHOW_VOLUME_PROPERTY = ('attachment_ids', 'attached_servers',
 | 
			
		||||
                       'availability_zone', 'bootable',
 | 
			
		||||
 
 | 
			
		||||
@@ -10,11 +10,8 @@
 | 
			
		||||
#    License for the specific language governing permissions and limitations
 | 
			
		||||
#    under the License.
 | 
			
		||||
 | 
			
		||||
import unittest
 | 
			
		||||
 | 
			
		||||
import ddt
 | 
			
		||||
import six
 | 
			
		||||
 | 
			
		||||
from tempest.lib import exceptions
 | 
			
		||||
 | 
			
		||||
from cinderclient.tests.functional import base
 | 
			
		||||
@@ -91,17 +88,6 @@ class CinderVolumeTestsWithParameters(base.ClientTestBase):
 | 
			
		||||
                                    format(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):
 | 
			
		||||
        """Test steps:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,6 @@ def _stub_volume(*args, **kwargs):
 | 
			
		||||
        "metadata": {},
 | 
			
		||||
        "status": "available",
 | 
			
		||||
        'description': None,
 | 
			
		||||
        "multiattach": "false",
 | 
			
		||||
        "os-volume-replication:driver_data": None,
 | 
			
		||||
        "source_volid": None,
 | 
			
		||||
        "consistencygroup_id": None,
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,7 @@ class ShellTest(utils.TestCase):
 | 
			
		||||
                               'metadata': {'key1': '"--test1"'},
 | 
			
		||||
                               'volume_type': None,
 | 
			
		||||
                               'description': None,
 | 
			
		||||
                               'multiattach': False}}
 | 
			
		||||
                               }}
 | 
			
		||||
        self.assert_called_anytime('POST', '/volumes', expected)
 | 
			
		||||
 | 
			
		||||
    def test_metadata_args_limiter_display_name(self):
 | 
			
		||||
@@ -121,7 +121,7 @@ class ShellTest(utils.TestCase):
 | 
			
		||||
                               'metadata': {'key1': '"--t1"'},
 | 
			
		||||
                               'volume_type': None,
 | 
			
		||||
                               'description': None,
 | 
			
		||||
                               'multiattach': False}}
 | 
			
		||||
                               }}
 | 
			
		||||
        self.assert_called_anytime('POST', '/volumes', expected)
 | 
			
		||||
 | 
			
		||||
    def test_delimit_metadata_args(self):
 | 
			
		||||
@@ -137,7 +137,7 @@ class ShellTest(utils.TestCase):
 | 
			
		||||
                                            'key2': '"test2"'},
 | 
			
		||||
                               'volume_type': None,
 | 
			
		||||
                               'description': None,
 | 
			
		||||
                               'multiattach': False}}
 | 
			
		||||
                               }}
 | 
			
		||||
        self.assert_called_anytime('POST', '/volumes', expected)
 | 
			
		||||
 | 
			
		||||
    def test_delimit_metadata_args_display_name(self):
 | 
			
		||||
@@ -153,7 +153,7 @@ class ShellTest(utils.TestCase):
 | 
			
		||||
                               'metadata': {'key1': '"t1"'},
 | 
			
		||||
                               'volume_type': None,
 | 
			
		||||
                               'description': None,
 | 
			
		||||
                               'multiattach': False}}
 | 
			
		||||
                               }}
 | 
			
		||||
        self.assert_called_anytime('POST', '/volumes', expected)
 | 
			
		||||
 | 
			
		||||
    def test_list_filter_status(self):
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ class VolumesTest(utils.TestCase):
 | 
			
		||||
                               'volume_type': None,
 | 
			
		||||
                               'metadata': {},
 | 
			
		||||
                               'consistencygroup_id': None,
 | 
			
		||||
                               'multiattach': False},
 | 
			
		||||
                               },
 | 
			
		||||
                    'OS-SCH-HNT:scheduler_hints': 'uuid'}
 | 
			
		||||
        cs.assert_called('POST', '/volumes', body=expected)
 | 
			
		||||
        self._assert_request_id(vol)
 | 
			
		||||
 
 | 
			
		||||
@@ -692,7 +692,6 @@ class ShellTest(utils.TestCase):
 | 
			
		||||
                               'metadata': {},
 | 
			
		||||
                               'volume_type': '4321',
 | 
			
		||||
                               'description': None,
 | 
			
		||||
                               'multiattach': False,
 | 
			
		||||
                               'backup_id': None}}
 | 
			
		||||
        self.assert_called_anytime('POST', '/volumes', expected)
 | 
			
		||||
 | 
			
		||||
@@ -715,7 +714,6 @@ class ShellTest(utils.TestCase):
 | 
			
		||||
                               'metadata': {},
 | 
			
		||||
                               'volume_type': None,
 | 
			
		||||
                               'description': None,
 | 
			
		||||
                               'multiattach': False,
 | 
			
		||||
                               'backup_id': None}}
 | 
			
		||||
        expected['volume'].update(update)
 | 
			
		||||
        self.assert_called_anytime('POST', '/volumes', body=expected)
 | 
			
		||||
 
 | 
			
		||||
@@ -83,7 +83,6 @@ class VolumesTest(utils.TestCase):
 | 
			
		||||
                               'volume_type': '5678',
 | 
			
		||||
                               'metadata': {},
 | 
			
		||||
                               'consistencygroup_id': None,
 | 
			
		||||
                               'multiattach': False,
 | 
			
		||||
                               'group_id': '1234',
 | 
			
		||||
                               'backup_id': None}}
 | 
			
		||||
        cs.assert_called('POST', '/volumes', body=expected)
 | 
			
		||||
 
 | 
			
		||||
@@ -292,12 +292,6 @@ class CheckSizeArgForCreate(argparse.Action):
 | 
			
		||||
           help='Scheduler hint, similar to nova. Repeat option to set '
 | 
			
		||||
                'multiple hints. Values with the same key will be stored '
 | 
			
		||||
                '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):
 | 
			
		||||
    """Creates a volume."""
 | 
			
		||||
    # NOTE(thingee): Backwards-compatibility with v1 args
 | 
			
		||||
@@ -339,8 +333,7 @@ def do_create(cs, args):
 | 
			
		||||
                               availability_zone=args.availability_zone,
 | 
			
		||||
                               imageRef=image_ref,
 | 
			
		||||
                               metadata=volume_metadata,
 | 
			
		||||
                               scheduler_hints=hints,
 | 
			
		||||
                               multiattach=args.multiattach)
 | 
			
		||||
                               scheduler_hints=hints)
 | 
			
		||||
 | 
			
		||||
    info = dict()
 | 
			
		||||
    volume = cs.volumes.get(volume.id)
 | 
			
		||||
 
 | 
			
		||||
@@ -15,8 +15,6 @@
 | 
			
		||||
 | 
			
		||||
"""Volume interface (v2 extension)."""
 | 
			
		||||
 | 
			
		||||
import warnings
 | 
			
		||||
 | 
			
		||||
from cinderclient.apiclient import base as common_base
 | 
			
		||||
from cinderclient import base
 | 
			
		||||
 | 
			
		||||
@@ -233,8 +231,7 @@ class VolumeManager(base.ManagerWithFind):
 | 
			
		||||
               source_volid=None, name=None, description=None,
 | 
			
		||||
               volume_type=None, user_id=None,
 | 
			
		||||
               project_id=None, availability_zone=None,
 | 
			
		||||
               metadata=None, imageRef=None, scheduler_hints=None,
 | 
			
		||||
               multiattach=False):
 | 
			
		||||
               metadata=None, imageRef=None, scheduler_hints=None):
 | 
			
		||||
        """Create a volume.
 | 
			
		||||
 | 
			
		||||
        :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 scheduler_hints: (optional extension) arbitrary key-value pairs
 | 
			
		||||
                            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`
 | 
			
		||||
        """
 | 
			
		||||
        if metadata is None:
 | 
			
		||||
@@ -260,13 +255,6 @@ class VolumeManager(base.ManagerWithFind):
 | 
			
		||||
        else:
 | 
			
		||||
            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,
 | 
			
		||||
                           'consistencygroup_id': consistencygroup_id,
 | 
			
		||||
                           'snapshot_id': snapshot_id,
 | 
			
		||||
@@ -277,7 +265,6 @@ class VolumeManager(base.ManagerWithFind):
 | 
			
		||||
                           'metadata': volume_metadata,
 | 
			
		||||
                           'imageRef': imageRef,
 | 
			
		||||
                           'source_volid': source_volid,
 | 
			
		||||
                           'multiattach': multiattach,
 | 
			
		||||
                           }}
 | 
			
		||||
 | 
			
		||||
        if scheduler_hints:
 | 
			
		||||
 
 | 
			
		||||
@@ -622,12 +622,6 @@ def do_reset_state(cs, args):
 | 
			
		||||
           help='Scheduler hint, similar to nova. Repeat option to set '
 | 
			
		||||
                'multiple hints. Values with the same key will be stored '
 | 
			
		||||
                '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',
 | 
			
		||||
           action="store_true",
 | 
			
		||||
           help=('Wait for volume creation until it completes.'))
 | 
			
		||||
@@ -682,7 +676,6 @@ def do_create(cs, args):
 | 
			
		||||
                               imageRef=image_ref,
 | 
			
		||||
                               metadata=volume_metadata,
 | 
			
		||||
                               scheduler_hints=hints,
 | 
			
		||||
                               multiattach=args.multiattach,
 | 
			
		||||
                               backup_id=backup_id)
 | 
			
		||||
 | 
			
		||||
    info = dict()
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,6 @@
 | 
			
		||||
#    under the License.
 | 
			
		||||
 | 
			
		||||
"""Volume interface (v3 extension)."""
 | 
			
		||||
import warnings
 | 
			
		||||
 | 
			
		||||
from cinderclient import api_versions
 | 
			
		||||
from cinderclient.apiclient import base as common_base
 | 
			
		||||
@@ -78,7 +77,7 @@ class VolumeManager(volumes.VolumeManager):
 | 
			
		||||
               volume_type=None, user_id=None,
 | 
			
		||||
               project_id=None, availability_zone=None,
 | 
			
		||||
               metadata=None, imageRef=None, scheduler_hints=None,
 | 
			
		||||
               multiattach=False, backup_id=None):
 | 
			
		||||
               backup_id=None):
 | 
			
		||||
        """Create a volume.
 | 
			
		||||
 | 
			
		||||
        :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 scheduler_hints: (optional extension) arbitrary key-value pairs
 | 
			
		||||
                            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
 | 
			
		||||
        :rtype: :class:`Volume`
 | 
			
		||||
        """
 | 
			
		||||
@@ -106,13 +103,6 @@ class VolumeManager(volumes.VolumeManager):
 | 
			
		||||
        else:
 | 
			
		||||
            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,
 | 
			
		||||
                           'consistencygroup_id': consistencygroup_id,
 | 
			
		||||
                           'snapshot_id': snapshot_id,
 | 
			
		||||
@@ -123,7 +113,6 @@ class VolumeManager(volumes.VolumeManager):
 | 
			
		||||
                           'metadata': volume_metadata,
 | 
			
		||||
                           'imageRef': imageRef,
 | 
			
		||||
                           'source_volid': source_volid,
 | 
			
		||||
                           'multiattach': multiattach,
 | 
			
		||||
                           'backup_id': backup_id
 | 
			
		||||
                           }}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,3 +22,7 @@ upgrade:
 | 
			
		||||
    for several releases and have now been removed. After upgrading, use the
 | 
			
		||||
    equivalent ``--os_project_name``, ``--os_project_id``, ``OS_PROJECT_NAME``
 | 
			
		||||
    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>`_.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user