Lefthand driver fails to attach a cloned volume

The provider location was not being populated for cloned volumes.
This patch is updating the provider location for cloned volumes
resulting in successful volume attachments.

Change-Id: I86ef7935ed7233377aa4745dc4b45fcab5703f0a
Closes-Bug: 1418201
This commit is contained in:
Kurt Martin 2015-02-04 16:09:44 -08:00
parent 055e9b1354
commit f71a2c535e
2 changed files with 12 additions and 3 deletions

View File

@ -1173,15 +1173,22 @@ class TestHPLeftHandRESTISCSIDriver(HPLeftHandBaseDriver, test.TestCase):
mock_client = self.setup_driver()
mock_client.getVolumeByName.return_value = {'id': self.volume_id}
mock_client.cloneVolume.return_value = {
'iscsiIqn': self.connector['initiator']}
with mock.patch.object(hp_lefthand_rest_proxy.HPLeftHandRESTProxy,
'_create_client') as mock_do_setup:
mock_do_setup.return_value = mock_client
# execute create_cloned_volume
self.driver.create_cloned_volume(
model_update = self.driver.create_cloned_volume(
self.cloned_volume, self.volume)
expected_iqn = 'iqn.1993-08.org.debian:01:222 0'
expected_location = "10.0.1.6:3260,1 %s" % expected_iqn
self.assertEqual(expected_location,
model_update['provider_location'])
expected = self.driver_startup_call_stack + [
mock.call.getVolumeByName('fakevolume'),
mock.call.cloneVolume('clone_volume', 1),

View File

@ -96,9 +96,10 @@ class HPLeftHandRESTProxy(ISCSIDriver):
1.0.6 - Removing locks bug #1395953
1.0.7 - Fixed bug #1353137, Server was not removed from the HP
Lefthand backend after the last volume was detached.
1.0.8 - Fixed bug #1418201, A cloned volume fails to attach.
"""
VERSION = "1.0.7"
VERSION = "1.0.8"
device_stats = {}
@ -377,7 +378,8 @@ class HPLeftHandRESTProxy(ISCSIDriver):
client = self._login()
try:
volume_info = client.getVolumeByName(src_vref['name'])
client.cloneVolume(volume['name'], volume_info['id'])
clone_info = client.cloneVolume(volume['name'], volume_info['id'])
return self._update_provider(clone_info)
except Exception as ex:
raise exception.VolumeBackendAPIException(ex)
finally: