Merge "Stop proxying share_server_id through share in share.manager"
This commit is contained in:
commit
b2fb1beea8
@ -357,7 +357,8 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
{'status': constants.STATUS_ERROR})
|
||||
|
||||
if snapshot:
|
||||
parent_share_server_id = snapshot['share']['share_server_id']
|
||||
parent_share_server_id = (
|
||||
snapshot['share']['instance']['share_server_id'])
|
||||
try:
|
||||
parent_share_server = self.db.share_server_get(
|
||||
context, parent_share_server_id)
|
||||
@ -767,7 +768,8 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
|
||||
if snapshot_id is not None:
|
||||
snapshot_ref = self.db.share_snapshot_get(context, snapshot_id)
|
||||
parent_share_server_id = snapshot_ref['share']['share_server_id']
|
||||
parent_share_server_id = (
|
||||
snapshot_ref['share']['instance']['share_server_id'])
|
||||
else:
|
||||
snapshot_ref = None
|
||||
parent_share_server_id = None
|
||||
@ -1294,7 +1296,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
context = context.elevated()
|
||||
share_ref = self.db.share_get(context, share_id)
|
||||
share_instance = self._get_share_instance(context, share_ref)
|
||||
share_server = self._get_share_server(context, share_ref)
|
||||
share_server = self._get_share_server(context, share_instance)
|
||||
project_id = share_ref['project_id']
|
||||
|
||||
def share_manage_set_error_status(msg, exception):
|
||||
@ -1406,8 +1408,8 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
def create_snapshot(self, context, share_id, snapshot_id):
|
||||
"""Create snapshot for share."""
|
||||
snapshot_ref = self.db.share_snapshot_get(context, snapshot_id)
|
||||
share_server = self._get_share_server(context,
|
||||
snapshot_ref['share'])
|
||||
share_server = self._get_share_server(
|
||||
context, snapshot_ref['share']['instance'])
|
||||
snapshot_instance = self.db.share_snapshot_instance_get(
|
||||
context, snapshot_ref.instance['id'], with_share_data=True
|
||||
)
|
||||
@ -1444,8 +1446,8 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
context = context.elevated()
|
||||
snapshot_ref = self.db.share_snapshot_get(context, snapshot_id)
|
||||
|
||||
share_server = self._get_share_server(context,
|
||||
snapshot_ref['share'])
|
||||
share_server = self._get_share_server(
|
||||
context, snapshot_ref['share']['instance'])
|
||||
snapshot_instance = self.db.share_snapshot_instance_get(
|
||||
context, snapshot_ref.instance['id'], with_share_data=True
|
||||
)
|
||||
@ -1775,7 +1777,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
context = context.elevated()
|
||||
share = self.db.share_get(context, share_id)
|
||||
share_instance = self._get_share_instance(context, share)
|
||||
share_server = self._get_share_server(context, share)
|
||||
share_server = self._get_share_server(context, share_instance)
|
||||
project_id = share['project_id']
|
||||
|
||||
try:
|
||||
@ -1812,7 +1814,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
||||
context = context.elevated()
|
||||
share = self.db.share_get(context, share_id)
|
||||
share_instance = self._get_share_instance(context, share)
|
||||
share_server = self._get_share_server(context, share)
|
||||
share_server = self._get_share_server(context, share_instance)
|
||||
project_id = share['project_id']
|
||||
new_size = int(new_size)
|
||||
|
||||
|
@ -481,7 +481,7 @@ class ShareManagerTestCase(test.TestCase):
|
||||
|
||||
shr = db.share_get(self.context, share_id)
|
||||
self.assertEqual(constants.STATUS_AVAILABLE, shr['status'])
|
||||
self.assertEqual(server['id'], shr['share_server_id'])
|
||||
self.assertEqual(server['id'], shr['instance']['share_server_id'])
|
||||
|
||||
def test_create_share_instance_from_snapshot_with_server_not_found(self):
|
||||
"""Test creation from snapshot fails if server not found."""
|
||||
@ -1543,7 +1543,13 @@ class ShareManagerTestCase(test.TestCase):
|
||||
fake_parent_id = "fake_server_id"
|
||||
fake_exception = exception.ShareServerNotFound("fake")
|
||||
share = db_utils.create_share()
|
||||
fake_snapshot = {'share': {'share_server_id': fake_parent_id}}
|
||||
fake_snapshot = {
|
||||
'share': {
|
||||
'instance': {
|
||||
'share_server_id': fake_parent_id
|
||||
}
|
||||
}
|
||||
}
|
||||
self.mock_object(db, 'share_server_get',
|
||||
mock.Mock(side_effect=fake_exception))
|
||||
|
||||
@ -1558,7 +1564,13 @@ class ShareManagerTestCase(test.TestCase):
|
||||
def test_provide_share_server_for_share_parent_ss_invalid(self):
|
||||
fake_parent_id = "fake_server_id"
|
||||
share = db_utils.create_share()
|
||||
fake_snapshot = {'share': {'share_server_id': fake_parent_id}}
|
||||
fake_snapshot = {
|
||||
'share': {
|
||||
'instance': {
|
||||
'share_server_id': fake_parent_id
|
||||
}
|
||||
}
|
||||
}
|
||||
fake_parent_share_server = {'status': 'fake'}
|
||||
self.mock_object(db, 'share_server_get',
|
||||
mock.Mock(return_value=fake_parent_share_server))
|
||||
|
Loading…
Reference in New Issue
Block a user