'Copy the volume to the specified image.'

def copy_volume_to_image(self, context, volume, image_service, image_meta):

    LOG.debug('copy_volume_to_image    %s.', volume['name'])
    use_multipath = self.configuration.use_multipath_for_image_xfer
    enforce_multipath = self.configuration.enforce_multipath_for_image_xfer
    properties = utils.brick_get_connector_properties(use_multipath, enforce_multipath)
    (attach_info, volume) = self._attach_volume(context, volume, properties)
    try:
        image_utils.upload_volume(context, image_service, image_meta, attach_info['device']['path'])
    finally:
        self._detach_volume(context, attach_info, volume, properties, force=True, ignore_errors=True)
