Example #1
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 #2
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 #3
0
    def test_get_cluster_ssc(self):
        """Test get cluster ssc map."""
        na_server = netapp_api.NaServer('127.0.0.1')
        vserver = 'openstack'
        test_vols = set(
            [self.vol1, self.vol2, self.vol3, self.vol4, self.vol5])

        self.mox.StubOutWithMock(ssc_cmode, 'get_cluster_vols_with_ssc')
        ssc_cmode.get_cluster_vols_with_ssc(
            na_server, vserver).AndReturn(test_vols)
        self.mox.ReplayAll()

        res_map = ssc_cmode.get_cluster_ssc(na_server, vserver)

        self.mox.VerifyAll()
        self.assertEqual(1, len(res_map['mirrored']))
        self.assertEqual(3, len(res_map['dedup']))
        self.assertEqual(1, len(res_map['compression']))
        self.assertEqual(2, len(res_map['thin']))
        self.assertEqual(5, len(res_map['all']))
Example #4
0
    def test_get_cluster_ssc(self):
        """Test get cluster ssc map."""
        na_server = netapp_api.NaServer('127.0.0.1')
        vserver = 'openstack'
        test_vols = set(
            [self.vol1, self.vol2, self.vol3, self.vol4, self.vol5])

        self.mox.StubOutWithMock(ssc_cmode, 'get_cluster_vols_with_ssc')
        ssc_cmode.get_cluster_vols_with_ssc(na_server,
                                            vserver).AndReturn(test_vols)
        self.mox.ReplayAll()

        res_map = ssc_cmode.get_cluster_ssc(na_server, vserver)

        self.mox.VerifyAll()
        self.assertEqual(1, len(res_map['mirrored']))
        self.assertEqual(3, len(res_map['dedup']))
        self.assertEqual(1, len(res_map['compression']))
        self.assertEqual(2, len(res_map['thin']))
        self.assertEqual(5, len(res_map['all']))
Example #5
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 #6
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