Drop snapshot_support param from share_type_create

This patch set drops the snapshot_support param from the
share_type_create command. Considering that the manila scheduler
works as follow:

- If "snapshot_support" in a share type is set to True, the
  scheduler will only match backends that allow taking snapshots.
- If "snapshot_support" in a share type is set to False, the
  scheduler will only match backends that do not support snapshots.
- If "snapshot_support" is not set in a share type, the scheduler
  places the share on any backend irrespective of whether snapshots
  or supported or not. However, users will be prevented from taking
  snapshots of such shares.

We want to mimic the third behavior of the scheduler. That means,
we expect administrators to specify wheter the backend has or not
snapshot_support.

Change-Id: I0440bfa1b182330020f8cb3c37d33e226801f3e9
Closes-Bug: #1685655
This commit is contained in:
Maari Tamm 2019-10-29 21:35:10 +00:00 committed by Goutham Pacha Ravi
parent b0b454892a
commit 7d3eb82eb8
4 changed files with 15 additions and 17 deletions

View File

@ -397,11 +397,10 @@ def share_type_get(request, share_type_id):
def share_type_create(request, name, spec_driver_handles_share_servers,
spec_snapshot_support=True, is_public=True):
is_public=True):
return manilaclient(request).share_types.create(
name=name,
spec_driver_handles_share_servers=spec_driver_handles_share_servers,
spec_snapshot_support=spec_snapshot_support,
is_public=is_public)

View File

@ -124,31 +124,25 @@ class ManilaApiTests(base.APITestCase):
self.manilaclient.share_types.create.assert_called_once_with(
name=name,
spec_driver_handles_share_servers=dhss,
spec_snapshot_support=True,
is_public=True)
@ddt.data(
(True, True, True),
(True, True, False),
(True, False, True),
(False, True, True),
(True, False, False),
(False, False, True),
(False, True, False),
(True, True, True),
(True, True),
(False, True),
(True, False),
(False, False),
)
@ddt.unpack
def test_share_type_create_with_custom_values(
self, dhss, snapshot_support, is_public):
self, dhss, is_public):
name = 'fake_share_type_name'
api.share_type_create(
self.request, name, dhss, snapshot_support, is_public)
self.request, name, dhss, is_public)
self.manilaclient.share_types.create.assert_called_once_with(
name=name,
spec_driver_handles_share_servers=dhss,
spec_snapshot_support=snapshot_support,
is_public=is_public)
def test_share_type_set_extra_specs(self):

View File

@ -188,7 +188,6 @@ class ManilaDashboardsAdminSharesCreateShareTypeFormTests(base.APITestCase):
self.manilaclient.share_types.create.assert_called_once_with(
name=data['name'],
spec_driver_handles_share_servers='true',
spec_snapshot_support=True,
is_public=data["is_public"])
mock_horizon_messages_success.assert_called_once_with(
self.request, mock.ANY)
@ -212,7 +211,6 @@ class ManilaDashboardsAdminSharesCreateShareTypeFormTests(base.APITestCase):
self.manilaclient.share_types.create.assert_called_once_with(
name=data['name'],
spec_driver_handles_share_servers='true',
spec_snapshot_support=True,
is_public=data["is_public"])
mock_horizon_messages_success.assert_called_once_with(
self.request, mock.ANY)
@ -248,7 +246,6 @@ class ManilaDashboardsAdminSharesCreateShareTypeFormTests(base.APITestCase):
self.manilaclient.share_types.create.assert_called_once_with(
name=data['name'],
spec_driver_handles_share_servers='true',
spec_snapshot_support=True,
is_public=enable_public_share_type_creation)
mock_horizon_messages_success.assert_called_once_with(
self.request, mock.ANY)

View File

@ -0,0 +1,8 @@
---
fixes:
- |
"snapshot_support" is no longer automatically included as an extra-spec
in share types created via manila-ui. If the share type has to match backends
that support snapshots, explicitly specify "snapshot_support" in the
"Extra specs" field while creating share types.
This change does not modify pre-existing share types.