Fix manage API ignoring type extra specs
Currently manage API allows managing a share with a share type that
may not make sense in the service host. This patch addresses this
by invoking the scheduler to validate the host before invoking the
backend manager.
APIImpact
Change-Id: I8c780f2518f4a6eacf37cc448c73fbb41f6b7507
Closes-bug: #1544725
diff --git a/manila_tempest_tests/tests/api/admin/test_share_manage.py b/manila_tempest_tests/tests/api/admin/test_share_manage.py
index 9908148..1afecf3 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_manage.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_manage.py
@@ -159,24 +159,22 @@
@test.attr(type=["gate", "smoke"])
def test_manage_retry(self):
# Manage share with invalid parameters
- share = None
- parameters = [(self.st_invalid['share_type']['id'], 'manage_error'),
- (self.st['share_type']['id'], 'available')]
- for share_type_id, status in parameters:
- share = self.shares_v2_client.manage_share(
- service_host=self.shares[1]['host'],
- export_path=self.shares[1]['export_locations'][0],
- protocol=self.shares[1]['share_proto'],
- share_type_id=share_type_id)
+ self.assertRaises(
+ lib_exc.Conflict,
+ self.shares_v2_client.manage_share,
+ service_host=self.shares[1]['host'],
+ export_path=self.shares[1]['export_locations'][0],
+ protocol=self.shares[1]['share_proto'],
+ share_type_id=self.st_invalid['share_type']['id'])
- # Add managed share to cleanup queue
- self.method_resources.insert(
- 0, {'type': 'share', 'id': share['id'],
- 'client': self.shares_v2_client})
+ share = self.shares_v2_client.manage_share(
+ service_host=self.shares[1]['host'],
+ export_path=self.shares[1]['export_locations'][0],
+ protocol=self.shares[1]['share_proto'],
+ share_type_id=self.st['share_type']['id'])
- # Wait for success
- self.shares_v2_client.wait_for_share_status(share['id'], status)
+ self.shares_v2_client.wait_for_share_status(share['id'], 'available')
# Delete share
self.shares_v2_client.delete_share(share['id'])