Пример #1
0
    def retype(self, ctxt, volume, new_type, diff, host):
        LOG.info(
            'Start volume %(id)s retype. new_type: %(new_type)s, '
            'diff: %(diff)s, host: %(host)s.', {
                'id': volume.id,
                'new_type': new_type,
                'diff': diff,
                'host': host
            })

        orig_lun_info = huawei_utils.get_lun_info(self.local_cli, volume)
        if not orig_lun_info:
            msg = _("Volume %s does not exist.") % volume.id
            LOG.error(msg)
            raise exception.VolumeBackendAPIException(data=msg)

        new_opts = huawei_utils.get_volume_type_params(new_type)

        if (volume.host != host['host']
                or ('LUNType' in new_opts
                    and new_opts['LUNType'] != orig_lun_info['ALLOCTYPE'])):
            hypermetro_id, replication_id = huawei_flow.retype_by_migrate(
                volume, new_opts, host, self.local_cli,
                self.hypermetro_rmt_cli, self.replication_rmt_cli,
                self.configuration, self.support_capability)
        else:
            hypermetro_id, replication_id = huawei_flow.retype(
                volume, new_opts, self.local_cli, self.hypermetro_rmt_cli,
                self.replication_rmt_cli, self.configuration,
                self.support_capability)

        model_update = huawei_utils.get_volume_model_update(
            volume, hypermetro_id=hypermetro_id, replication_id=replication_id)

        return True, model_update
Пример #2
0
    def retype(self, ctxt, volume, new_type, diff, host):
        LOG.info('Start volume %(id)s retype. new_type: %(new_type)s, '
                 'diff: %(diff)s, host: %(host)s.',
                 {'id': volume.id, 'new_type': new_type,
                  'diff': diff, 'host': host})

        orig_lun_info = huawei_utils.get_lun_info(self.local_cli, volume)
        if not orig_lun_info:
            msg = _("Volume %s does not exist.") % volume.id
            LOG.error(msg)
            raise exception.VolumeBackendAPIException(data=msg)

        new_opts = huawei_utils.get_volume_type_params(new_type)
        if new_opts['compression'] is None:
            new_opts['compression'] = (self.configuration.san_product
                                       == "Dorado")
        if new_opts['dedup'] is None:
            new_opts['dedup'] = self.configuration.san_product == "Dorado"

        if huawei_utils.need_migrate(volume, host, new_opts, orig_lun_info):
            hypermetro_id, replication_id = huawei_flow.retype_by_migrate(
                volume, new_opts, host, self.local_cli,
                self.hypermetro_rmt_cli, self.replication_rmt_cli,
                self.configuration, self.support_capability)
        else:
            hypermetro_id, replication_id = huawei_flow.retype(
                volume, new_opts, self.local_cli, self.hypermetro_rmt_cli,
                self.replication_rmt_cli, self.configuration,
                self.support_capability)

        model_update = huawei_utils.get_volume_model_update(
            volume, hypermetro_id=hypermetro_id, replication_id=replication_id)

        return True, model_update
Пример #3
0
    def manage_existing(self, volume, existing_ref):
        (lun_id, lun_wwn, hypermetro_id, replication_id
         ) = huawei_flow.manage_existing(
            volume, existing_ref, self.local_cli,
            self.hypermetro_rmt_cli, self.replication_rmt_cli,
            self.configuration, self.support_capability)

        model_update = huawei_utils.get_volume_model_update(
            volume, huawei_lun_id=lun_id, huawei_lun_wwn=lun_wwn,
            hypermetro_id=hypermetro_id, replication_id=replication_id,
            huawei_sn=self.local_cli.device_id
        )
        return model_update
Пример #4
0
    def create_cloned_volume(self, volume, src_vref):
        (lun_id, lun_wwn, hypermetro_id, replication_id
         ) = huawei_flow.create_volume_from_volume(
            volume, src_vref, self.local_cli, self.hypermetro_rmt_cli,
            self.replication_rmt_cli, self.configuration,
            self.support_capability)

        model_update = huawei_utils.get_volume_model_update(
            volume, huawei_lun_id=lun_id, huawei_lun_wwn=lun_wwn,
            hypermetro_id=hypermetro_id, replication_id=replication_id,
            huawei_sn=self.local_cli.device_id
        )
        return model_update