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 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 #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 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
Exemple #5
0
    def create_group_replication(self, group):
        rep_update = {'replication_status': group.replication_status}

        group_specs = common.ExtraSpecs.from_group(group)
        if group_specs.is_group_replication_enabled:
            group_name = utils.construct_group_name(group)
            self.client.create_mirror_group(group_name)
            rep_update['replication_status'] = (
                fields.ReplicationStatus.ENABLED)
        return rep_update
    def create_group_replication(self, group):
        rep_update = {'replication_status': group.replication_status}

        group_specs = common.ExtraSpecs.from_group(group)
        if group_specs.is_group_replication_enabled:
            group_name = utils.construct_group_name(group)
            self.client.create_mirror_group(group_name)
            rep_update['replication_status'] = (
                fields.ReplicationStatus.ENABLED)
        return rep_update
Exemple #7
0
    def failover_replication(self, context, group, volumes,
                             secondary_backend_id):
        """"Fail-over the consistent mirror group.

        Note:
            VNX supports fail over all the mirrors in a group as a whole,
            no need to handle each mirror one by one.
        """
        volume_update_list = []
        group_update = {'replication_status': group.replication_status}

        if secondary_backend_id != 'default':
            mirror_view = self.build_mirror_view(self.config, True)
            rep_status = fields.ReplicationStatus.FAILED_OVER
        else:
            mirror_view = self.build_mirror_view(self.config, False)
            rep_status = fields.ReplicationStatus.ENABLED

        # Update volume provider_location
        secondary_client = mirror_view.secondary_client

        group_name = utils.construct_group_name(group)
        try:
            mirror_view.promote_mirror_group(group_name)
        except storops_ex.VNXMirrorException as ex:
            LOG.error(
                'Failed to failover group %(group_id)s '
                'to %(target)s: %(error)s.', {
                    'group_id': group.id,
                    'target': secondary_backend_id,
                    'error': ex
                })
            rep_status = fields.ReplicationStatus.FAILOVER_ERROR

        for volume in volumes:
            volume_update = {
                'id':
                volume.id,
                'provider_location':
                utils.update_remote_provider_location(volume,
                                                      secondary_client),
                'replication_status':
                rep_status
            }
            volume_update_list.append(volume_update)

        group_update['replication_status'] = rep_status

        return group_update, volume_update_list
Exemple #8
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 failover_replication(self, context, group, volumes,
                             secondary_backend_id):
        """"Fail-over the consistent mirror group.

        Note:
            VNX supports fail over all the mirrors in a group as a whole,
            no need to handle each mirror one by one.
        """
        volume_update_list = []
        group_update = {'replication_status': group.replication_status}

        if secondary_backend_id != 'default':
            mirror_view = self.build_mirror_view(self.config, True)
            rep_status = fields.ReplicationStatus.FAILED_OVER
        else:
            mirror_view = self.build_mirror_view(self.config, False)
            rep_status = fields.ReplicationStatus.ENABLED

        # Update volume provider_location
        secondary_client = mirror_view.secondary_client

        group_name = utils.construct_group_name(group)
        try:
            mirror_view.promote_mirror_group(group_name)
        except storops_ex.VNXMirrorException as ex:
            LOG.error(
                'Failed to failover group %(group_id)s '
                'to %(target)s: %(error)s.',
                {'group_id': group.id,
                 'target': secondary_backend_id,
                 'error': ex})
            rep_status = fields.ReplicationStatus.FAILOVER_ERROR

        for volume in volumes:
            volume_update = {
                'id': volume.id,
                'provider_location': utils.update_remote_provider_location(
                    volume, secondary_client),
                'replication_status': rep_status}
            volume_update_list.append(volume_update)

        group_update['replication_status'] = rep_status

        return group_update, volume_update_list
    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)
Exemple #11
0
 def delete_group_replication(self, group):
     group_specs = common.ExtraSpecs.from_group(group)
     if group_specs.is_group_replication_enabled:
         group_name = utils.construct_group_name(group)
         self.client.delete_mirror_group(group_name)
 def delete_group_replication(self, group):
     group_specs = common.ExtraSpecs.from_group(group)
     if group_specs.is_group_replication_enabled:
         group_name = utils.construct_group_name(group)
         self.client.delete_mirror_group(group_name)