'Fetch the image from image_service and write it to the volume.'

def copy_image_to_volume(self, context, volume, image_service, image_id):

    image_utils.fetch_to_raw(context, image_service, image_id, self.local_path(volume), self.configuration.volume_dd_blocksize, size=volume.size, run_as_root=self._execute_as_root)
    image_utils.resize_image(self.local_path(volume), volume.size, run_as_root=self._execute_as_root)
    data = image_utils.qemu_img_info(self.local_path(volume), run_as_root=self._execute_as_root)
    virt_size = (data.virtual_size // units.Gi)
    if (virt_size != volume.size):
        raise exception.ImageUnacceptable(image_id=image_id, reason=((_('Expected    volume    size    was    %d') % volume.size) + (_('    but    size    is    now    %d') % virt_size)))
