Merge "Ignore replicas in error state during allow/deny access."

This commit is contained in:
Zuul 2023-01-23 22:14:21 +00:00 committed by Gerrit Code Review
commit 21e0131149
3 changed files with 36 additions and 6 deletions

View File

@ -40,7 +40,7 @@ ShareGroup = [
"This value is only used to validate the versions "
"response from Manila."),
cfg.StrOpt("max_api_microversion",
default="2.73",
default="2.74",
help="The maximum api microversion is configured to be the "
"value of the latest microversion supported by Manila."),
cfg.StrOpt("region",

View File

@ -360,6 +360,30 @@ class ReplicationTest(base.BaseSharesMixedTest):
# Delete the replica
self.delete_share_replica(share_replica["id"])
@decorators.idempotent_id('600a13d2-5cf0-482e-97af-9f598b55a406')
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@utils.skip_if_microversion_not_supported("2.74")
def test_add_access_rule_share_replica_error_status(self):
'''From 2.74, we can add rules even if replicas are in error state.'''
access_type, access_to = utils.get_access_rule_data_from_config(
self.shares_v2_client.share_protocol)
# Create the replica
share_replica = self._verify_create_replica()
# Reset the replica status to error
self.admin_client.reset_share_replica_status(
share_replica['id'], constants.STATUS_ERROR)
# Verify access rule will be added in error state
self.shares_v2_client.create_access_rule(
self.shares[0]["id"], access_type=access_type, access_to=access_to,
access_level='ro')
# Verify access_rules_status transitions to 'active' state.
waiters.wait_for_resource_status(
self.shares_v2_client, self.shares[0]["id"],
constants.RULE_STATE_ACTIVE, status_attr='access_rules_status')
@decorators.idempotent_id('a542c179-ea41-4bc0-bd80-e06eaddf5253')
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@testtools.skipUnless(CONF.share.run_multiple_share_replicas_tests,

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import ddt
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -83,6 +84,7 @@ class ReplicationNegativeBase(base.BaseSharesMixedTest):
return share, instance_id
@ddt.ddt
class ReplicationNegativeTest(ReplicationNegativeBase):
def _is_replication_type_promotable(self):
@ -189,7 +191,9 @@ class ReplicationNegativeTest(ReplicationNegativeBase):
@decorators.idempotent_id('600a13d2-5cf0-482e-97af-9f598b55a407')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
def test_add_access_rule_share_replica_error_status(self):
@ddt.data('2.11', '2.73')
def test_add_access_rule_share_replica_error_status(self, version):
'''From 2.74, we can add rules even if replicas are in error state.'''
access_type, access_to = utils.get_access_rule_data_from_config(
self.shares_v2_client.share_protocol)
# Create the replica
@ -200,10 +204,12 @@ class ReplicationNegativeTest(ReplicationNegativeBase):
self.admin_client.reset_share_replica_status(
share_replica['id'], constants.STATUS_ERROR)
# Verify access rule cannot be added
self.assertRaises(lib_exc.BadRequest,
self.admin_client.create_access_rule,
self.share1["id"], access_type, access_to, 'ro')
if utils.is_microversion_lt(version, '2.74'):
# Verify access rule cannot be added
self.assertRaises(lib_exc.BadRequest,
self.shares_v2_client.create_access_rule,
self.share1["id"], access_type, access_to, 'ro',
version)
@decorators.idempotent_id('91b93b71-4048-412b-bb42-0fe88edfb987')
@testtools.skipUnless(CONF.share.run_host_assisted_migration_tests or