Don't write image again if already cached

This stores the ID of the cached image (or `None` if nothing is cached) on the standby mode instance. If the image requested to the `prepare` command is already cached on disk, it will not write it again.