WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 06 of 21] CP-1833: check for lsu vmpr during snapshot

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH 06 of 21] CP-1833: check for lsu vmpr during snapshot
From: Marcus Granado <marcus.granado@xxxxxxxxxx>
Date: Fri, 20 Aug 2010 17:52:25 +0100
Delivery-date: Fri, 20 Aug 2010 10:30:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1282323139@localhost>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1282323139@localhost>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
 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
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api