[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 06 of 21] CP-1833: check for lsu vmpr during snapshot
ocaml/xapi/xapi_vm_clone.ml | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) # HG changeset patch # User Marcus Granado <marcus.granado@xxxxxxxxxx> # Date 1282322886 -3600 # Node ID 6c9700d2ab2c03f24f9f42c203e53583f28dcb89 # Parent 14b8cda3a3a872ab338ae6fb7e0c6adef2131a98 CP-1833: check for lsu vmpr during snapshot Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx> diff -r 14b8cda3a3a8 -r 6c9700d2ab2c ocaml/xapi/xapi_vm_clone.ml --- a/ocaml/xapi/xapi_vm_clone.ml +++ b/ocaml/xapi/xapi_vm_clone.ml @@ -247,6 +247,21 @@ | 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 @@ -309,7 +324,7 @@ ~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 Attachment:
xen-api.hg-06.patch _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |