def migrate_volume(self, src_volume):
        LOG.info("Checking if volume '%s' already present in destination",
                 volume_name(src_volume))
        dst_cinder = self.dst_cloud.resources[utils.STORAGE_RESOURCE]

        dst_volume = dst_cinder.get_migrated_volume(src_volume['id'])
        volume_exists_in_destination = (dst_volume is not None and
                                        dst_volume.status in ['available',
                                                              'in-use'])

        if not volume_exists_in_destination:
            try:
                src_volume_object = self.src_cinder_backend.get_volume_object(
                    self.src_cloud, src_volume['id'])
                LOG.debug("Backing file for source volume: %s",
                          src_volume_object)

                dst_volume = self._create_volume(src_volume)

                # It takes time to create volume object
                timeout = self.cfg.migrate.storage_backend_timeout
                retryer = retrying.Retry(max_time=timeout)
                dst_volume_object = retryer.run(
                    self.dst_cinder_backend.get_volume_object,
                    self.dst_cloud, dst_volume.id)

                LOG.debug("Backing file for volume in destination: %s",
                          dst_volume_object)
                LOG.info("Starting volume copy from %s to %s",
                         src_volume_object, dst_volume_object)
                self.copy_volume_data(src_volume_object, dst_volume_object)
            except (plugins.base.VolumeObjectNotFoundError,
                    retrying.TimeoutExceeded,
                    exception.TenantNotPresentInDestination,
                    cinder_exceptions.OverLimit,
                    copy_mechanisms.CopyFailed) as e:
                LOG.warning("%(error)s, volume %(name)s will be skipped",
                            {'error': e.message,
                             'name': volume_name(src_volume)})

                if dst_volume is not None:
                    msg = ("Removing volume {name} from destination "
                           "since it didn't migrate properly".format(
                            name=volume_name(dst_volume)))
                    LOG.info(msg)
                    self.delete_volume(dst_volume)
            finally:
                if dst_volume is not None:
                    self.dst_cinder_backend.cleanup(self.cloud,
                                                    dst_volume.id)
        else:
            LOG.info("Volume '%s' is already present in destination cloud, "
                     "skipping", src_volume['id'])

        return dst_volume
Unsubscribe a user from the given topic.
dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/os/actions/migrate_volumes.py/MigrateVolumes.migrate_volume--crossover with--dataset/ETHPy150Open MarSoft/PebbleNotes/gae/pypebbleapi.repo/pypebbleapi/timeline.py/Timeline.unsubscribe