Exemple #1
0
 def add_volumes_to_group_replication(self, group, volumes):
     group_specs = common.ExtraSpecs.from_group(group)
     if group_specs.is_group_replication_enabled:
         group_name = utils.construct_group_name(group)
         for volume in volumes:
             mirror_name = utils.construct_mirror_name(volume)
             self.client.add_mirror(group_name, mirror_name)
Exemple #2
0
        def failover_volume(volume, new_status):
            mirror_name = utils.construct_mirror_name(volume)

            provider_location = volume.provider_location
            try:
                mirror_view.promote_image(mirror_name)
            except storops_ex.VNXMirrorException as ex:
                LOG.error(
                    'Failed to failover volume %(volume_id)s '
                    'to %(target)s: %(error)s.',
                    {'volume_id': volume.id,
                     'target': secondary_backend_id,
                     'error': ex})
                new_status = fields.ReplicationStatus.FAILOVER_ERROR
            else:
                # Transfer ownership to secondary_backend_id and
                # update provider_location field
                secondary_client = mirror_view.secondary_client
                provider_location = utils.update_remote_provider_location(
                    volume, secondary_client)

            model_update = {'volume_id': volume.id,
                            'updates':
                                {'replication_status': new_status,
                                 'provider_location': provider_location}}
            volume_update_list.append(model_update)
Exemple #3
0
    def setup_lun_replication(self, volume, primary_lun_id):
        """Setup replication for LUN, this only happens in primary system."""
        specs = common.ExtraSpecs.from_volume(volume)
        provision = specs.provision
        tier = specs.tier
        rep_update = {'replication_driver_data': None,
                      'replication_status': fields.ReplicationStatus.DISABLED}
        mirror_name = utils.construct_mirror_name(volume)

        if specs.is_replication_enabled:
            LOG.debug('Starting setup replication '
                      'for volume: %s.', volume.id)
            lun_size = volume.size
            pool_name = utils.get_remote_pool(self.config, volume)
            emc_taskflow.create_mirror_view(
                self.mirror_view, mirror_name,
                primary_lun_id, pool_name,
                volume.name, lun_size,
                provision, tier)
            LOG.info('Successfully setup replication for %s.', volume.id)
            rep_update.update({'replication_status':
                               fields.ReplicationStatus.ENABLED})
        group_specs = common.ExtraSpecs.from_group(volume.group)
        if volume.group and group_specs.is_group_replication_enabled:
            # If in a group, add it to group then.
            LOG.debug('Starting add volume %(volume)s to group %(group)s',
                      {'volume': volume.id, 'group': volume.group.id})
            group_name = utils.construct_group_name(volume.group)
            self.client.add_mirror(group_name, mirror_name)

        return rep_update
 def add_volumes_to_group_replication(self, group, volumes):
     group_specs = common.ExtraSpecs.from_group(group)
     if group_specs.is_group_replication_enabled:
         group_name = utils.construct_group_name(group)
         for volume in volumes:
             mirror_name = utils.construct_mirror_name(volume)
             self.client.add_mirror(group_name, mirror_name)
    def setup_lun_replication(self, volume, primary_lun_id):
        """Setup replication for LUN, this only happens in primary system."""
        specs = common.ExtraSpecs.from_volume(volume)
        provision = specs.provision
        tier = specs.tier
        rep_update = {'replication_driver_data': None,
                      'replication_status': fields.ReplicationStatus.DISABLED}
        mirror_name = utils.construct_mirror_name(volume)

        if specs.is_replication_enabled:
            LOG.debug('Starting setup replication '
                      'for volume: %s.', volume.id)
            lun_size = volume.size
            pool_name = utils.get_remote_pool(self.config, volume)
            emc_taskflow.create_mirror_view(
                self.mirror_view, mirror_name,
                primary_lun_id, pool_name,
                volume.name, lun_size,
                provision, tier)
            LOG.info('Successfully setup replication for %s.', volume.id)
            rep_update.update({'replication_status':
                               fields.ReplicationStatus.ENABLED})
        group_specs = common.ExtraSpecs.from_group(volume.group)
        if volume.group and group_specs.is_group_replication_enabled:
            # If in a group, add it to group then.
            LOG.debug('Starting add volume %(volume)s to group %(group)s',
                      {'volume': volume.id, 'group': volume.group.id})
            group_name = utils.construct_group_name(volume.group)
            self.client.add_mirror(group_name, mirror_name)

        return rep_update
        def failover_volume(volume, new_status):
            mirror_name = utils.construct_mirror_name(volume)

            provider_location = volume.provider_location
            try:
                mirror_view.promote_image(mirror_name)
            except storops_ex.VNXMirrorException as ex:
                LOG.error(
                    'Failed to failover volume %(volume_id)s '
                    'to %(target)s: %(error)s.',
                    {'volume_id': volume.id,
                     'target': secondary_backend_id,
                     'error': ex})
                new_status = fields.ReplicationStatus.FAILOVER_ERROR
            else:
                # Transfer ownership to secondary_backend_id and
                # update provider_location field
                secondary_client = mirror_view.secondary_client
                provider_location = utils.update_remote_provider_location(
                    volume, secondary_client)

            model_update = {'volume_id': volume.id,
                            'updates':
                                {'replication_status': new_status,
                                 'provider_location': provider_location}}
            volume_update_list.append(model_update)
Exemple #7
0
    def cleanup_lun_replication(self, volume):
        specs = common.ExtraSpecs.from_volume(volume)

        group_specs = common.ExtraSpecs.from_group(volume.group)
        if group_specs.is_group_replication_enabled:
            # If in a group, remove from group first.
            group_name = utils.construct_group_name(volume.group)
            mirror_name = utils.construct_mirror_name(volume)
            self.client.remove_mirror(group_name, mirror_name)

        if specs.is_replication_enabled:
            LOG.debug('Starting cleanup replication for volume: '
                      '%s.', volume.id)
            mirror_name = utils.construct_mirror_name(volume)
            mirror_view = self.build_mirror_view(self.config, True)
            mirror_view.destroy_mirror(mirror_name, volume.name)
            LOG.info('Successfully destroyed replication for volume: %s',
                     volume.id)
    def cleanup_lun_replication(self, volume):
        specs = common.ExtraSpecs.from_volume(volume)

        group_specs = common.ExtraSpecs.from_group(volume.group)
        if group_specs.is_group_replication_enabled:
            # If in a group, remove from group first.
            group_name = utils.construct_group_name(volume.group)
            mirror_name = utils.construct_mirror_name(volume)
            self.client.remove_mirror(group_name, mirror_name)

        if specs.is_replication_enabled:
            LOG.debug('Starting cleanup replication for volume: '
                      '%s.', volume.id)
            mirror_name = utils.construct_mirror_name(volume)
            mirror_view = self.build_mirror_view(self.config, True)
            mirror_view.destroy_mirror(mirror_name, volume.name)
            LOG.info(
                'Successfully destroyed replication for volume: %s',
                volume.id)