Generic driver:Create Cinder volume in correct AZ

Update Generic driver to respect share AZ when
creating Cinder volume.

Partially-Implements: blueprint availability-zones

Change-Id: Ie4d19e73a6781d1f9dc8fc4015c76f42b88db75c
This commit is contained in:
Igor Malinovskiy 2015-08-06 16:18:22 +03:00
parent 9b77e13302
commit e50726d90d
3 changed files with 9 additions and 4 deletions

View File

@ -479,7 +479,8 @@ class GenericShareDriver(driver.ExecuteMixin, driver.ShareDriver):
share['size'],
self.configuration.volume_name_template % share['id'], '',
snapshot=volume_snapshot,
volume_type=self.configuration.cinder_volume_type)
volume_type=self.configuration.cinder_volume_type,
availability_zone=share['availability_zone'])
self.private_storage.update(
share['id'], {'volume_id': volume['id']})

View File

@ -27,6 +27,7 @@ def fake_share(**kwargs):
'share_server_id': 'fake share server id',
'export_location': 'fake_location:/fake_share',
'project_id': 'fake_project_uuid',
'availability_zone': 'fake_az',
'snapshot_support': 'True',
}
share.update(kwargs)

View File

@ -121,7 +121,8 @@ class GenericShareDriverTestCase(test.TestCase):
'backend_details': {
'ip': '1.2.3.4',
'instance_id': 'fake'
}
},
'availability_zone': 'fake_az',
}
self.access = fake_share.fake_access()
self.snapshot = fake_share.fake_snapshot()
@ -671,7 +672,8 @@ class GenericShareDriverTestCase(test.TestCase):
CONF.volume_name_template % self.share['id'],
'',
snapshot=None,
volume_type='fake_volume_type')
volume_type='fake_volume_type',
availability_zone=self.share['availability_zone'])
def test_allocate_container_with_snaphot(self):
fake_vol = fake_volume.FakeVolume()
@ -691,7 +693,8 @@ class GenericShareDriverTestCase(test.TestCase):
CONF.volume_name_template % self.share['id'],
'',
snapshot=fake_vol_snap,
volume_type=None)
volume_type=None,
availability_zone=self.share['availability_zone'])
def test_allocate_container_error(self):
fake_vol = fake_volume.FakeVolume(status='error')