'Copy the volume to the specified image.'

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

    image_id = image_meta['id']
    with image_utils.temporary_file() as tmp:
        cmd = ('qemu-img', 'convert', '-f', 'raw', '-t', 'none', '-O', 'raw', self.client.local_path(volume), tmp)
        self._try_execute(*cmd)
        with open(tmp, 'rb') as image_file:
            image_service.update(context, image_id, {}, image_file)
