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)
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)
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 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