'Copy the volume to the specified image.'

@utils.trace_method
def copy_volume_to_image(self, context, volume, image_service, image_meta):

    LOG.debug('copy_volume_to_image    volume:    %(vol)s    image    service:%(service)s    image    meta:    %(meta)s.', {'vol': volume, 'service': six.text_type(image_service), 'meta': six.text_type(image_meta)})
    try:
        metadata = self._get_volume_metadata(volume)
        hs_img_id = self._get_volume_metadata_value(metadata, 'hs_image_id')
        path = util.get_image_path(hs_img_id, 'volume')
        image_utils.upload_volume(context, image_service, image_meta, path)
    except (exception.UnableToExecuteHyperScaleCmd, exception.UnableToProcessHyperScaleCmdOutput):
        with excutils.save_and_reraise_exception():
            LOG.exception('Failed    to    copy_volume_to_image')
