Merge "Pass in snapshot refs for host on provider_update"
This commit is contained in:
commit
847a302923
@ -1023,6 +1023,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
||||
|
||||
vid_1 = 'c9125d6d-22ff-4cc3-974d-d4e350df9c91'
|
||||
vid_2 = '79883868-6933-47a1-a362-edfbf8d55a18'
|
||||
sid_1 = 'e3caa4fa-485e-45ca-970e-1d3e693a2520'
|
||||
project_1 = 'e6fb073c-11f0-4f4c-897c-90e7c7c4bcf8'
|
||||
project_2 = '4ff32607-305c-4a6b-a51a-0dd33124eecf'
|
||||
|
||||
@ -1032,7 +1033,10 @@ class SolidFireVolumeTestCase(test.TestCase):
|
||||
{'id': vid_2,
|
||||
'project_id': project_2,
|
||||
'provider_id': 22}]
|
||||
|
||||
snaprefs = [{'id': sid_1,
|
||||
'project_id': project_1,
|
||||
'provider_id': None,
|
||||
'volume_id': 'vid_1'}]
|
||||
sf_vols = [{'volumeID': 99,
|
||||
'name': 'UUID-' + vid_1,
|
||||
'accountID': 100},
|
||||
@ -1046,6 +1050,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
||||
|
||||
with mock.patch.object(
|
||||
sfv, '_issue_api_request', side_effect=_fake_issue_api_req):
|
||||
volume_updates, snapshot_updates = sfv.update_provider_info(vrefs)
|
||||
volume_updates, snapshot_updates = sfv.update_provider_info(
|
||||
vrefs, snaprefs)
|
||||
self.assertEqual(99, volume_updates[0]['provider_id'])
|
||||
self.assertEqual(1, len(volume_updates))
|
||||
|
@ -1388,10 +1388,11 @@ class BaseVD(object):
|
||||
"""
|
||||
return None
|
||||
|
||||
def update_provider_info(self, volumes):
|
||||
def update_provider_info(self, volumes, snapshots):
|
||||
"""Get provider info updates from driver.
|
||||
|
||||
:param volumes: List of Cinder volumes to check for updates
|
||||
:param snapshots: List of Cinder snapshots to check for updates
|
||||
:return: tuple (volume_updates, snapshot_updates)
|
||||
|
||||
where volume updates {'id': uuid, provider_id: <provider-id>}
|
||||
|
@ -204,7 +204,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
||||
'provider_id': sfvol['volumeID']})
|
||||
return updates
|
||||
|
||||
def update_provider_info(self, vrefs):
|
||||
def update_provider_info(self, vrefs, snaprefs):
|
||||
volume_updates = self._init_volume_mappings(vrefs)
|
||||
snapshot_updates = None
|
||||
return (volume_updates, snapshot_updates)
|
||||
|
@ -317,13 +317,14 @@ class VolumeManager(manager.SchedulerDependentManager):
|
||||
LOG.info(_LI("Determined volume DB was not empty at startup."))
|
||||
return False
|
||||
|
||||
def _sync_provider_info(self, ctxt, volumes):
|
||||
def _sync_provider_info(self, ctxt, volumes, snapshots):
|
||||
# NOTE(jdg): For now this just updates provider_id, we can add more
|
||||
# add more items to the update if theyr'e releveant but we need
|
||||
# to be safe in what we allow and add a list of allowed keys
|
||||
# things that make sense are provider_*, replication_status etc
|
||||
|
||||
updates, snapshot_updates = self.driver.update_provider_info(volumes)
|
||||
updates, snapshot_updates = self.driver.update_provider_info(
|
||||
volumes, snapshots)
|
||||
host_vols = utils.list_of_dicts_to_dict(volumes, 'id')
|
||||
|
||||
for u in updates or []:
|
||||
@ -377,7 +378,8 @@ class VolumeManager(manager.SchedulerDependentManager):
|
||||
self.driver.init_capabilities()
|
||||
|
||||
volumes = self.db.volume_get_all_by_host(ctxt, self.host)
|
||||
self._sync_provider_info(ctxt, volumes)
|
||||
snapshots = self.db.snapshot_get_by_host(ctxt, self.host)
|
||||
self._sync_provider_info(ctxt, volumes, snapshots)
|
||||
# FIXME volume count for exporting is wrong
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user