| Disk_op_snapshot | Disk_op_checkpoint -> Db.VM.set_parent ~__context ~self:vm ~value:ref
end;
+ (* verify if this action is happening due to a VM protection policy *)
+ let is_snapshot_from_vmpp =
+ (try
+ is_a_snapshot &&
+ (let session = Context.get_session_id __context in
+ let uname = Db.Session.get_auth_user_name ~__context ~self:session in
+ let is_lsu = Db.Session.get_is_local_superuser ~__context ~self:session in
+ is_lsu && (uname = "__dom0__vmpr")
+ )
+ with e ->
+ debug "Error obtaining is_snapshot_from_vmpp: %s" (Printexc.to_string e);
+ false
+ )
+ in
+
(* create a new VM *)
Db.VM.create ~__context
~ref
~tags:all.Db_actions.vM_tags
~bios_strings:all.Db_actions.vM_bios_strings
~protection_policy:Ref.null
- ~is_snapshot_from_vmpp:false(*from_protection_policy*)
+ ~is_snapshot_from_vmpp
;
ref, uuid