Skip to content

Commit 0998c62

Browse files
committed
Don't add templates to recovered appliances.
When running VM_appliance.recover, if templates are recovered then they shouldn't be added to the resulting appliance. Signed-off-by: John Else <[email protected]>
1 parent 32c6b11 commit 0998c62

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ocaml/xapi/xapi_vm_appliance.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,11 @@ let recover ~__context ~self ~session_to ~force =
187187
let new_appliance = create ~__context:__context_to
188188
~name_label:old_appliance.API.vM_appliance_name_label
189189
~name_description:old_appliance.API.vM_appliance_name_description in
190+
(* Add all the non-template VMs to the appliance. *)
190191
List.iter
191-
(fun vm -> Db.VM.set_appliance ~__context:__context_to ~self:vm ~value:new_appliance)
192+
(fun vm ->
193+
if not (Db.VM.get_is_a_template ~__context:__context_to ~self:vm) then
194+
Db.VM.set_appliance ~__context:__context_to ~self:vm ~value:new_appliance)
192195
recovered_vms;
193196
try
194197
Db.VM_appliance.set_uuid ~__context:__context_to

0 commit comments

Comments
 (0)