Example #1
0
    def test_cl_vols_ssc_single(self):
        """Test cluster ssc for single vol."""
        na_server = api.NaServer('127.0.0.1')
        vserver = 'openstack'
        test_vols = set([copy.deepcopy(self.vol1)])
        sis = {'vola': {'dedup': False, 'compression': False}}
        mirrored = {'vola': [{'dest_loc': 'openstack1:vol1',
                              'rel_type': 'data_protection',
                              'mirr_state': 'broken'},
                             {'dest_loc': 'openstack2:vol2',
                              'rel_type': 'data_protection',
                              'mirr_state': 'snapmirrored'}]}

        self.mox.StubOutWithMock(ssc_cmode, 'query_cluster_vols_for_ssc')
        self.mox.StubOutWithMock(ssc_cmode, 'get_sis_vol_dict')
        self.mox.StubOutWithMock(ssc_cmode, 'get_snapmirror_vol_dict')
        self.mox.StubOutWithMock(ssc_cmode, 'query_aggr_options')
        self.mox.StubOutWithMock(ssc_cmode, 'query_aggr_storage_disk')
        ssc_cmode.query_cluster_vols_for_ssc(
            na_server, vserver, 'vola').AndReturn(test_vols)
        ssc_cmode.get_sis_vol_dict(
            na_server, vserver, 'vola').AndReturn(sis)
        ssc_cmode.get_snapmirror_vol_dict(
            na_server, vserver, 'vola').AndReturn(mirrored)
        raiddp = {'ha_policy': 'cfo', 'raid_type': 'raiddp'}
        ssc_cmode.query_aggr_options(
            na_server, 'aggr1').AndReturn(raiddp)
        ssc_cmode.query_aggr_storage_disk(na_server, 'aggr1').AndReturn('SSD')
        self.mox.ReplayAll()

        res_vols = ssc_cmode.get_cluster_vols_with_ssc(
            na_server, vserver, volume='vola')

        self.mox.VerifyAll()
        self.assertEqual(len(res_vols), 1)
Example #2
0
    def test_cl_vols_ssc_single(self):
        """Test cluster ssc for single vol."""
        na_server = netapp_api.NaServer('127.0.0.1')
        vserver = 'openstack'
        test_vols = set([copy.deepcopy(self.vol1)])
        sis = {'vola': {'dedup': False, 'compression': False}}
        mirrored = {'vola': [{'dest_loc': 'openstack1:vol1',
                              'rel_type': 'data_protection',
                              'mirr_state': 'broken'},
                             {'dest_loc': 'openstack2:vol2',
                              'rel_type': 'data_protection',
                              'mirr_state': 'snapmirrored'}]}

        self.mox.StubOutWithMock(ssc_cmode, 'query_cluster_vols_for_ssc')
        self.mox.StubOutWithMock(ssc_cmode, 'get_sis_vol_dict')
        self.mox.StubOutWithMock(ssc_cmode, 'get_snapmirror_vol_dict')
        self.mox.StubOutWithMock(ssc_cmode, 'query_aggr_options')
        self.mox.StubOutWithMock(ssc_cmode, 'query_aggr_storage_disk')
        ssc_cmode.query_cluster_vols_for_ssc(
            na_server, vserver, 'vola').AndReturn(test_vols)
        ssc_cmode.get_sis_vol_dict(
            na_server, vserver, 'vola').AndReturn(sis)
        ssc_cmode.get_snapmirror_vol_dict(
            na_server, vserver, 'vola').AndReturn(mirrored)
        raiddp = {'ha_policy': 'cfo', 'raid_type': 'raiddp'}
        ssc_cmode.query_aggr_options(
            na_server, 'aggr1').AndReturn(raiddp)
        ssc_cmode.query_aggr_storage_disk(na_server, 'aggr1').AndReturn('SSD')
        self.mox.ReplayAll()

        res_vols = ssc_cmode.get_cluster_vols_with_ssc(
            na_server, vserver, volume='vola')

        self.mox.VerifyAll()
        self.assertEqual(1, len(res_vols))
Example #3
0
    def test_cl_vols_ssc_all(self):
        """Test cluster ssc for all vols."""
        na_server = netapp_api.NaServer('127.0.0.1')
        vserver = 'openstack'
        test_vols = set([copy.deepcopy(self.vol1),
                         copy.deepcopy(self.vol2), copy.deepcopy(self.vol3)])
        sis = {'vola': {'dedup': False, 'compression': False},
               'volb': {'dedup': True, 'compression': False}}
        mirrored = {'vola': [{'dest_loc': 'openstack1:vol1',
                              'rel_type': 'data_protection',
                              'mirr_state': 'broken'},
                             {'dest_loc': 'openstack2:vol2',
                              'rel_type': 'data_protection',
                              'mirr_state': 'snapmirrored'}],
                    'volb': [{'dest_loc': 'openstack1:vol2',
                              'rel_type': 'data_protection',
                              'mirr_state': 'broken'}]}

        self.mox.StubOutWithMock(ssc_cmode, 'query_cluster_vols_for_ssc')
        self.mox.StubOutWithMock(ssc_cmode, 'get_sis_vol_dict')
        self.mox.StubOutWithMock(ssc_cmode, 'get_snapmirror_vol_dict')
        self.mox.StubOutWithMock(ssc_cmode, 'query_aggr_options')
        self.mox.StubOutWithMock(ssc_cmode, 'query_aggr_storage_disk')
        ssc_cmode.query_cluster_vols_for_ssc(
            na_server, vserver, None).AndReturn(test_vols)
        ssc_cmode.get_sis_vol_dict(na_server, vserver, None).AndReturn(sis)
        ssc_cmode.get_snapmirror_vol_dict(na_server, vserver, None).AndReturn(
            mirrored)
        raiddp = {'ha_policy': 'cfo', 'raid_type': 'raiddp'}
        ssc_cmode.query_aggr_options(
            na_server, mox.IgnoreArg()).AndReturn(raiddp)
        ssc_cmode.query_aggr_storage_disk(
            na_server, mox.IgnoreArg()).AndReturn('SSD')
        raid4 = {'ha_policy': 'cfo', 'raid_type': 'raid4'}
        ssc_cmode.query_aggr_options(
            na_server, mox.IgnoreArg()).AndReturn(raid4)
        ssc_cmode.query_aggr_storage_disk(
            na_server, mox.IgnoreArg()).AndReturn('SAS')
        self.mox.ReplayAll()

        res_vols = ssc_cmode.get_cluster_vols_with_ssc(
            na_server, vserver, volume=None)

        self.mox.VerifyAll()
        for vol in res_vols:
            if vol.id['name'] == 'volc':
                self.assertEqual(False, vol.sis['compression'])
                self.assertEqual(False, vol.sis['dedup'])
            else:
                pass
Example #4
0
    def test_cl_vols_ssc_all(self):
        """Test cluster ssc for all vols."""
        na_server = api.NaServer('127.0.0.1')
        vserver = 'openstack'
        test_vols = set([copy.deepcopy(self.vol1),
                         copy.deepcopy(self.vol2), copy.deepcopy(self.vol3)])
        sis = {'vola': {'dedup': False, 'compression': False},
               'volb': {'dedup': True, 'compression': False}}
        mirrored = {'vola': [{'dest_loc': 'openstack1:vol1',
                              'rel_type': 'data_protection',
                              'mirr_state': 'broken'},
                             {'dest_loc': 'openstack2:vol2',
                              'rel_type': 'data_protection',
                              'mirr_state': 'snapmirrored'}],
                    'volb': [{'dest_loc': 'openstack1:vol2',
                              'rel_type': 'data_protection',
                              'mirr_state': 'broken'}]}

        self.mox.StubOutWithMock(ssc_cmode, 'query_cluster_vols_for_ssc')
        self.mox.StubOutWithMock(ssc_cmode, 'get_sis_vol_dict')
        self.mox.StubOutWithMock(ssc_cmode, 'get_snapmirror_vol_dict')
        self.mox.StubOutWithMock(ssc_cmode, 'query_aggr_options')
        self.mox.StubOutWithMock(ssc_cmode, 'query_aggr_storage_disk')
        ssc_cmode.query_cluster_vols_for_ssc(
            na_server, vserver, None).AndReturn(test_vols)
        ssc_cmode.get_sis_vol_dict(na_server, vserver, None).AndReturn(sis)
        ssc_cmode.get_snapmirror_vol_dict(na_server, vserver, None).AndReturn(
            mirrored)
        raiddp = {'ha_policy': 'cfo', 'raid_type': 'raiddp'}
        ssc_cmode.query_aggr_options(
            na_server, IgnoreArg()).AndReturn(raiddp)
        ssc_cmode.query_aggr_storage_disk(
            na_server, IgnoreArg()).AndReturn('SSD')
        raid4 = {'ha_policy': 'cfo', 'raid_type': 'raid4'}
        ssc_cmode.query_aggr_options(
            na_server, IgnoreArg()).AndReturn(raid4)
        ssc_cmode.query_aggr_storage_disk(
            na_server, IgnoreArg()).AndReturn('SAS')
        self.mox.ReplayAll()

        res_vols = ssc_cmode.get_cluster_vols_with_ssc(
            na_server, vserver, volume=None)

        self.mox.VerifyAll()
        for vol in res_vols:
            if vol.id['name'] == 'volc':
                self.assertEqual(vol.sis['compression'], False)
                self.assertEqual(vol.sis['dedup'], False)
            else:
                pass
Example #5
0
 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_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)
Example #7
0
 def test_query_cl_vols_for_ssc(self):
     na_server = api.NaServer('127.0.0.1')
     na_server.set_api_version(1, 15)
     vols = ssc_cmode.query_cluster_vols_for_ssc(na_server, 'Openstack')
     self.assertEqual(len(vols), 2)
     for vol in vols:
         if vol.id['name'] != 'iscsi' or vol.id['name'] != 'nfsvol':
             pass
         else:
             raise exception.InvalidVolume('Invalid volume returned.')
 def test_query_cl_vols_for_ssc(self):
     na_server = api.NaServer('127.0.0.1')
     na_server.set_api_version(1, 15)
     vols = ssc_cmode.query_cluster_vols_for_ssc(na_server, 'Openstack')
     self.assertEqual(2, len(vols))
     for vol in vols:
         if vol.id['name'] != 'iscsi' or vol.id['name'] != 'nfsvol':
             pass
         else:
             raise exception.InvalidVolume('Invalid volume returned.')
Example #9
0
    def test_query_cl_vols_for_ssc(self):
        na_server = netapp_api.NaServer('127.0.0.1')
        body = etree.XML("""<results status="passed"><attributes-list>
                <volume-attributes>
                <volume-id-attributes>
                    <name>iscsi</name>
                    <owning-vserver-name>Openstack</owning-vserver-name>
                    <containing-aggregate-name>aggr0
                    </containing-aggregate-name>
                    <junction-path>/iscsi</junction-path>
                    <type>rw</type>
                </volume-id-attributes>
                <volume-space-attributes>
                    <size-available>214748364</size-available>
                    <size-total>224748364</size-total>
                    <space-guarantee-enabled>enabled</space-guarantee-enabled>
                    <space-guarantee>file</space-guarantee>
                </volume-space-attributes>
                <volume-state-attributes>
                    <is-cluster-volume>true
                    </is-cluster-volume>
                    <is-vserver-root>false</is-vserver-root>
                    <state>online</state>
                    <is-inconsistent>false</is-inconsistent>
                    <is-invalid>false</is-invalid>
                    <is-junction-active>true</is-junction-active>
                </volume-state-attributes>
                </volume-attributes>
                <volume-attributes>
                <volume-id-attributes>
                    <name>nfsvol</name>
                    <owning-vserver-name>Openstack
                    </owning-vserver-name>
                    <containing-aggregate-name>aggr0
                    </containing-aggregate-name>
                    <junction-path>/nfs</junction-path>
                    <type>rw</type>
                </volume-id-attributes>
                <volume-space-attributes>
                    <size-available>14748364</size-available>
                    <size-total>24748364</size-total>
                    <space-guarantee-enabled>enabled
                    </space-guarantee-enabled>
                    <space-guarantee>volume</space-guarantee>
                </volume-space-attributes>
                <volume-state-attributes>
                    <is-cluster-volume>true
                    </is-cluster-volume>
                    <is-vserver-root>false</is-vserver-root>
                    <state>online</state>
                    <is-inconsistent>false</is-inconsistent>
                    <is-invalid>false</is-invalid>
                    <is-junction-active>true</is-junction-active>
                </volume-state-attributes>
                </volume-attributes>
                <volume-attributes>
                <volume-id-attributes>
                    <name>nfsvol2</name>
                    <owning-vserver-name>Openstack
                    </owning-vserver-name>
                    <containing-aggregate-name>aggr0
                    </containing-aggregate-name>
                    <junction-path>/nfs2</junction-path>
                    <type>rw</type>
                </volume-id-attributes>
                <volume-space-attributes>
                    <size-available>14748364</size-available>
                    <size-total>24748364</size-total>
                    <space-guarantee-enabled>enabled
                    </space-guarantee-enabled>
                    <space-guarantee>volume</space-guarantee>
                </volume-space-attributes>
                <volume-state-attributes>
                    <is-cluster-volume>true
                    </is-cluster-volume>
                    <is-vserver-root>false</is-vserver-root>
                    <state>online</state>
                    <is-inconsistent>true</is-inconsistent>
                    <is-invalid>true</is-invalid>
                    <is-junction-active>true</is-junction-active>
                </volume-state-attributes>
                </volume-attributes>
                <volume-attributes>
                <volume-id-attributes>
                    <name>nfsvol3</name>
                    <owning-vserver-name>Openstack
                    </owning-vserver-name>
                    <containing-aggregate-name>aggr0
                    </containing-aggregate-name>
                    <junction-path>/nfs3</junction-path>
                    <type>rw</type>
                </volume-id-attributes>
                <volume-space-attributes>
                    <space-guarantee-enabled>enabled
                    </space-guarantee-enabled>
                    <space-guarantee>volume
                    </space-guarantee>
                </volume-space-attributes>
                <volume-state-attributes>
                    <is-cluster-volume>true
                    </is-cluster-volume>
                    <is-vserver-root>false</is-vserver-root>
                    <state>online</state>
                    <is-inconsistent>false</is-inconsistent>
                    <is-invalid>false</is-invalid>
                    <is-junction-active>true</is-junction-active>
                </volume-state-attributes>
                </volume-attributes>
                </attributes-list>
                <num-records>4</num-records></results>""")

        self.mock_object(ssc_cmode.netapp_api, 'invoke_api', mock.Mock(
            return_value=[netapp_api.NaElement(body)]))

        vols = ssc_cmode.query_cluster_vols_for_ssc(na_server, 'Openstack')
        self.assertEqual(2, len(vols))
        for vol in vols:
            if vol.id['name'] != 'iscsi' or vol.id['name'] != 'nfsvol':
                pass
            else:
                raise exception.InvalidVolume('Invalid volume returned.')
Example #10
0
    def test_query_cl_vols_for_ssc(self):
        na_server = netapp_api.NaServer('127.0.0.1')
        body = etree.XML("""<results status="passed"><attributes-list>
                <volume-attributes>
                <volume-id-attributes>
                    <name>iscsi</name>
                    <owning-vserver-name>Openstack</owning-vserver-name>
                    <containing-aggregate-name>aggr0
                    </containing-aggregate-name>
                    <junction-path>/iscsi</junction-path>
                    <type>rw</type>
                </volume-id-attributes>
                <volume-space-attributes>
                    <space-guarantee-enabled>enabled</space-guarantee-enabled>
                    <space-guarantee>file</space-guarantee>
                </volume-space-attributes>
                <volume-state-attributes>
                    <is-cluster-volume>true
                    </is-cluster-volume>
                    <is-vserver-root>false</is-vserver-root>
                    <state>online</state>
                    <is-inconsistent>false</is-inconsistent>
                    <is-invalid>false</is-invalid>
                    <is-junction-active>true</is-junction-active>
                </volume-state-attributes>
                </volume-attributes>
                <volume-attributes>
                <volume-id-attributes>
                    <name>nfsvol</name>
                    <owning-vserver-name>Openstack
                    </owning-vserver-name>
                    <containing-aggregate-name>aggr0
                    </containing-aggregate-name>
                    <junction-path>/nfs</junction-path>
                    <type>rw</type>
                </volume-id-attributes>
                <volume-space-attributes>
                    <space-guarantee-enabled>enabled
                    </space-guarantee-enabled>
                    <space-guarantee>volume</space-guarantee>
                </volume-space-attributes>
                <volume-state-attributes>
                    <is-cluster-volume>true
                    </is-cluster-volume>
                    <is-vserver-root>false</is-vserver-root>
                    <state>online</state>
                    <is-inconsistent>false</is-inconsistent>
                    <is-invalid>false</is-invalid>
                    <is-junction-active>true</is-junction-active>
                </volume-state-attributes>
                </volume-attributes>
                <volume-attributes>
                <volume-id-attributes>
                    <name>nfsvol2</name>
                    <owning-vserver-name>Openstack
                    </owning-vserver-name>
                    <containing-aggregate-name>aggr0
                    </containing-aggregate-name>
                    <junction-path>/nfs2</junction-path>
                    <type>rw</type>
                </volume-id-attributes>
                <volume-space-attributes>
                    <space-guarantee-enabled>enabled
                    </space-guarantee-enabled>
                    <space-guarantee>volume</space-guarantee>
                </volume-space-attributes>
                <volume-state-attributes>
                    <is-cluster-volume>true
                    </is-cluster-volume>
                    <is-vserver-root>false</is-vserver-root>
                    <state>online</state>
                    <is-inconsistent>true</is-inconsistent>
                    <is-invalid>true</is-invalid>
                    <is-junction-active>true</is-junction-active>
                </volume-state-attributes>
                </volume-attributes>
                <volume-attributes>
                <volume-id-attributes>
                    <name>nfsvol3</name>
                    <owning-vserver-name>Openstack
                    </owning-vserver-name>
                    <containing-aggregate-name>aggr0
                    </containing-aggregate-name>
                    <junction-path>/nfs3</junction-path>
                    <type>rw</type>
                </volume-id-attributes>
                <volume-space-attributes>
                    <space-guarantee-enabled>enabled
                    </space-guarantee-enabled>
                    <space-guarantee>volume
                    </space-guarantee>
                </volume-space-attributes>
                <volume-state-attributes>
                    <is-cluster-volume>true
                    </is-cluster-volume>
                    <is-vserver-root>false</is-vserver-root>
                    <state>online</state>
                    <is-inconsistent>false</is-inconsistent>
                    <is-invalid>false</is-invalid>
                    <is-junction-active>true</is-junction-active>
                </volume-state-attributes>
                </volume-attributes>
                </attributes-list>
                <num-records>4</num-records></results>""")

        self.mock_object(ssc_cmode.netapp_api, 'invoke_api',
                         mock.Mock(return_value=[netapp_api.NaElement(body)]))

        vols = ssc_cmode.query_cluster_vols_for_ssc(na_server, 'Openstack')
        self.assertEqual(3, len(vols))
        for vol in vols:
            if vol.id['name'] != 'iscsi' or vol.id['name'] != 'nfsvol':
                pass
            else:
                raise exception.InvalidVolume('Invalid volume returned.')