]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Lefthand driver fails to attach a cloned volume
authorKurt Martin <kurt.f.martin@hp.com>
Thu, 5 Feb 2015 00:09:44 +0000 (16:09 -0800)
committerKurt Martin <kurt.f.martin@hp.com>
Thu, 5 Feb 2015 00:09:44 +0000 (16:09 -0800)
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

cinder/tests/test_hplefthand.py
cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py

index 8bcfdc20185e8bd6122ba838396e17553015e4c2..409a5dddafbc8cba7d36c116ba91e297988ca61c 100644 (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),
index 0eb594324ba3cc0f1289523c6b46a38a2148ab07..59e03b34132ee6e12ff1c5fcbb715a318d362b4f 100644 (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: