Clean up entries in template_store_ref, volume_store_ref and
snapshot_store_ref in case of operation failure.
Clean up template_zone_ref entries in case of create template failure.
CLOUDSTACK-2590: we should only search for active user templates when
deleting an image store.