@@ -136,6 +136,90 @@ in a private Zone, it is available only to Users in the domain assigned
136136to that Zone. If a public Template is created in a public Zone, it is
137137available to all Users in all domains.
138138
139+ Template Replication on Secondary Storage
140+ -----------------------------------------
141+
142+ A Zone may have more than one secondary storage (image store). When a
143+ Template is registered or a new Secondary Storage is added to the
144+ zone, CloudStack decides how many of those image stores should hold a
145+ copy of the Template. Historically, this decision was tied to the
146+ Template's ``public `` flag:
147+
148+ - **Public Templates ** were copied to **every ** image store in the
149+ Zone, so that the Template was readily available wherever a host
150+ pulled from.
151+
152+ - **Private Templates ** were copied to **exactly one ** image store in
153+ the Zone.
154+
155+ This coupling mixed two unrelated concerns — *who can see a Template *
156+ (access control) and *how many copies are kept on secondary storage *
157+ (placement and durability). In environments where secondary storage
158+ already provides redundancy (for example Ceph, replicated NFS, or
159+ object storage), copying public Templates to every image store wastes
160+ capacity, lengthens sync times, and adds unnecessary network and I/O
161+ load. Conversely, operators who want a second copy of a private
162+ Template for availability had no way to ask for one.
163+
164+ To give operators explicit control, CloudStack exposes two
165+ configuration settings that cap the number of secondary storage pools
166+ a Template is copied to:
167+
168+ - ``secstorage.public.template.copy.max `` — the maximum number of
169+ secondary storage pools to which a public Template is copied. The
170+ default is ``0 ``, which means "copy to every image store in the
171+ Zone" and preserves the historical behavior.
172+
173+ - ``secstorage.private.template.copy.max `` — the maximum number of
174+ secondary storage pools to which a private Template is copied. The
175+ default is ``1 ``, which preserves the historical behavior.
176+
177+ Replication stops once the configured replica count is reached. Image
178+ store selection reuses the existing CloudStack placement logic, so
179+ copies are spread across image stores in the Zone.
180+
181+ Changing these settings does **not ** change who can see or use a
182+ Template. The ``public `` flag continues to govern visibility exactly
183+ as described in the previous section; these settings only govern how
184+ many physical copies are kept.
185+
186+ Example scenarios
187+ ~~~~~~~~~~~~~~~~~
188+
189+ - **Large Zone with 5 secondary storages. ** Setting
190+ ``secstorage.public.template.copy.max = 2 `` copies public Templates to
191+ only 2 of the 5 image stores, freeing capacity on the others.
192+
193+ - **Ceph-backed secondary storage. ** Setting
194+ ``secstorage.public.template.copy.max = 1 `` avoids redundant replication
195+ because the storage layer already provides durability.
196+
197+ - **HA for private Templates. ** Setting
198+ ``secstorage.private.template.copy.max = 2 `` keeps two copies of every
199+ private Template so that the Template is still available if one
200+ image store is down.
201+
202+ - **Default (backward compatible). ** With
203+ ``secstorage.public.template.copy.max = 0 `` and
204+ ``secstorage.private.template.copy.max = 1 ``, CloudStack behaves exactly
205+ as in earlier releases.
206+
207+ Scope of application
208+ ~~~~~~~~~~~~~~~~~~~~
209+
210+ The configured replica counts are applied when:
211+
212+ - A new Template is registered in a Zone.
213+
214+ - A new secondary storage is added to a Zone and CloudStack
215+ synchronises existing Templates onto it.
216+
217+ The settings do not alter Templates that have already been replicated
218+ beyond the configured count; they only affect future placement
219+ decisions. When replication is capped by these settings, the
220+ Management Server log records why an image store was skipped, which
221+ is useful when auditing placement.
222+
139223.. _creating-a-template-from-an-existing-virtual-machine :
140224Creating a Template from an Existing Instance
141225---------------------------------------------
0 commit comments