예제 #1
0
 def test_retype_need_migration_when_provision_changed(self, driver_in):
     volume = driver_in['volume']
     host = driver_in['host']
     old_spec = common.ExtraSpecs({'provisioning:type': 'thin'})
     new_spec = common.ExtraSpecs({'provisioning:type': 'deduplicated'})
     re = utils.retype_need_migration(volume, old_spec.provision,
                                      new_spec.provision, host)
     self.assertTrue(re)
예제 #2
0
 def test_retype_not_need_migration_when_provision_changed(self, driver_in):
     volume = driver_in['volume']
     host = driver_in['host']
     old_spec = common.ExtraSpecs({'provisioning:type': 'thick'})
     new_spec = common.ExtraSpecs({'provisioning:type': 'compressed'})
     re = vnx_utils.retype_need_migration(volume, old_spec.provision,
                                          new_spec.provision, host)
     self.assertFalse(re)
예제 #3
0
 def test_retype_not_need_migration(self, driver_in):
     volume = driver_in['volume']
     host = driver_in['host']
     old_spec = common.ExtraSpecs({'storagetype:tiering': 'auto'})
     new_spec = common.ExtraSpecs(
         {'storagetype:tiering': 'starthighthenauto'})
     re = vnx_utils.retype_need_migration(volume, old_spec.provision,
                                          new_spec.provision, host)
     self.assertFalse(re)
예제 #4
0
    def test_extra_specs_match_with_lun(self, mocked_res):
        lun = mocked_res['lun']
        spec_obj = common.ExtraSpecs({
            'provisioning:type': 'thin',
            'storagetype:tiering': 'nomovement',
        })
        self.assertTrue(spec_obj.match_with_lun(lun))

        lun = mocked_res['deduped_lun']
        spec_obj = common.ExtraSpecs({
            'provisioning:type': 'deduplicated',
        })
        self.assertTrue(spec_obj.match_with_lun(lun))
예제 #5
0
 def test_validate_extra_spec_dedup_invalid(self):
     spec_obj = common.ExtraSpecs({
         'provisioning:type': 'deduplicated',
     })
     enabler_status = common.VNXEnablerStatus(dedup=False)
     self.assertRaises(exception.InvalidVolumeType, spec_obj.validate,
                       enabler_status)
예제 #6
0
 def test_empty_extra_spec(self):
     extra_spec = {}
     common.ExtraSpecs.set_defaults(storops.VNXProvisionEnum.THICK,
                                    storops.VNXTieringEnum.HIGH_AUTO)
     spec_obj = common.ExtraSpecs(extra_spec)
     self.assertEqual(storops.VNXProvisionEnum.THICK, spec_obj.provision)
     self.assertEqual(storops.VNXTieringEnum.HIGH_AUTO, spec_obj.tier)
예제 #7
0
 def test_extra_specs_not_match_with_lun(self, mocked_res):
     lun = mocked_res['lun']
     spec_obj = common.ExtraSpecs({
         'provisioning:type': 'thick',
         'storagetype:tiering': 'nomovement',
     })
     self.assertFalse(spec_obj.match_with_lun(lun))
예제 #8
0
 def test_validate_extra_spec_no_thin_invalid(self):
     spec_obj = common.ExtraSpecs({
         'provisioning:type': 'compressed',
     })
     enabler_status = common.VNXEnablerStatus(compression=True, thin=False)
     self.assertRaises(exception.InvalidVolumeType, spec_obj.validate,
                       enabler_status)
예제 #9
0
 def test_extra_spec_case_insensitive(self):
     extra_spec = {
         'provisioning:type': 'Thin',
         'storagetype:tiering': 'StartHighThenAuto',
     }
     spec_obj = common.ExtraSpecs(extra_spec)
     self.assertEqual(storops.VNXProvisionEnum.THIN, spec_obj.provision)
     self.assertEqual(storops.VNXTieringEnum.HIGH_AUTO, spec_obj.tier)
예제 #10
0
 def test_valid_extra_spec(self):
     extra_spec = {
         'provisioning:type': 'deduplicated',
         'storagetype:tiering': 'nomovement',
     }
     spec_obj = common.ExtraSpecs(extra_spec)
     self.assertEqual(storops.VNXProvisionEnum.DEDUPED, spec_obj.provision)
     self.assertEqual(storops.VNXTieringEnum.NO_MOVE, spec_obj.tier)
예제 #11
0
 def test_validate_extra_spec_is_valid(self):
     spec_obj = common.ExtraSpecs({
         'storagetype:pool': 'fake_pool',
         'provisioning:type': 'thin',
         'storagetype:tiering': 'auto',
     })
     enabler_status = common.VNXEnablerStatus(dedup=True,
                                              fast=True,
                                              thin=True)
     re = spec_obj.validate(enabler_status)
     self.assertTrue(re)
예제 #12
0
 def test_validate_extra_spec_dedup_and_tier_failed(self):
     spec_obj = common.ExtraSpecs({
         'storagetype:pool': 'fake_pool',
         'provisioning:type': 'deduplicated',
         'storagetype:tiering': 'auto',
     })
     enabler_status = common.VNXEnablerStatus(dedup=True,
                                              fast=True,
                                              thin=True)
     self.assertRaises(exception.InvalidVolumeType, spec_obj.validate,
                       enabler_status)
예제 #13
0
 def test_validate_extra_spec_tier_invalid(self):
     spec_obj = common.ExtraSpecs({
         'storagetype:tiering': 'auto',
     })
     enabler_status = common.VNXEnablerStatus(dedup=True,
                                              fast=False,
                                              compression=True,
                                              snap=True,
                                              thin=True)
     self.assertRaises(exception.InvalidVolumeType, spec_obj.validate,
                       enabler_status)
예제 #14
0
def validate_cg_type(group):
    if not group.get('volume_type_ids'):
        return
    for type_id in group.get('volume_type_ids'):
        if type_id:
            specs = volume_types.get_volume_type_extra_specs(type_id)
            extra_specs = common.ExtraSpecs(specs)
            if extra_specs.provision == storops.VNXProvisionEnum.COMPRESSED:
                msg = _("Failed to create consistency group %s "
                        "because VNX consistency group cannot "
                        "accept compressed LUNs as members.") % group['id']
                raise exception.InvalidInput(reason=msg)
예제 #15
0
 def test_tier_is_not_set_to_default_for_dedup_provision(self):
     common.ExtraSpecs.set_defaults(storops.VNXProvisionEnum.THICK,
                                    storops.VNXTieringEnum.HIGH_AUTO)
     spec_obj = common.ExtraSpecs({'provisioning:type': 'deduplicated'})
     self.assertEqual(storops.VNXProvisionEnum.DEDUPED, spec_obj.provision)
     self.assertIsNone(spec_obj.tier)
예제 #16
0
 def test_get_raw_data(self):
     spec_obj = common.ExtraSpecs({'key1': 'value1'})
     self.assertIn('key1', spec_obj)
     self.assertNotIn('key2', spec_obj)
     self.assertEqual('value1', spec_obj['key1'])