]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Snapmirror targets should not be reported as pools
authorMike Rooney <rooneym@netapp.com>
Mon, 22 Jun 2015 17:58:12 +0000 (13:58 -0400)
committerMike Rooney <rooneym@netapp.com>
Tue, 15 Sep 2015 14:44:04 +0000 (14:44 +0000)
Snapmirror targets that were being reported to the Cinder
scheduler as available pools are now no longer reported as such.

Change-Id: I04faa9d7c448b91e66192770b09db84df78a8ae1
Closes-Bug: #1468004

cinder/tests/unit/test_netapp_ssc.py
cinder/volume/drivers/netapp/dataontap/ssc_cmode.py

index 13a1ef43dba9cb77ce8f8d75dcd322873a56faea..55ee62adc15f65eb57fdd9147e3a348b426e6f9d 100644 (file)
@@ -15,6 +15,7 @@
 """Unit tests for the NetApp-specific ssc module."""
 
 import copy
+import ddt
 from lxml import etree
 import mock
 from mox3 import mox
@@ -314,6 +315,7 @@ def createNetAppVolume(**kwargs):
     return vol
 
 
+@ddt.ddt
 class SscUtilsTestCase(test.TestCase):
     """Test ssc utis."""
     vol1 = createNetAppVolume(name='vola', vs='openstack',
@@ -377,6 +379,26 @@ class SscUtilsTestCase(test.TestCase):
         self.stubs.Set(http_client, 'HTTPConnection',
                        FakeDirectCmodeHTTPConnection)
 
+    @ddt.data({'na_server_exists': False, 'volume': None},
+              {'na_server_exists': True, 'volume': 'vol'},
+              {'na_server_exists': True, 'volume': None})
+    @ddt.unpack
+    def test_query_cluster_vols_for_ssc(self, na_server_exists, volume):
+        if na_server_exists:
+            na_server = netapp_api.NaServer('127.0.0.1')
+            fake_api_return = mock.Mock(return_value=[])
+            self.mock_object(ssc_cmode.netapp_api, 'invoke_api',
+                             new_attr=fake_api_return)
+            ssc_cmode.query_cluster_vols_for_ssc(na_server, 'vserver',
+                                                 volume)
+        else:
+            na_server = None
+            fake_api_error = mock.Mock(side_effect=exception.InvalidInput)
+            self.mock_object(ssc_cmode.netapp_api, 'invoke_api',
+                             new_attr=fake_api_error)
+            self.assertRaises(KeyError, ssc_cmode.query_cluster_vols_for_ssc,
+                              na_server, 'vserver', volume)
+
     def test_cl_vols_ssc_all(self):
         """Test cluster ssc for all vols."""
         na_server = netapp_api.NaServer('127.0.0.1')
index f88e03c0fa7096e2b4acb8c1ce20749c70a93649..411fcce22fe002af14e5286969d78262e794c060 100644 (file)
@@ -154,7 +154,13 @@ def get_cluster_vols_with_ssc(na_server, vserver, volume=None):
 def query_cluster_vols_for_ssc(na_server, vserver, volume=None):
     """Queries cluster volumes for ssc."""
     query = {'volume-attributes': None}
-    volume_id = {'volume-id-attributes': {'owning-vserver-name': vserver}}
+    volume_id = {
+        'volume-id-attributes': {
+            'owning-vserver-name': vserver,
+            'type': 'rw',
+            'style': 'flex',
+        },
+    }
     if volume:
         volume_id['volume-id-attributes']['name'] = volume
     query['volume-attributes'] = volume_id